]> git.meshlink.io Git - catta/commitdiff
* fix some small issues in client-test
authorLennart Poettering <lennart@poettering.net>
Sat, 27 Aug 2005 18:25:29 +0000 (18:25 +0000)
committerLennart Poettering <lennart@poettering.net>
Sat, 27 Aug 2005 18:25:29 +0000 (18:25 +0000)
* add protocol argument avahi_adress_resolver_new_a()

git-svn-id: file:///home/lennart/svn/public/avahi/trunk@458 941a03a8-eaeb-0310-b9a0-b1bbd8fe43fe

avahi-client/client-test.c
avahi-client/client.h
avahi-client/resolver.c

index 037867d2c9d5ddd72d8b1b14a591194a7d274c01..67b977aa80b6c087ea94333a2a5214d43ea99fa2 100644 (file)
@@ -86,7 +86,7 @@ avahi_service_type_browser_callback (AvahiServiceTypeBrowser *b, AvahiIfIndex in
 }
 
 static void
-avahi_address_resolver_callback (AvahiAddressResolver *r, AvahiIfIndex interface, AvahiProtocol protocol, AvahiResolverEvent event, AvahiProtocol aprotocol, const AvahiAddress *address, const char *name, const char *userdata)
+avahi_address_resolver_callback (AvahiAddressResolver *r, AvahiIfIndex interface, AvahiProtocol protocol, AvahiResolverEvent event, AvahiProtocol aprotocol, const AvahiAddress *address, const char *name, void *userdata)
 {
     char addr[64];
     if (event == AVAHI_RESOLVER_TIMEOUT)
@@ -95,7 +95,7 @@ avahi_address_resolver_callback (AvahiAddressResolver *r, AvahiIfIndex interface
         avahi_address_resolver_free (r);
         return;
     }
-    avahi_address_snprint (&addr, sizeof (addr), address);
+    avahi_address_snprint (addr, sizeof (addr), address);
     printf ("Callback on AddressResolver, interface (%d), protocol (%d), even (%d), aprotocol (%d), address (%s), name (%s), data(%s)\n", interface, protocol, event, aprotocol, addr, name);
 }
 
@@ -113,14 +113,14 @@ avahi_host_name_resolver_callback (AvahiHostNameResolver *r, AvahiIfIndex interf
         return;
     }
     client = avahi_host_name_resolver_get_client (r);
-    ar = avahi_address_resolver_new_a (client, AVAHI_IF_UNSPEC, a, avahi_address_resolver_callback, "omghai6u");
+    ar = avahi_address_resolver_new_a (client, interface, protocol, a, avahi_address_resolver_callback, "omghai6u");
     if (ar)
     {
         printf ("Succesfully created address resolver object\n");
     } else {
         printf ("Failed to create AddressResolver\n");
     }
-    avahi_address_snprint (&addr, sizeof (addr), a);
+    avahi_address_snprint (addr, sizeof (addr), a);
     printf ("Callback on HostNameResolver, interface (%d), protocol (%d), event (%d), name (%s), address (%s), data (%s)\n", interface, protocol, event, name, addr, (char*)user_data);
 }
 static void test_free_domain_browser(AvahiTimeout *timeout, void* userdata)
index c544c441227bd6d4abed25ba044a08f7a345eb74..9d57c502d0280feee2f7c202d56960afb137732b 100644 (file)
@@ -311,7 +311,7 @@ int avahi_host_name_resolver_free(AvahiHostNameResolver *r);
 /** Block until the resolving is complete */
 int avahi_host_name_resolver_block(AvahiHostNameResolver *r);
 
-/** Create a new address resolver object from an address string.  Set protocol to AF_UNSPEC for protocol detection. */
+/** Create a new address resolver object from an address string.  Set aprotocol to AF_UNSPEC for protocol detection. */
 AvahiAddressResolver * avahi_address_resolver_new(
     AvahiClient *client,
     AvahiIfIndex interface,
@@ -324,6 +324,7 @@ AvahiAddressResolver * avahi_address_resolver_new(
 AvahiAddressResolver* avahi_address_resolver_new_a(
     AvahiClient *client,
     AvahiIfIndex interface,
+    AvahiProtocol protocol,
     const AvahiAddress *a,
     AvahiAddressResolverCallback callback,
     void *userdata);
index aaff5023ff12ff3b039a0b17b976d284bfbe95fa..c564a97005baf707ac2730560c42dda4bd945274 100644 (file)
@@ -517,6 +517,7 @@ int avahi_host_name_resolver_block(AvahiHostNameResolver *r) {
 AvahiAddressResolver * avahi_address_resolver_new_a(
     AvahiClient *client,
     AvahiIfIndex interface,
+    AvahiProtocol protocol,
     const AvahiAddress *a,
     AvahiAddressResolverCallback callback,
     void *userdata) {
@@ -525,11 +526,15 @@ AvahiAddressResolver * avahi_address_resolver_new_a(
 
     assert (a);
 
-    avahi_address_snprint (addr, sizeof (addr), a);
+    if (!avahi_address_snprint (addr, sizeof (addr), a)) {
+        avahi_client_set_errno(client, AVAHI_ERR_INVALID_ADDRESS);
+        return NULL;
+    }
 
-    return avahi_address_resolver_new (client, interface,
-            a->family, addr,
-            callback, userdata);
+    return avahi_address_resolver_new (
+        client, interface, protocol,
+        addr,
+        callback, userdata);
 }
 
 AvahiAddressResolver * avahi_address_resolver_new(