X-Git-Url: http://git.meshlink.io/?a=blobdiff_plain;f=avahi-compat-libdns_sd%2Fnull-test.c;h=a6c03df1a1c2290e35be23d27c5fecb637a9d4c9;hb=8f106ca9eb014411a4276dd0ab87efce8921e332;hp=272e9c34004a082a7127a09302b279dcf947062c;hpb=d4fd0d73b1d646f3708f1fdcbca0d494dda7e475;p=catta diff --git a/avahi-compat-libdns_sd/null-test.c b/avahi-compat-libdns_sd/null-test.c index 272e9c3..a6c03df 100644 --- a/avahi-compat-libdns_sd/null-test.c +++ b/avahi-compat-libdns_sd/null-test.c @@ -32,15 +32,42 @@ #include #include +static void reply( + AVAHI_GCC_UNUSED DNSServiceRef sdRef, + AVAHI_GCC_UNUSED DNSServiceFlags flags, + AVAHI_GCC_UNUSED uint32_t interfaceIndex, + AVAHI_GCC_UNUSED DNSServiceErrorType errorCode, + AVAHI_GCC_UNUSED const char *serviceName, + AVAHI_GCC_UNUSED const char *regtype, + AVAHI_GCC_UNUSED const char *replyDomain, + AVAHI_GCC_UNUSED void *context) { +} + int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char*argv[]) { - DNSServiceRef ref; + DNSServiceRef ref1, ref2, ref3, ref4 = NULL; + + DNSServiceRegister(&ref1, 0, 0, "simple", "_simple._tcp", NULL, NULL, 4711, 0, NULL, NULL, NULL); + DNSServiceRegister(&ref2, 0, 0, "subtype #1", "_simple._tcp,_subtype1", NULL, NULL, 4711, 0, NULL, NULL, NULL); + DNSServiceRegister(&ref3, 0, 0, "subtype #2", "_simple._tcp,_subtype1,_subtype2", NULL, NULL, 4711, 0, NULL, NULL, NULL); + + DNSServiceRegister(&ref4, 0, 0, "subtype #3", "_simple._tcp,,", NULL, NULL, 4711, 0, NULL, NULL, NULL); + assert(!ref4); + DNSServiceRegister(&ref4, 0, 0, "subtype #3", "", NULL, NULL, 4711, 0, NULL, NULL, NULL); + assert(!ref4); + DNSServiceRegister(&ref4, 0, 0, "subtype #3", ",", NULL, NULL, 4711, 0, NULL, NULL, NULL); + assert(!ref4); + DNSServiceRegister(&ref4, 0, 0, "subtype #3", ",,", NULL, NULL, 4711, 0, NULL, NULL, NULL); + assert(!ref4); - DNSServiceRegister(&ref, 0, 0, "fucker", "_fuck._tcp", NULL, NULL, 4711, 0, NULL, NULL, NULL); + DNSServiceBrowse(&ref4, 0, 0, "_simple._tcp,_gurke", NULL, reply, NULL); sleep(20); - DNSServiceRefDeallocate(ref); + DNSServiceRefDeallocate(ref1); + DNSServiceRefDeallocate(ref2); + DNSServiceRefDeallocate(ref3); + DNSServiceRefDeallocate(ref4); return 0; }