Fawkes API
Fawkes Development Version
|
00001 00002 /*************************************************************************** 00003 * avahi_dispatcher.h - Avahi browser handler and dispatcher 00004 * 00005 * Created: Wed Nov 05 11:30:13 2008 00006 * Copyright 2008 Tim Niemueller [www.niemueller.de] 00007 * 00008 ****************************************************************************/ 00009 00010 /* This program is free software; you can redistribute it and/or modify 00011 * it under the terms of the GNU General Public License as published by 00012 * the Free Software Foundation; either version 2 of the License, or 00013 * (at your option) any later version. A runtime exception applies to 00014 * this software (see LICENSE.GPL_WRE file mentioned below for details). 00015 * 00016 * This program is distributed in the hope that it will be useful, 00017 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00018 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00019 * GNU Library General Public License for more details. 00020 * 00021 * Read the full text in the LICENSE.GPL_WRE file in the doc directory. 00022 */ 00023 00024 #ifndef __LIBS_GUI_UTILS_AVAHI_DISPATCHER_H_ 00025 #define __LIBS_GUI_UTILS_AVAHI_DISPATCHER_H_ 00026 00027 #include <cstddef> 00028 #include <glibmm/dispatcher.h> 00029 #include <netcomm/service_discovery/browse_handler.h> 00030 #include <core/utils/lock_queue.h> 00031 00032 namespace fawkes { 00033 #if 0 /* just to make Emacs auto-indent happy */ 00034 } 00035 #endif 00036 class AvahiThread; 00037 class NetworkService; 00038 00039 class AvahiDispatcher 00040 : public ServiceBrowseHandler 00041 { 00042 public: 00043 AvahiDispatcher(); 00044 00045 sigc::signal<void> signal_all_for_now(); 00046 sigc::signal<void> signal_cache_exhausted(); 00047 sigc::signal<void> signal_browse_failed(); 00048 sigc::signal<void, NetworkService *> signal_service_added(); 00049 sigc::signal<void, NetworkService *> signal_service_removed(); 00050 00051 00052 // from ServiceBrowseHandler 00053 virtual void all_for_now(); 00054 virtual void cache_exhausted(); 00055 virtual void browse_failed(const char *name, 00056 const char *type, 00057 const char *domain); 00058 virtual void service_added(const char *name, 00059 const char *type, 00060 const char *domain, 00061 const char *host_name, 00062 const struct sockaddr *addr, 00063 const socklen_t addr_size, 00064 uint16_t port, 00065 std::list<std::string> &txt, 00066 int flags); 00067 virtual void service_removed(const char *name, 00068 const char *type, 00069 const char *domain); 00070 00071 00072 private: 00073 virtual void on_all_for_now(); 00074 virtual void on_cache_exhausted(); 00075 virtual void on_browse_failed(); 00076 virtual void on_service_added(); 00077 virtual void on_service_removed(); 00078 00079 private: 00080 Glib::Dispatcher __dispatcher_all_for_now; 00081 Glib::Dispatcher __dispatcher_cache_exhausted; 00082 Glib::Dispatcher __dispatcher_browse_failed; 00083 Glib::Dispatcher __dispatcher_service_added; 00084 Glib::Dispatcher __dispatcher_service_removed; 00085 00086 sigc::signal<void> __signal_all_for_now; 00087 sigc::signal<void> __signal_cache_exhausted; 00088 sigc::signal<void> __signal_browse_failed; 00089 sigc::signal<void, NetworkService *> __signal_service_added; 00090 sigc::signal<void, NetworkService *> __signal_service_removed; 00091 00092 LockQueue<NetworkService *> __queue_service_added; 00093 LockQueue<NetworkService *> __queue_service_removed; 00094 }; 00095 00096 } // end namespace fawkes 00097 00098 #endif