From: Lennart Poettering Date: Mon, 3 Oct 2005 23:01:57 +0000 (+0000) Subject: * Implement DNSServiceConstructFullName() X-Git-Url: https://git.meshlink.io/?a=commitdiff_plain;h=7df29f3e6c12a937e7cf7e476c428da57b6a5d16;p=catta * Implement DNSServiceConstructFullName() * fix DNSServiceResolve to return the full service name correctly git-svn-id: file:///home/lennart/svn/public/avahi/trunk@687 941a03a8-eaeb-0310-b9a0-b1bbd8fe43fe --- diff --git a/compat-bonjour/compat.c b/compat-bonjour/compat.c index 6f129d0..0938842 100644 --- a/compat-bonjour/compat.c +++ b/compat-bonjour/compat.c @@ -35,6 +35,7 @@ #include #include #include +#include #include #include "warn.h" @@ -460,13 +461,18 @@ static void service_resolver_callback( switch (event) { case AVAHI_RESOLVER_FOUND: { + char full_name[kDNSServiceMaxDomainName]; + int ret; char *p = NULL; size_t l = 0; if ((p = avahi_new0(char, (l = avahi_string_list_serialize(txt, NULL, 0))+1))) avahi_string_list_serialize(txt, p, l); + + ret = avahi_service_name_snprint(full_name, sizeof(full_name), name, type, domain); + assert(ret == AVAHI_OK); - sdref->service_resolver_callback(sdref, 0, interface, kDNSServiceErr_NoError, "blaa", host_name, htons(port), l, p, sdref->context); + sdref->service_resolver_callback(sdref, 0, interface, kDNSServiceErr_NoError, full_name, host_name, htons(port), l, p, sdref->context); avahi_free(p); break; @@ -543,3 +549,21 @@ finish: return ret; } +int DNSSD_API DNSServiceConstructFullName ( + char *fullName, + const char *service, + const char *regtype, + const char *domain) { + + AVAHI_WARN_LINKAGE; + + assert(fullName); + assert(regtype); + assert(domain); + + if (avahi_service_name_snprint(fullName, kDNSServiceMaxDomainName, service, regtype, domain) < 0) + return -1; + + return 0; +} + diff --git a/compat-bonjour/funcs.txt b/compat-bonjour/funcs.txt index 2226aeb..85aa9e6 100644 --- a/compat-bonjour/funcs.txt +++ b/compat-bonjour/funcs.txt @@ -9,7 +9,7 @@ DNSServiceEnumerateDomains DNSServiceRegister x DNSServiceBrowse x DNSServiceResolve -DNSServiceConstructFullName +x DNSServiceConstructFullName x TXTRecordCreate x TXTRecordDeallocate diff --git a/compat-bonjour/unsupported.c b/compat-bonjour/unsupported.c index 972f3e5..2afbae2 100644 --- a/compat-bonjour/unsupported.c +++ b/compat-bonjour/unsupported.c @@ -57,17 +57,6 @@ DNSServiceErrorType DNSSD_API DNSServiceRegister ( return kDNSServiceErr_Unsupported; } -int DNSSD_API DNSServiceConstructFullName ( - char *fullName, - const char *service, - const char *regtype, - const char *domain) { - - AVAHI_WARN_UNSUPPORTED; - - return kDNSServiceErr_Unsupported; -} - DNSServiceErrorType DNSSD_API DNSServiceRegisterRecord ( DNSServiceRef sdRef, DNSRecordRef *RecordRef,