]> git.meshlink.io Git - catta/commitdiff
in order to reduce our code/API size, drop support for reverse IPv6 name lookups...
authorLennart Poettering <lennart@poettering.net>
Tue, 18 Oct 2005 22:39:14 +0000 (22:39 +0000)
committerLennart Poettering <lennart@poettering.net>
Tue, 18 Oct 2005 22:39:14 +0000 (22:39 +0000)
git-svn-id: file:///home/lennart/svn/public/avahi/trunk@817 941a03a8-eaeb-0310-b9a0-b1bbd8fe43fe

avahi-common/address.c
avahi-common/address.h
avahi-core/entry.c
avahi-core/resolve-address.c

index 722d528a9c2ef435a3b86fe70966eefa3bff03a2..f3f3a67619daa17fc03666327d14089d984e81af 100644 (file)
@@ -59,7 +59,10 @@ char *avahi_address_snprint(char *s, size_t length, const AvahiAddress *a) {
     assert(length);
     assert(a);
     
-    return (char*) inet_ntop(avahi_proto_to_af(a->proto), a->data.data, s, length);
+    if (!(inet_ntop(avahi_proto_to_af(a->proto), a->data.data, s, length)))
+        return NULL;
+    
+    return s;
 }
 
 char* avahi_reverse_lookup_name_ipv4(const AvahiIPv4Address *a) {
@@ -69,9 +72,9 @@ char* avahi_reverse_lookup_name_ipv4(const AvahiIPv4Address *a) {
     return avahi_strdup_printf("%u.%u.%u.%u.in-addr.arpa", n & 0xFF, (n >> 8) & 0xFF, (n >> 16) & 0xFF, n >> 24);
 }
 
-static char *reverse_lookup_name_ipv6(const AvahiIPv6Address *a, const char *suffix) {
+char *avahi_reverse_lookup_name_ipv6(const AvahiIPv6Address *a) {
     
-    return avahi_strdup_printf("%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%s",
+    return avahi_strdup_printf("%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.ip6.arpa",
                            a->address[15] & 0xF,
                            a->address[15] >> 4,
                            a->address[14] & 0xF,
@@ -103,16 +106,7 @@ static char *reverse_lookup_name_ipv6(const AvahiIPv6Address *a, const char *suf
                            a->address[1] & 0xF,
                            a->address[1] >> 4,
                            a->address[0] & 0xF,
-                           a->address[0] >> 4,
-                           suffix);
-}
-
-char *avahi_reverse_lookup_name_ipv6_arpa(const AvahiIPv6Address *a) {
-    return reverse_lookup_name_ipv6(a, "ip6.arpa");
-}
-
-char *avahi_reverse_lookup_name_ipv6_int(const AvahiIPv6Address *a) {
-    return reverse_lookup_name_ipv6(a, "ip6.int");
+                           a->address[0] >> 4);
 }
 
 AvahiAddress *avahi_address_parse(const char *s, AvahiProtocol proto, AvahiAddress *ret_addr) {
index 72a0e5e2d88de0e2e05cffef1feb9178bb85c1f6..f1ac42859f06d98494dd7398c48b64800a9953c0 100644 (file)
@@ -106,10 +106,7 @@ uint16_t avahi_port_from_sockaddr(const struct sockaddr* sa);
 char* avahi_reverse_lookup_name_ipv4(const AvahiIPv4Address *a);
 
 /** Generate the modern DNS reverse lookup name for an IPv6 address, ending in ipv6.arpa. avahi_free() the result! */
-char* avahi_reverse_lookup_name_ipv6_arpa(const AvahiIPv6Address *a);
-
-/** Generate the historic DNS reverse lookup name for an IPv6 address, ending in ipv6.int. avahi_free() the result! */
-char* avahi_reverse_lookup_name_ipv6_int(const AvahiIPv6Address *a);
+char* avahi_reverse_lookup_name_ipv6(const AvahiIPv6Address *a);
 
 /** Check whether the specified IPv6 address is in fact an
  * encapsulated IPv4 address, returns 1 if yes, 0 otherwise */
index e4008bc3b12e38179062e9e446333667e57c4999..23ab5e00adf81aab43b695388435b28c0f20d012 100644 (file)
@@ -428,18 +428,7 @@ int avahi_server_add_address(
         if (!(flags & AVAHI_PUBLISH_NO_REVERSE)) {
             char *reverse;
 
-            if (!(reverse = avahi_reverse_lookup_name_ipv6_arpa(&a->data.ipv6))) {
-                ret = avahi_server_set_errno(s, AVAHI_ERR_NO_MEMORY);
-                goto fail;
-            }
-            
-            ret = avahi_server_add_ptr(s, g, interface, protocol, flags | AVAHI_PUBLISH_UNIQUE, AVAHI_DEFAULT_TTL_HOST_NAME, reverse, name);
-            avahi_free(reverse);
-            
-            if (ret < 0)
-                goto fail;
-            
-            if (!(reverse = avahi_reverse_lookup_name_ipv6_int(&a->data.ipv6))) {
+            if (!(reverse = avahi_reverse_lookup_name_ipv6(&a->data.ipv6))) {
                 ret = avahi_server_set_errno(s, AVAHI_ERR_NO_MEMORY);
                 goto fail;
             }
index 94e07f5356929ca75fca1ad575c593b3357ae2c2..08168b608e1eff47ddf724782346aaeea759e9ef 100644 (file)
@@ -205,7 +205,7 @@ AvahiSAddressResolver *avahi_s_address_resolver_new(
     if (address->proto == AVAHI_PROTO_INET)
         n = avahi_reverse_lookup_name_ipv4(&address->data.ipv4);
     else 
-        n = avahi_reverse_lookup_name_ipv6_arpa(&address->data.ipv6);
+        n = avahi_reverse_lookup_name_ipv6(&address->data.ipv6);
 
     if (!n) {
         avahi_server_set_errno(server, AVAHI_ERR_NO_MEMORY);