23 #ifndef SRC_HEADERS_AVAHI_DISCOVER_H_ 24 #define SRC_HEADERS_AVAHI_DISCOVER_H_ 27 #include <avahi-gobject/ga-client.h> 28 #include <avahi-gobject/ga-service-browser.h> 29 #include <avahi-gobject/ga-service-resolver.h> 41 Entry(AvahiIfIndex interface_, AvahiProtocol protocol_,
const char *name_,
42 const char *type_,
const char *domain_, AvahiLookupResultFlags flags_)
43 : interface(interface_), protocol(protocol_), name(name_), type(type_),
44 domain(domain_), flags(flags_) {}
46 return interface == e.interface && protocol == e.
protocol && name == e.
name 52 GaServiceBrowser *browser;
53 GaServiceResolver *resolver;
54 std::list<Entry> services;
55 std::map<Glib::ustring,int> service_names;
56 sigc::signal<void> changed;
58 Glib::ustring found_name;
59 Glib::ustring found_host;
60 static void new_service(
62 const char *
name,
const char *
type,
const char *
domain, AvahiLookupResultFlags
flags,
void *data);
63 static void removed_service(
64 GaServiceBrowser *browser, AvahiIfIndex interface, AvahiProtocol protocol,
65 const char *name,
const char *type,
const char *domain, AvahiLookupResultFlags flags,
void *data);
66 static void cache_exhausted(GaServiceBrowser *browser,
void *data);
67 static void on_found(GaServiceResolver *resolver, AvahiIfIndex interface, AvahiProtocol protocol,
68 const char *name,
const char *type,
const char *domain,
const char *host_name,
69 const AvahiAddress * a, uint16_t port, AvahiStringList * txt,
70 AvahiLookupResultFlags flags,
void *data);
71 static void on_failure(GaServiceResolver *resolver, GError *error,
void *data);
78 bool get_address_port(Glib::ustring& address,
int& port, Glib::ustring& name, Glib::ustring& host);
87 class ModelColumns:
public Gtk::TreeModelColumnRecord {
89 Gtk::TreeModelColumn<Glib::ustring>
name;
90 ModelColumns() { add(name); }
93 void on_response(
int response_id);
94 void on_row(
const Gtk::TreePath& path, Gtk::TreeViewColumn* column);
95 void on_avahi_changed();
96 void on_selection_changed();
104 #endif // SRC_HEADERS_AVAHI_DISCOVER_H_
bool get_address_port(Glib::ustring &address, int &port, Glib::ustring &name, Glib::ustring &host)
AvahiLookupResultFlags flags
bool operator==(const Entry &e) const
bool invoke_resolver(const Glib::ustring &name)
bool get_address_port(Glib::ustring &address, int &port, Glib::ustring &name, Glib::ustring &host)
sigc::signal< void > & signal_changed()
void get_service_names(std::vector< Glib::ustring > &r)
Entry(AvahiIfIndex interface_, AvahiProtocol protocol_, const char *name_, const char *type_, const char *domain_, AvahiLookupResultFlags flags_)