Fawkes API  Fawkes Development Version
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
avahi_dispatcher.h
1 
2 /***************************************************************************
3  * avahi_dispatcher.h - Avahi browser handler and dispatcher
4  *
5  * Created: Wed Nov 05 11:30:13 2008
6  * Copyright 2008 Tim Niemueller [www.niemueller.de]
7  *
8  ****************************************************************************/
9 
10 /* This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version. A runtime exception applies to
14  * this software (see LICENSE.GPL_WRE file mentioned below for details).
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU Library General Public License for more details.
20  *
21  * Read the full text in the LICENSE.GPL_WRE file in the doc directory.
22  */
23 
24 #ifndef __LIBS_GUI_UTILS_AVAHI_DISPATCHER_H_
25 #define __LIBS_GUI_UTILS_AVAHI_DISPATCHER_H_
26 
27 #include <cstddef>
28 #include <glibmm/dispatcher.h>
29 #include <netcomm/service_discovery/browse_handler.h>
30 #include <core/utils/lock_queue.h>
31 
32 namespace fawkes {
33 #if 0 /* just to make Emacs auto-indent happy */
34 }
35 #endif
36 class AvahiThread;
37 class NetworkService;
38 
40 : public ServiceBrowseHandler
41 {
42  public:
44 
45  sigc::signal<void> signal_all_for_now();
46  sigc::signal<void> signal_cache_exhausted();
47  sigc::signal<void> signal_browse_failed();
48  sigc::signal<void, NetworkService *> signal_service_added();
49  sigc::signal<void, NetworkService *> signal_service_removed();
50 
51 
52  // from ServiceBrowseHandler
53  virtual void all_for_now();
54  virtual void cache_exhausted();
55  virtual void browse_failed(const char *name,
56  const char *type,
57  const char *domain);
58  virtual void service_added(const char *name,
59  const char *type,
60  const char *domain,
61  const char *host_name,
62  const struct sockaddr *addr,
63  const socklen_t addr_size,
64  uint16_t port,
65  std::list<std::string> &txt,
66  int flags);
67  virtual void service_removed(const char *name,
68  const char *type,
69  const char *domain);
70 
71 
72  private:
73  virtual void on_all_for_now();
74  virtual void on_cache_exhausted();
75  virtual void on_browse_failed();
76  virtual void on_service_added();
77  virtual void on_service_removed();
78 
79  private:
80  Glib::Dispatcher __dispatcher_all_for_now;
81  Glib::Dispatcher __dispatcher_cache_exhausted;
82  Glib::Dispatcher __dispatcher_browse_failed;
83  Glib::Dispatcher __dispatcher_service_added;
84  Glib::Dispatcher __dispatcher_service_removed;
85 
86  sigc::signal<void> __signal_all_for_now;
87  sigc::signal<void> __signal_cache_exhausted;
88  sigc::signal<void> __signal_browse_failed;
89  sigc::signal<void, NetworkService *> __signal_service_added;
90  sigc::signal<void, NetworkService *> __signal_service_removed;
91 
92  LockQueue<NetworkService *> __queue_service_added;
93  LockQueue<NetworkService *> __queue_service_removed;
94 };
95 
96 } // end namespace fawkes
97 
98 #endif
Avahi dispatcher.
Interface for class that process browse results.
Queue with a lock.
Definition: lock_queue.h:43