X-Git-Url: http://git.meshlink.io/?a=blobdiff_plain;f=examples%2Fcore-publish-service.c;h=f826a5f4e7a43e88d6e6f0057a3c0036b6964800;hb=d322a943be5387a539f8f3ea3a19a7e2ed5a55a2;hp=67f88dbac144580717b39b2e3596e5b4032dd540;hpb=bf7f48d6f58f28681b81915ddc4723950b947346;p=catta diff --git a/examples/core-publish-service.c b/examples/core-publish-service.c index 67f88db..f826a5f 100644 --- a/examples/core-publish-service.c +++ b/examples/core-publish-service.c @@ -85,17 +85,23 @@ static void create_services(AvahiServer *s) { snprintf(r, sizeof(r), "random=%i", rand()); /* Add the service for IPP */ - if ((ret = avahi_server_add_service(s, group, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, name, "_ipp._tcp", NULL, NULL, 651, "test=blah", r, NULL)) < 0) { + if ((ret = avahi_server_add_service(s, group, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, 0, name, "_ipp._tcp", NULL, NULL, 651, "test=blah", r, NULL)) < 0) { fprintf(stderr, "Failed to add _ipp._tcp service: %s\n", avahi_strerror(ret)); goto fail; } /* Add the same service for BSD LPR */ - if ((ret = avahi_server_add_service(s, group, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, name, "_printer._tcp", NULL, NULL, 515, NULL)) < 0) { + if ((ret = avahi_server_add_service(s, group, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, 0, name, "_printer._tcp", NULL, NULL, 515, NULL)) < 0) { fprintf(stderr, "Failed to add _printer._tcp service: %s\n", avahi_strerror(ret)); goto fail; } + /* Add an additional (hypothetic) subtype */ + if ((ret = avahi_server_add_service_subtype(s, group, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, 0, name, "_printer._tcp", NULL, "_magic._sub._printer._tcp") < 0)) { + fprintf(stderr, "Failed to add subtype _magic._sub._printer._tcp: %s\n", avahi_strerror(ret)); + goto fail; + } + /* Tell the server to register the service */ if ((ret = avahi_s_entry_group_commit(group)) < 0) { fprintf(stderr, "Failed to commit entry_group: %s\n", avahi_strerror(ret));