g_message("DB: (%i.%i) %s [%s]", iface, protocol, domain, event == AVAHI_BROWSER_NEW ? "new" : "remove");
}
+static void stb_callback(AvahiServiceTypeBrowser *b, gint iface, guchar protocol, AvahiBrowserEvent event, const gchar *service_type, const gchar *domain, gpointer userdata) {
+
+ g_message("STB: (%i.%i) %s in %s [%s]", iface, protocol, service_type, domain, event == AVAHI_BROWSER_NEW ? "new" : "remove");
+}
+
int main(int argc, char *argv[]) {
GMainLoop *loop = NULL;
AvahiRecordBrowser *r;
AvahiServerConfig config;
AvahiAddress a;
AvahiDomainBrowser *db;
+ AvahiServiceTypeBrowser *stb;
avahi_server_config_init(&config);
/* config.host_name = g_strdup("test"); */
avahi_server_config_free(&config);
k = avahi_key_new("_http._tcp.local", AVAHI_DNS_CLASS_IN, AVAHI_DNS_TYPE_PTR);
- r = avahi_record_browser_new(server, 0, AF_UNSPEC, k, record_browser_callback, NULL);
+ r = avahi_record_browser_new(server, -1, AF_UNSPEC, k, record_browser_callback, NULL);
avahi_key_unref(k);
- hnr = avahi_host_name_resolver_new(server, 0, AF_UNSPEC, "codes-CompUTER.local", AF_UNSPEC, hnr_callback, NULL);
+ hnr = avahi_host_name_resolver_new(server, -1, AF_UNSPEC, "codes-CompUTER.local", AF_UNSPEC, hnr_callback, NULL);
+
+ ar = avahi_address_resolver_new(server, -1, AF_UNSPEC, avahi_address_parse("192.168.50.15", AF_INET, &a), ar_callback, NULL);
- ar = avahi_address_resolver_new(server, 0, AF_UNSPEC, avahi_address_parse("192.168.50.15", AF_INET, &a), ar_callback, NULL);
+ db = avahi_domain_browser_new(server, -1, AF_UNSPEC, NULL, AVAHI_DOMAIN_BROWSER_BROWSE, db_callback, NULL);
- db = avahi_domain_browser_new(server, 0, AF_UNSPEC, NULL, AVAHI_DOMAIN_BROWSER_BROWSE, db_callback, NULL);
+ stb = avahi_service_type_browser_new(server, -1, AF_UNSPEC, NULL, stb_callback, NULL);
loop = g_main_loop_new(NULL, FALSE);
avahi_record_browser_free(r);
avahi_host_name_resolver_free(hnr);
avahi_address_resolver_free(ar);
+ avahi_service_type_browser_free(stb);
if (group)
avahi_entry_group_free(group);
AvahiDomainBrowser *avahi_domain_browser_new(AvahiServer *server, gint interface, guchar protocol, const gchar *domain, AvahiDomainBrowserType type, AvahiDomainBrowserCallback callback, gpointer userdata);
void avahi_domain_browser_free(AvahiDomainBrowser *b);
-/* not yet implemented */
typedef struct AvahiServiceTypeBrowser AvahiServiceTypeBrowser;
+typedef void (*AvahiServiceTypeBrowserCallback)(AvahiServiceTypeBrowser *b, gint interface, guchar protocol, AvahiBrowserEvent event, const gchar *type, const gchar *domain, gpointer userdata);
+AvahiServiceTypeBrowser *avahi_service_type_browser_new(AvahiServer *server, gint interface, guchar protocol, const gchar *domain, AvahiServiceTypeBrowserCallback callback, gpointer userdata);
+void avahi_service_type_browser_free(AvahiServiceTypeBrowser *b);
+
+
+/* Not yet implemented */
+
typedef struct AvahiServiceBrowser AvahiServiceBrowser;
typedef struct AvahiServiceResolver AvahiServiceResolver;
AVAHI_LLIST_HEAD_INIT(AvahiHostNameResolver, s->host_name_resolvers);
AVAHI_LLIST_HEAD_INIT(AvahiAddressResolver, s->address_resolvers);
AVAHI_LLIST_HEAD_INIT(AvahiDomainBrowser, s->domain_browsers);
+ AVAHI_LLIST_HEAD_INIT(AvahiServiceTypeBrowser, s->service_type_browsers);
/* Get host name */
s->host_name = s->config.host_name ? avahi_normalize_name(s->config.host_name) : avahi_get_host_name();
avahi_address_resolver_free(s->address_resolvers);
while (s->domain_browsers)
avahi_domain_browser_free(s->domain_browsers);
+ while (s->service_type_browsers)
+ avahi_service_type_browser_free(s->service_type_browsers);
while (s->record_browsers)
avahi_record_browser_destroy(s->record_browsers);
g_hash_table_destroy(s->record_browser_hashtable);