]> git.meshlink.io Git - catta/commitdiff
* Implement DNSServiceConstructFullName()
authorLennart Poettering <lennart@poettering.net>
Mon, 3 Oct 2005 23:01:57 +0000 (23:01 +0000)
committerLennart Poettering <lennart@poettering.net>
Mon, 3 Oct 2005 23:01:57 +0000 (23:01 +0000)
* 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

compat-bonjour/compat.c
compat-bonjour/funcs.txt
compat-bonjour/unsupported.c

index 6f129d05951b0c9b708b755be9ff0a2a1318ca17..09388423d43ed25fc77dbbcd5bfa187b86f74168 100644 (file)
@@ -35,6 +35,7 @@
 #include <avahi-common/simple-watch.h>
 #include <avahi-common/malloc.h>
 #include <avahi-common/error.h>
+#include <avahi-common/domain.h>
 #include <avahi-client/client.h>
 
 #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;
+}
+
index 2226aeb0ebc03436c5cbbcd3e41e6a1101779dee..85aa9e6fff5823ca61712497071afec33f70516b 100644 (file)
@@ -9,7 +9,7 @@ DNSServiceEnumerateDomains
 DNSServiceRegister
 x DNSServiceBrowse
 x DNSServiceResolve
-DNSServiceConstructFullName
+DNSServiceConstructFullName
 
 x TXTRecordCreate
 x TXTRecordDeallocate
index 972f3e502747854597627a7752e2c21131552eb8..2afbae299549b46825fcf41bad34cb12c5f3a0e2 100644 (file)
@@ -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,