X-Git-Url: http://git.meshlink.io/?a=blobdiff_plain;ds=sidebyside;f=examples%2Fcore-browse-services.c;h=f3bf7825d2383392ba9ed0db68c28c528250e0ea;hb=5af9f469d85a9281bc5484e9f5a8740751591dfe;hp=7227bd7495918029b187c1c68a8e5706cd2902cf;hpb=66c497f4637276f390f1a7afaf7fe07616da9f1a;p=catta diff --git a/examples/core-browse-services.c b/examples/core-browse-services.c index 7227bd7..f3bf782 100644 --- a/examples/core-browse-services.c +++ b/examples/core-browse-services.c @@ -1,5 +1,16 @@ /* $Id$ */ +/* PLEASE NOTE * + * This file demonstrates how to use Avahi's core API, this is + * the embeddable mDNS stack for embedded applications. + * + * End user applications should *not* use this API and should use + * the DBUS or C APIs, please see + * client-browse-services.c and glib-integration.c + * + * I repeat, you probably do *not* want to use this example. + */ + /*** This file is part of avahi. @@ -31,8 +42,10 @@ #include #include #include +#include static AvahiSimplePoll *simple_poll = NULL; +static AvahiServer *server = NULL; static void resolve_callback( AvahiSServiceResolver *r, @@ -63,7 +76,15 @@ static void resolve_callback( avahi_address_snprint(a, sizeof(a), address); t = avahi_string_list_to_string(txt); - fprintf(stderr, "\t%s:%u (%s) TXT=%s\n", host_name, port, a, t); + fprintf(stderr, + "\t%s:%u (%s)\n" + "\tTXT=%s\n" + "\tcookie is %u\n" + "\tis_local: %i\n", + host_name, port, a, + t, + avahi_string_list_get_service_cookie(txt), + avahi_server_is_service_local(server, interface, protocol, name, type, domain)); avahi_free(t); } @@ -104,7 +125,6 @@ static void browse_callback( int main(int argc, char*argv[]) { AvahiServerConfig config; - AvahiServer *server = NULL; AvahiSServiceBrowser *sb; int error; int ret = 1;