diff options
author | Lennart Poettering <lennart@poettering.net> | 2005-08-14 22:11:35 +0000 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2005-08-14 22:11:35 +0000 |
commit | 769c00f228ba0d37217aaf1424dedde390e7a01c (patch) | |
tree | e641d94f918a133f59e0eeb8e07109247d4d7aab /avahi-client/client-test.c | |
parent | a4acfaf4f942f702606e660990c873c9ff5b0395 (diff) |
* add new priority parameter to avahi_glib_poll_new()
* beef up AvahiPoll a little to contain real timeout events
* cleanups in avahi-client
* drop glib dependency
* port to AvahiPoll system
* put some "const"s and "static"s in to make gcc shut up
* change all uses of malloc/free to avahi_malloc/avahi_new/avahi_free
git-svn-id: file:///home/lennart/svn/public/avahi/trunk@324 941a03a8-eaeb-0310-b9a0-b1bbd8fe43fe
Diffstat (limited to 'avahi-client/client-test.c')
-rw-r--r-- | avahi-client/client-test.c | 32 |
1 files changed, 19 insertions, 13 deletions
diff --git a/avahi-client/client-test.c b/avahi-client/client-test.c index 352ee58..2189467 100644 --- a/avahi-client/client-test.c +++ b/avahi-client/client-test.c @@ -25,53 +25,55 @@ #include <avahi-client/client.h> #include <avahi-common/error.h> +#include <avahi-glib/glib-watch.h> +#include <avahi-glib/glib-malloc.h> #include <stdio.h> #include <glib.h> -void +static void avahi_client_callback (AvahiClient *c, AvahiClientState state, void *user_data) { printf ("XXX: Callback on client, state -> %d, data -> %s\n", state, (char*)user_data); } -void +static void avahi_entry_group_callback (AvahiEntryGroup *g, AvahiEntryGroupState state, void *user_data) { printf ("XXX: Callback on %s, state -> %d, data -> %s\n", avahi_entry_group_path (g), state, (char*)user_data); } -void -avahi_domain_browser_callback (AvahiDomainBrowser *b, AvahiIfIndex interface, AvahiProtocol protocol, AvahiBrowserEvent event, char *domain, void *user_data) +static void +avahi_domain_browser_callback (AvahiDomainBrowser *b, AvahiIfIndex interface, AvahiProtocol protocol, AvahiBrowserEvent event, const char *domain, void *user_data) { printf ("XXX: Callback on %s, interface (%d), protocol (%d), event (%d), domain (%s), data (%s)\n", avahi_domain_browser_path (b), interface, protocol, event, domain, (char*)user_data); } -void -avahi_service_browser_callback (AvahiServiceBrowser *b, AvahiIfIndex interface, AvahiProtocol protocol, AvahiBrowserEvent event, char *name, char *type, char *domain, void *user_data) +static void +avahi_service_browser_callback (AvahiServiceBrowser *b, AvahiIfIndex interface, AvahiProtocol protocol, AvahiBrowserEvent event, const char *name, const char *type, const char *domain, void *user_data) { printf ("XXX: Callback on %s, interface (%d), protocol (%d), event (%d), name (%s), type (%s), domain (%s), data (%s)\n", avahi_service_browser_path (b), interface, protocol, event, name, type, domain, (char*)user_data); } -void -avahi_service_type_browser_callback (AvahiServiceTypeBrowser *b, AvahiIfIndex interface, AvahiProtocol protocol, AvahiBrowserEvent event, char *type, char *domain, void *user_data) +static void +avahi_service_type_browser_callback (AvahiServiceTypeBrowser *b, AvahiIfIndex interface, AvahiProtocol protocol, AvahiBrowserEvent event, const char *type, const char *domain, void *user_data) { 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 +static gboolean test_free_domain_browser (gpointer data) { - printf ("XXX: freeing domain browser\n"); AvahiServiceBrowser *b = data; + printf ("XXX: freeing domain browser\n"); avahi_service_browser_free (b); return FALSE; } -gboolean +static gboolean test_free_entry_group (gpointer data) { - printf ("XXX: freeing entry group\n"); AvahiEntryGroup *g = data; + printf ("XXX: freeing entry group\n"); avahi_entry_group_free (g); return FALSE; } @@ -85,11 +87,15 @@ main (int argc, char *argv[]) AvahiDomainBrowser *domain; AvahiServiceBrowser *sb; AvahiServiceTypeBrowser *st; + AvahiGLibPoll *glib_poll; char *ret; + avahi_set_allocator(avahi_glib_allocator()); + + glib_poll = avahi_glib_poll_new(NULL, G_PRIORITY_DEFAULT); loop = g_main_loop_new (NULL, FALSE); - avahi = avahi_client_new (avahi_client_callback, "omghai2u"); + avahi = avahi_client_new (avahi_glib_poll_get(glib_poll), avahi_client_callback, "omghai2u"); g_assert (avahi != NULL); |