summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/client-browse-services.c10
-rw-r--r--examples/core-browse-services.c12
2 files changed, 19 insertions, 3 deletions
diff --git a/examples/client-browse-services.c b/examples/client-browse-services.c
index 916b12b..7537940 100644
--- a/examples/client-browse-services.c
+++ b/examples/client-browse-services.c
@@ -64,7 +64,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 (cookie is %u)\n", host_name, port, a, t, avahi_string_list_get_service_cookie(txt));
+ 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_client_is_service_local(avahi_service_resolver_get_client(r), interface, protocol, name, type, domain));
avahi_free(t);
}
diff --git a/examples/core-browse-services.c b/examples/core-browse-services.c
index 8df5454..f3bf782 100644
--- a/examples/core-browse-services.c
+++ b/examples/core-browse-services.c
@@ -45,6 +45,7 @@
#include <avahi-common/error.h>
static AvahiSimplePoll *simple_poll = NULL;
+static AvahiServer *server = NULL;
static void resolve_callback(
AvahiSServiceResolver *r,
@@ -75,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 (cookie is %u)\n", host_name, port, a, t, avahi_string_list_get_service_cookie(txt));
+ 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);
}
@@ -116,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;