Re: HEAD compilation failure using Avahi from svn



Il giorno gio, 03/11/2005 alle 10.43 +0100, Alexander Larsson ha
scritto: 
> On Tue, 2005-11-01 at 22:49 +0100, Luca Ferretti wrote:
> > It seems there are missing #include... and maybe an API change
> 
> I don't have the svn version of avahi here, any chance you could try to
> figure out what the problem is?

API changes, simply :-)  See attachment 

Here are some details on gnome-vfs code. There is a raw diff to fix
point 1, 2, and 3.

1 ----------------

First of all AvahiServiceBrowser struct is now in
<avahi-client/lookup.h> and avahi_elapse_time is in
<avahi-common/timeval.h>

2 ----------------

The function avahi_service_browser_new() is now

        /** Browse for services of a type on the local network */
        AvahiServiceBrowser* avahi_service_browser_new (
            AvahiClient *client,
            AvahiIfIndex interface,
            AvahiProtocol protocol,
            const char *type,
            const char *domain,
            AvahiLookupFlags flags,
            AvahiServiceBrowserCallback callback,
            void *userdata);

There is a +1 argument (AvahiLookupFlags flags). This is defined in
<avahi-common/defs.h> as

        /** Some flags for lookup functions */
        typedef enum {
            AVAHI_LOOKUP_USE_WIDE_AREA = 1,    /**< Force lookup via wide area DNS */
            AVAHI_LOOKUP_USE_MULTICAST = 2,    /**< Force lookup via multicast DNS */
            AVAHI_LOOKUP_NO_TXT = 4,           /**< When doing service resolving, don't lookup TXT record */
            AVAHI_LOOKUP_NO_ADDRESS = 8        /**< When doing service resolving, don't lookup A/AAAA record */
        } AvahiLookupFlags;
        
The avahi API-CHANGES doc suggest to use 0. 

3 ----------------

Similar API change for avahi_service_resolver_new() function

        /** Create a new service resolver object */
        AvahiServiceResolver * avahi_service_resolver_new(
            AvahiClient *client,
            AvahiIfIndex interface,
            AvahiProtocol protocol,
            const char *name,
            const char *type,
            const char *domain,
            AvahiProtocol aprotocol,
            AvahiLookupFlags flags,
            AvahiServiceResolverCallback callback,
            void *userdata);
        
4 ----------------

AVAHI_RESOLVER_TIMEOUT is disappeared. See attached doc.   

5 ----------------

AvahiServiceResolverCallback is now 

        /** The function prototype for the callback of an
        AvahiServiceResolver */
        typedef void (*AvahiServiceResolverCallback) (
            AvahiServiceResolver *r,
            AvahiIfIndex interface,
            AvahiProtocol protocol,
            AvahiResolverEvent event,
            const char *name,
            const char *type,
            const char *domain,
            const char *host_name,
            const AvahiAddress *a,
            uint16_t port,
            AvahiStringList *txt,
            void *userdata);
        
and *host_name, *a, port and *txt are new arguments. You have to rewrite
callback function.
-*-text-*-


A terse list of API changes between 0.5.2 and 0.6:

 * Most browsing and registration functions and their callbacks gained
   new "flags" parameters. Passing 0 results in similar behaviour as
   in 0.5.2

 * avahi-client/client.h has been split into client.h, publish.h and lookup.h
 
 * avahi-core/core.h has been split into core.h publish.h lookup.h

 * avahi_client_is_service_local() has been removed. Use instead the special
   flags AVAHI_LOOKUP_RESULT_LOCAL and AVAHI_LOOKUP_RESULT_OUR_OWN which are
   set when resolving or browsing for services. AVAHI_LOOKUP_RESULT_OUR_OWN is
   what most people should use.

 * AVAHI_RESOLVER_TIMEOUT and AVAHI_RESOLVER_NOT_FOUND have been
   removed. Instead AVAHI_RESOLVER_FAILURE is used and the exact error
   code is available from avahi_client_errno()/avahi_server_errno()

 * The events AVAHI_BROWSER_CACHE_EXHAUSTED, AVAHI_BROWSER_ALL_FOR_NOW
   have been introduced. Failures during browsing are now passed as
   AVAHI_BROWSER_FAILURE and the error code is made available through
   avahi_client_errno()/avahi_server_errno().

 * The server gained a new state AVAHI_SERVER_FAILURE if some fatal
   error happens. The reason can be found in
   avahi_server_errno(). Clients can safely ignore this state.

 * You can now update existing records by setting the
   AVAHI_PUBLISH_UPDATE flags for add_service() and friends. Consider
   using avahi_server_update_service_txt_strlst() if you need to
   update only the TXT record for a service.

 * Proper support for service subtypes is now available. Use
   avahi_server_add_service_subtype() for that.

 * Entry groups gained the new state AVAHI_ENTRY_GROUP_FAILURE. The
   reason is available using
   avahi_server_errno()/avahi_client_errno().

 * Many superfluous functions have been removed from the public API or
   entirely.

 * avahi_simple_poll_iterate() has been split up into three
   functions. avahi_simple_poll_loop() has been introduced.

 * Some new limits have been introduced: AVAHI_ADDRESS_STR_MAX,
   AVAHI_DOMAIN_NAME_MAX, AVAHI_LABEL_MAX

 * The functions avahi_service_name_join() and
   avahi_service_name_split() have been introduced.
 
 * AVAHI_ERR_LOCAL_COLLISION has been renamed to AVAHI_ERR_COLLSION

 * The values of AVAHI_PROTO_xxx have changed, they are no longer identical to
   the BSD AF_xxx constants

$Id: API-CHANGES-0.6 870 2005-10-25 21:03:20Z lennart $
--- ../../CVS/gnome-vfs/libgnomevfs/gnome-vfs-dns-sd.c	2005-10-26 15:14:51.000000000 +0200
+++ gnome-vfs-dns-sd.c	2005-11-03 15:23:30.000000000 +0100
@@ -38,8 +38,11 @@
 
 #ifdef HAVE_AVAHI
 #include <avahi-client/client.h>
+#include <avahi-client/lookup.h>
+#include <avahi-common/defs.h>
 #include <avahi-common/error.h>
 #include <avahi-common/simple-watch.h>
+#include <avahi-common/timeval.h>
 #include <avahi-glib/glib-watch.h>
 #endif 
 
@@ -1098,7 +1101,9 @@
 		handle->is_local = TRUE;
 		client = get_global_avahi_client ();
 		if (client) {
-			sb = avahi_service_browser_new (client, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, type, NULL, avahi_browse_callback, handle);
+			sb = avahi_service_browser_new (client, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC,
+							type, NULL, 0,
+							avahi_browse_callback, handle);
 			if (sb != NULL) {
 				handle->avahi_sb = sb;
 				*handle_out = handle;
@@ -1504,8 +1509,8 @@
 		handle->is_local = TRUE;
 		client = get_global_avahi_client ();
 		if (client) {
-			sr = avahi_service_resolver_new (client, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, 
-							 name, type, domain, AVAHI_PROTO_UNSPEC, 
+			sr = avahi_service_resolver_new (client, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, name,
+							 type, domain, AVAHI_PROTO_UNSPEC, 0,
 							 avahi_resolve_async_callback, handle);
 			if (sr != NULL) {
 				handle->avahi_sr = sr;
@@ -1830,7 +1835,9 @@
 
 		array = g_array_new (FALSE, FALSE, sizeof (GnomeVFSDNSSDService));
 		data.array = array;
-		sb = avahi_service_browser_new (client, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, type, NULL, avahi_browse_sync_callback, &data);
+		sb = avahi_service_browser_new (client, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC,
+						type, NULL, 0,
+						avahi_browse_sync_callback, &data);
 		if (sb == NULL) {
 			g_warning ("Failed to create service browser: %s\n", avahi_strerror (avahi_client_errno (client)));
 			g_array_free (array, TRUE);
@@ -2079,8 +2086,8 @@
 			return GNOME_VFS_ERROR_GENERIC;
 		}
 		
-		sr = avahi_service_resolver_new (client, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, 
-						 name, type, domain, AVAHI_PROTO_UNSPEC, 
+		sr = avahi_service_resolver_new (client, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, name,
+						 type, domain, AVAHI_PROTO_UNSPEC, 0,
 						 avahi_resolve_sync_callback, &resolve_data);
 		if (sr == NULL) {
 			g_warning ("Failed to resolve service '%s': %s\n", name, avahi_strerror (avahi_client_errno (client)));


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]