return NULL;
}
+void
+avahi_domain_browser_free (AvahiDomainBrowser *b)
+{
+ DBusMessage *message = NULL;
+
+ if (b == NULL || b->path == NULL)
+ return;
+
+ message = dbus_message_new_method_call (AVAHI_DBUS_NAME,
+ b->path,
+ AVAHI_DBUS_INTERFACE_DOMAIN_BROWSER, "Free");
+
+ dbus_connection_send (b->client->bus, message, NULL);
+
+ AVAHI_LLIST_REMOVE(AvahiDomainBrowser, domain_browsers, b->client->domain_browsers, b);
+
+ free (b);
+
+ return;
+}
+
char*
avahi_domain_browser_path (AvahiDomainBrowser *b)
{
return NULL;
}
+void
+avahi_service_type_browser_free (AvahiServiceTypeBrowser *b)
+{
+ DBusMessage *message = NULL;
+
+ if (b == NULL || b->path == NULL)
+ return;
+
+ message = dbus_message_new_method_call (AVAHI_DBUS_NAME,
+ b->path,
+ AVAHI_DBUS_INTERFACE_SERVICE_TYPE_BROWSER, "Free");
+
+ dbus_connection_send (b->client->bus, message, NULL);
+
+ AVAHI_LLIST_REMOVE(AvahiServiceTypeBrowser, service_type_browsers, b->client->service_type_browsers, b);
+
+ free (b);
+
+ return;
+}
+
char*
avahi_service_type_browser_path (AvahiServiceTypeBrowser *b)
{
return NULL;
}
+
+void
+avahi_service_browser_free (AvahiServiceBrowser *b)
+{
+ DBusMessage *message = NULL;
+
+ if (b == NULL || b->path == NULL)
+ return;
+
+ printf ("Freeing %s\n", b->path);
+
+ message = dbus_message_new_method_call (AVAHI_DBUS_NAME,
+ b->path,
+ AVAHI_DBUS_INTERFACE_SERVICE_BROWSER, "Free");
+
+ dbus_connection_send (b->client->bus, message, NULL);
+
+ AVAHI_LLIST_REMOVE(AvahiServiceBrowser, service_browsers, b->client->service_browsers, b);
+
+ free (b);
+
+ return;
+}
char*
avahi_service_browser_path (AvahiServiceBrowser *b)
{
printf ("XXX: Callback on %s, interface (%d), protocol (%d), event (%d), type (%s), domain (%s), data (%s)\n", avahi_service_type_browser_path (b), interface, protocol, event, type, domain, (char*)user_data);
}
+
+gboolean
+test_free (gpointer data)
+{
+ printf ("XXX: freeing\n");
+ AvahiServiceBrowser *b = data;
+ avahi_service_browser_free (b);
+ return FALSE;
+}
+
int
main (int argc, char *argv[])
{
else
printf ("Sucessfully created service browser, path %s\n", avahi_service_browser_path (sb));
+ g_timeout_add (2000, test_free, sb);
+
g_main_loop_run (loop);
g_free (avahi);
/** Get the D-Bus path of an AvahiEntryGroup object, for debugging purposes only. */
char* avahi_entry_group_path (AvahiEntryGroup *);
-/** Get the D-Bus path of an AvahiDomainBrowser object, for debugging purposes only. */
-char* avahi_domain_browser_path (AvahiDomainBrowser *);
-
/** Browse for domains on the local network */
AvahiDomainBrowser* avahi_domain_browser_new (AvahiClient *client,
AvahiIfIndex interface,
AvahiDomainBrowserCallback callback,
void *user_data);
-/** Get the D-Bus path of an AvahiServiceTypeBrowser object, for debugging purposes only. */
-char* avahi_service_type_browser_path (AvahiServiceTypeBrowser *);
+/** Get the D-Bus path of an AvahiDomainBrowser object, for debugging purposes only. */
+char* avahi_domain_browser_path (AvahiDomainBrowser *);
+
+/** Cleans up and frees an AvahiDomainBrowser object */
+void avahi_domain_browser_free (AvahiDomainBrowser *);
/** Browse for service types on the local network */
AvahiServiceTypeBrowser* avahi_service_type_browser_new (
AvahiServiceTypeBrowserCallback callback,
void *user_data);
-/** Get the D-Bus path of an AvahiServiceBrowser object, for debugging purposes only. */
-char* avahi_service_browser_path (AvahiServiceBrowser *);
+/** Get the D-Bus path of an AvahiServiceTypeBrowser object, for debugging purposes only. */
+char* avahi_service_type_browser_path (AvahiServiceTypeBrowser *);
+
+/** Cleans up and frees an AvahiServiceTypeBrowser object */
+void avahi_service_type_browser_free (AvahiServiceTypeBrowser *);
/** Browse for services of a type on the local network */
AvahiServiceBrowser* avahi_service_browser_new (
AvahiServiceBrowserCallback callback,
void *user_data);
+/** Get the D-Bus path of an AvahiServiceBrowser object, for debugging purposes only. */
+char* avahi_service_browser_path (AvahiServiceBrowser *);
+
+/* Cleans up and frees an AvahiServiceBrowser object */
+void avahi_service_browser_free (AvahiServiceBrowser *);
+
#ifndef DOXYGEN_SHOULD_SKIP_THIS
AVAHI_C_DECL_END
#endif