|
|
|
@ -1,11 +1,7 @@
|
|
|
|
|
Index: configure.in
|
|
|
|
|
===================================================================
|
|
|
|
|
RCS file: /cvs/gnome/gnome-vfs/configure.in,v
|
|
|
|
|
retrieving revision 1.391
|
|
|
|
|
diff -u -p -r1.391 configure.in
|
|
|
|
|
--- configure.in 5 Oct 2005 08:49:28 -0000 1.391
|
|
|
|
|
+++ configure.in 25 Oct 2005 14:04:25 -0000
|
|
|
|
|
@@ -651,12 +651,26 @@ if test "x$enable_gnutls" = "xyes"; then
|
|
|
|
|
diff -ur gnome-vfs-2.12.1.1.avahi/configure.in gnome-vfs-2.12.1.1/configure.in
|
|
|
|
|
--- gnome-vfs-2.12.1.1.avahi/configure.in 2005-10-05 10:52:41.000000000 +0200
|
|
|
|
|
+++ gnome-vfs-2.12.1.1/configure.in 2005-11-22 12:02:42.000000000 +0100
|
|
|
|
|
@@ -651,12 +651,26 @@
|
|
|
|
|
fi
|
|
|
|
|
fi
|
|
|
|
|
dnl ****************************
|
|
|
|
@ -19,7 +15,7 @@ diff -u -p -r1.391 configure.in
|
|
|
|
|
+AC_ARG_ENABLE(avahi, [ --disable-avahi build without avahi support])
|
|
|
|
|
+msg_avahi=no
|
|
|
|
|
+if test "x$enable_avahi" != "xno"; then
|
|
|
|
|
+ PKG_CHECK_MODULES(AVAHI, avahi-glib avahi-client,
|
|
|
|
|
+ PKG_CHECK_MODULES(AVAHI, avahi-glib >= 0.6 avahi-client >= 0.6,
|
|
|
|
|
+ [AM_CONDITIONAL(HAVE_AVAHI, true)
|
|
|
|
|
+ AC_DEFINE(HAVE_AVAHI, [], [Set if we can use avahi])]
|
|
|
|
|
+ msg_avahi=yes,
|
|
|
|
@ -35,7 +31,7 @@ diff -u -p -r1.391 configure.in
|
|
|
|
|
PKG_CHECK_MODULES(HOWL, howl >= 0.9.6,
|
|
|
|
|
[AM_CONDITIONAL(HAVE_HOWL, true)
|
|
|
|
|
AC_DEFINE(HAVE_HOWL, [], [Set if we can use howl])]
|
|
|
|
|
@@ -969,8 +983,8 @@ dnl End of IPv6 checks
|
|
|
|
|
@@ -969,8 +983,8 @@
|
|
|
|
|
dnl ==============================================================================
|
|
|
|
|
|
|
|
|
|
PKG_CHECK_MODULES(LIBGNOMEVFS, glib-2.0 >= $GLIB_REQUIRED gmodule-no-export-2.0 >= $GLIB_REQUIRED gthread-2.0 >= $GLIB_REQUIRED gobject-2.0 >= $GLIB_REQUIRED gconf-2.0 >= $GCONF_REQUIRED bonobo-activation-2.0 >= $BONOBO_ACTIVATION_REQUIRED libbonobo-2.0 >= $BONOBO_REQUIRED ORBit-2.0 >= $ORBIT_REQUIRED libxml-2.0 >= $XML_REQUIRED gnome-mime-data-2.0)
|
|
|
|
@ -46,7 +42,7 @@ diff -u -p -r1.391 configure.in
|
|
|
|
|
AC_SUBST(LIBGNOMEVFS_CFLAGS)
|
|
|
|
|
AC_SUBST(LIBGNOMEVFS_LIBS)
|
|
|
|
|
|
|
|
|
|
@@ -1136,6 +1150,7 @@ echo
|
|
|
|
|
@@ -1136,6 +1150,7 @@
|
|
|
|
|
echo "Gnome VFS configuration summary:"
|
|
|
|
|
echo "
|
|
|
|
|
IPv6 support: $have_ipv6
|
|
|
|
@ -54,28 +50,28 @@ diff -u -p -r1.391 configure.in
|
|
|
|
|
Howl support: $msg_howl
|
|
|
|
|
HAL support: $msg_hal
|
|
|
|
|
Gtk Doc: $enable_gtk_doc
|
|
|
|
|
Index: libgnomevfs/gnome-vfs-dns-sd.c
|
|
|
|
|
===================================================================
|
|
|
|
|
RCS file: /cvs/gnome/gnome-vfs/libgnomevfs/gnome-vfs-dns-sd.c,v
|
|
|
|
|
retrieving revision 1.12
|
|
|
|
|
diff -u -p -r1.12 gnome-vfs-dns-sd.c
|
|
|
|
|
--- libgnomevfs/gnome-vfs-dns-sd.c 14 Jul 2005 07:47:53 -0000 1.12
|
|
|
|
|
+++ libgnomevfs/gnome-vfs-dns-sd.c 25 Oct 2005 14:04:25 -0000
|
|
|
|
|
@@ -36,6 +36,13 @@
|
|
|
|
|
Only in gnome-vfs-2.12.1.1: configure.in.orig
|
|
|
|
|
Only in gnome-vfs-2.12.1.1: configure.in.rej
|
|
|
|
|
diff -ur gnome-vfs-2.12.1.1.avahi/libgnomevfs/gnome-vfs-dns-sd.c gnome-vfs-2.12.1.1/libgnomevfs/gnome-vfs-dns-sd.c
|
|
|
|
|
--- gnome-vfs-2.12.1.1.avahi/libgnomevfs/gnome-vfs-dns-sd.c 2005-07-14 09:47:53.000000000 +0200
|
|
|
|
|
+++ gnome-vfs-2.12.1.1/libgnomevfs/gnome-vfs-dns-sd.c 2005-11-22 12:08:19.000000000 +0100
|
|
|
|
|
@@ -36,6 +36,15 @@
|
|
|
|
|
#include <gconf/gconf-client.h>
|
|
|
|
|
#include <unistd.h>
|
|
|
|
|
|
|
|
|
|
+#ifdef HAVE_AVAHI
|
|
|
|
|
+#include <avahi-client/client.h>
|
|
|
|
|
+#include <avahi-client/lookup.h>
|
|
|
|
|
+#include <avahi-common/error.h>
|
|
|
|
|
+#include <avahi-common/simple-watch.h>
|
|
|
|
|
+#include <avahi-common/timeval.h>
|
|
|
|
|
+#include <avahi-glib/glib-watch.h>
|
|
|
|
|
+#endif
|
|
|
|
|
+
|
|
|
|
|
#ifdef HAVE_HOWL
|
|
|
|
|
/* Need to work around howl exporting its config file... */
|
|
|
|
|
#undef PACKAGE
|
|
|
|
|
@@ -722,6 +729,58 @@ unicast_resolve_sync (const char *name,
|
|
|
|
|
@@ -722,6 +731,60 @@
|
|
|
|
|
|
|
|
|
|
/* multicast DNS functions */
|
|
|
|
|
|
|
|
|
@ -83,25 +79,38 @@ diff -u -p -r1.12 gnome-vfs-dns-sd.c
|
|
|
|
|
+static AvahiClient *global_client = NULL;
|
|
|
|
|
+static gboolean avahi_initialized = FALSE;
|
|
|
|
|
+
|
|
|
|
|
+static AvahiClient *get_global_avahi_client (void);
|
|
|
|
|
+
|
|
|
|
|
+/* Callback for state changes on the Client */
|
|
|
|
|
+static void
|
|
|
|
|
+avahi_client_callback (AvahiClient *client, AvahiClientState state, void *userdata)
|
|
|
|
|
+{
|
|
|
|
|
+ if (state == AVAHI_CLIENT_DISCONNECTED) {
|
|
|
|
|
+ if (state == AVAHI_CLIENT_FAILURE) {
|
|
|
|
|
+ if (avahi_client_errno (client) == AVAHI_ERR_DISCONNECTED) {
|
|
|
|
|
+ /* Destroy old client */
|
|
|
|
|
+ avahi_client_free (client);
|
|
|
|
|
+ global_client = NULL;
|
|
|
|
|
+ avahi_initialized = FALSE;
|
|
|
|
|
+
|
|
|
|
|
+ /* Reconnect */
|
|
|
|
|
+ get_global_avahi_client ();
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+static AvahiClient *
|
|
|
|
|
+get_global_avahi_client (void) {
|
|
|
|
|
+ AvahiGLibPoll *glib_poll;
|
|
|
|
|
+ const char *version;
|
|
|
|
|
+ static AvahiGLibPoll *glib_poll = NULL;
|
|
|
|
|
+ int error;
|
|
|
|
|
+
|
|
|
|
|
+ if (!avahi_initialized) {
|
|
|
|
|
+ glib_poll = avahi_glib_poll_new (NULL, G_PRIORITY_DEFAULT);
|
|
|
|
|
+ if (glib_poll == NULL) {
|
|
|
|
|
+ glib_poll = avahi_glib_poll_new (NULL, G_PRIORITY_DEFAULT);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /* Create a new AvahiClient instance */
|
|
|
|
|
+ global_client = avahi_client_new (avahi_glib_poll_get (glib_poll),
|
|
|
|
|
+ AVAHI_CLIENT_NO_FAIL,
|
|
|
|
|
+ avahi_client_callback,
|
|
|
|
|
+ NULL,
|
|
|
|
|
+ &error);
|
|
|
|
@ -110,17 +119,7 @@ diff -u -p -r1.12 gnome-vfs-dns-sd.c
|
|
|
|
|
+ /* Print out the error string */
|
|
|
|
|
+ g_warning ("Error initializing Avahi: %s", avahi_strerror (error));
|
|
|
|
|
+ avahi_glib_poll_free (glib_poll);
|
|
|
|
|
+ return NULL;
|
|
|
|
|
+ }
|
|
|
|
|
+ /* Make a call to get the version string from the daemon */
|
|
|
|
|
+ version = avahi_client_get_version_string (global_client);
|
|
|
|
|
+
|
|
|
|
|
+ /* Check if the call suceeded */
|
|
|
|
|
+ if (version == NULL) {
|
|
|
|
|
+ g_warning ("Error getting version string: %s", avahi_strerror (avahi_client_errno (global_client)));
|
|
|
|
|
+ avahi_client_free (global_client);
|
|
|
|
|
+ avahi_glib_poll_free (glib_poll);
|
|
|
|
|
+ global_client = NULL;
|
|
|
|
|
+ glib_poll = NULL;
|
|
|
|
|
+ return NULL;
|
|
|
|
|
+ }
|
|
|
|
|
+ avahi_initialized = TRUE;
|
|
|
|
@ -129,12 +128,11 @@ diff -u -p -r1.12 gnome-vfs-dns-sd.c
|
|
|
|
|
+ return global_client;
|
|
|
|
|
+}
|
|
|
|
|
+#endif
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
#ifdef HAVE_HOWL
|
|
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
|
@@ -788,6 +847,10 @@ struct GnomeVFSDNSSDBrowseHandle {
|
|
|
|
|
@@ -788,6 +851,10 @@
|
|
|
|
|
|
|
|
|
|
/* multicast: */
|
|
|
|
|
|
|
|
|
@ -145,7 +143,7 @@ diff -u -p -r1.12 gnome-vfs-dns-sd.c
|
|
|
|
|
#ifdef HAVE_HOWL
|
|
|
|
|
sw_discovery_oid howl_id;
|
|
|
|
|
#endif
|
|
|
|
|
@@ -864,6 +927,34 @@ unicast_browse_thread (gpointer data)
|
|
|
|
|
@@ -864,6 +931,41 @@
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -158,6 +156,7 @@ diff -u -p -r1.12 gnome-vfs-dns-sd.c
|
|
|
|
|
+ const char *name,
|
|
|
|
|
+ const char *type,
|
|
|
|
|
+ const char *domain,
|
|
|
|
|
+ AvahiLookupResultFlags flags,
|
|
|
|
|
+ void *userdata)
|
|
|
|
|
+{
|
|
|
|
|
+ GnomeVFSDNSSDBrowseHandle *handle;
|
|
|
|
@ -168,6 +167,12 @@ diff -u -p -r1.12 gnome-vfs-dns-sd.c
|
|
|
|
|
+ service.type = (char *)type;
|
|
|
|
|
+ service.domain = (char *)domain;
|
|
|
|
|
+
|
|
|
|
|
+ if (event == AVAHI_BROWSER_FAILURE ||
|
|
|
|
|
+ event == AVAHI_BROWSER_ALL_FOR_NOW ||
|
|
|
|
|
+ event == AVAHI_BROWSER_CACHE_EXHAUSTED) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (!handle->cancelled) {
|
|
|
|
|
+ handle->callback (handle,
|
|
|
|
|
+ (event == AVAHI_BROWSER_NEW) ? GNOME_VFS_DNS_SD_SERVICE_ADDED : GNOME_VFS_DNS_SD_SERVICE_REMOVED,
|
|
|
|
@ -180,7 +185,7 @@ diff -u -p -r1.12 gnome-vfs-dns-sd.c
|
|
|
|
|
#ifdef HAVE_HOWL
|
|
|
|
|
|
|
|
|
|
struct howl_browse_idle_data {
|
|
|
|
|
@@ -1012,7 +1103,23 @@ gnome_vfs_dns_sd_browse (GnomeVFSDNSSDBr
|
|
|
|
|
@@ -1012,7 +1114,25 @@
|
|
|
|
|
handle->callback_data_destroy_func = callback_data_destroy_func;
|
|
|
|
|
|
|
|
|
|
if (strcmp (domain, "local") == 0) {
|
|
|
|
@ -192,7 +197,9 @@ diff -u -p -r1.12 gnome-vfs-dns-sd.c
|
|
|
|
|
+ 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,
|
|
|
|
|
+ AVAHI_LOOKUP_USE_MULTICAST,
|
|
|
|
|
+ avahi_browse_callback, handle);
|
|
|
|
|
+ if (sb != NULL) {
|
|
|
|
|
+ handle->avahi_sb = sb;
|
|
|
|
|
+ *handle_out = handle;
|
|
|
|
@ -205,7 +212,7 @@ diff -u -p -r1.12 gnome-vfs-dns-sd.c
|
|
|
|
|
sw_result res;
|
|
|
|
|
sw_discovery session;
|
|
|
|
|
|
|
|
|
|
@@ -1063,6 +1170,11 @@ GnomeVFSResult
|
|
|
|
|
@@ -1063,6 +1183,11 @@
|
|
|
|
|
gnome_vfs_dns_sd_stop_browse (GnomeVFSDNSSDBrowseHandle *handle)
|
|
|
|
|
{
|
|
|
|
|
if (handle->is_local) {
|
|
|
|
@ -217,7 +224,7 @@ diff -u -p -r1.12 gnome-vfs-dns-sd.c
|
|
|
|
|
#ifdef HAVE_HOWL
|
|
|
|
|
handle->cancelled = TRUE;
|
|
|
|
|
sw_discovery_cancel (get_global_howl_session (), handle->howl_id);
|
|
|
|
|
@@ -1093,6 +1205,10 @@ struct GnomeVFSDNSSDResolveHandle {
|
|
|
|
|
@@ -1093,6 +1218,10 @@
|
|
|
|
|
int text_len;
|
|
|
|
|
|
|
|
|
|
/* multicast: */
|
|
|
|
@ -228,7 +235,7 @@ diff -u -p -r1.12 gnome-vfs-dns-sd.c
|
|
|
|
|
#ifdef HAVE_HOWL
|
|
|
|
|
sw_discovery_oid howl_id;
|
|
|
|
|
guint timeout_tag;
|
|
|
|
|
@@ -1174,6 +1290,70 @@ unicast_resolve_thread (gpointer data)
|
|
|
|
|
@@ -1174,6 +1303,71 @@
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -245,6 +252,7 @@ diff -u -p -r1.12 gnome-vfs-dns-sd.c
|
|
|
|
|
+ const AvahiAddress *address,
|
|
|
|
|
+ uint16_t port,
|
|
|
|
|
+ AvahiStringList *txt,
|
|
|
|
|
+ AvahiLookupResultFlags flags,
|
|
|
|
|
+ void *user_data)
|
|
|
|
|
+{
|
|
|
|
|
+ GnomeVFSDNSSDResolveHandle *handle;
|
|
|
|
@ -281,7 +289,7 @@ diff -u -p -r1.12 gnome-vfs-dns-sd.c
|
|
|
|
|
+ }
|
|
|
|
|
+ g_free (text);
|
|
|
|
|
+
|
|
|
|
|
+ } else if (event == AVAHI_RESOLVER_TIMEOUT) {
|
|
|
|
|
+ } else if (event == AVAHI_RESOLVER_FAILURE) {
|
|
|
|
|
+ handle->callback (handle,
|
|
|
|
|
+ GNOME_VFS_ERROR_HOST_NOT_FOUND,
|
|
|
|
|
+ NULL,
|
|
|
|
@ -299,7 +307,7 @@ diff -u -p -r1.12 gnome-vfs-dns-sd.c
|
|
|
|
|
|
|
|
|
|
#ifdef HAVE_HOWL
|
|
|
|
|
static gboolean
|
|
|
|
|
@@ -1329,7 +1509,24 @@ gnome_vfs_dns_sd_resolve (GnomeVFSDNSSDR
|
|
|
|
|
@@ -1329,7 +1523,25 @@
|
|
|
|
|
handle->callback_data_destroy_func = callback_data_destroy_func;
|
|
|
|
|
|
|
|
|
|
if (strcmp (domain, "local") == 0) {
|
|
|
|
@ -313,6 +321,7 @@ diff -u -p -r1.12 gnome-vfs-dns-sd.c
|
|
|
|
|
+ if (client) {
|
|
|
|
|
+ sr = avahi_service_resolver_new (client, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC,
|
|
|
|
|
+ name, type, domain, AVAHI_PROTO_UNSPEC,
|
|
|
|
|
+ AVAHI_LOOKUP_USE_MULTICAST,
|
|
|
|
|
+ avahi_resolve_async_callback, handle);
|
|
|
|
|
+ if (sr != NULL) {
|
|
|
|
|
+ handle->avahi_sr = sr;
|
|
|
|
@ -325,7 +334,7 @@ diff -u -p -r1.12 gnome-vfs-dns-sd.c
|
|
|
|
|
sw_result res;
|
|
|
|
|
sw_discovery session;
|
|
|
|
|
|
|
|
|
|
@@ -1386,6 +1583,10 @@ GnomeVFSResult
|
|
|
|
|
@@ -1386,6 +1598,10 @@
|
|
|
|
|
gnome_vfs_dns_sd_cancel_resolve (GnomeVFSDNSSDResolveHandle *handle)
|
|
|
|
|
{
|
|
|
|
|
if (handle->is_local) {
|
|
|
|
@ -336,7 +345,7 @@ diff -u -p -r1.12 gnome-vfs-dns-sd.c
|
|
|
|
|
#ifdef HAVE_HOWL
|
|
|
|
|
g_source_remove (handle->timeout_tag);
|
|
|
|
|
if (handle->idle_tag) {
|
|
|
|
|
@@ -1408,8 +1609,7 @@ gnome_vfs_dns_sd_cancel_resolve (GnomeVF
|
|
|
|
|
@@ -1408,8 +1624,7 @@
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -346,7 +355,7 @@ diff -u -p -r1.12 gnome-vfs-dns-sd.c
|
|
|
|
|
static int
|
|
|
|
|
find_existing_service (GArray *array,
|
|
|
|
|
const char *name,
|
|
|
|
|
@@ -1430,6 +1630,87 @@ find_existing_service (GArray *array,
|
|
|
|
|
@@ -1430,6 +1645,89 @@
|
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
@ -365,7 +374,7 @@ diff -u -p -r1.12 gnome-vfs-dns-sd.c
|
|
|
|
|
+ struct sync_browse_data *data;
|
|
|
|
|
+
|
|
|
|
|
+ data = user_data;
|
|
|
|
|
+ if (state == AVAHI_CLIENT_DISCONNECTED) {
|
|
|
|
|
+ if (state == AVAHI_CLIENT_FAILURE) {
|
|
|
|
|
+ avahi_simple_poll_quit (data->poll);
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
@ -378,6 +387,7 @@ diff -u -p -r1.12 gnome-vfs-dns-sd.c
|
|
|
|
|
+ const char *name,
|
|
|
|
|
+ const char *type,
|
|
|
|
|
+ const char *domain,
|
|
|
|
|
+ AvahiLookupResultFlags flags,
|
|
|
|
|
+ void *user_data)
|
|
|
|
|
+{
|
|
|
|
|
+ struct sync_browse_data *data;
|
|
|
|
@ -408,10 +418,11 @@ diff -u -p -r1.12 gnome-vfs-dns-sd.c
|
|
|
|
|
+ g_free (existing->domain);
|
|
|
|
|
+ g_array_remove_index (data->array, i);
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ g_warning ("Unknown browse status\n");
|
|
|
|
|
+ } else if (event == AVAHI_BROWSER_ALL_FOR_NOW) {
|
|
|
|
|
+ avahi_simple_poll_quit (data->poll);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ if (free_service) {
|
|
|
|
|
+ g_free (service.name);
|
|
|
|
|
+ g_free (service.type);
|
|
|
|
@ -434,7 +445,7 @@ diff -u -p -r1.12 gnome-vfs-dns-sd.c
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static sw_result
|
|
|
|
|
@@ -1530,7 +1811,65 @@ gnome_vfs_dns_sd_browse_sync (const char
|
|
|
|
|
@@ -1530,7 +1828,66 @@
|
|
|
|
|
*services = NULL;
|
|
|
|
|
|
|
|
|
|
if (strcmp (domain, "local") == 0) {
|
|
|
|
@ -457,7 +468,7 @@ diff -u -p -r1.12 gnome-vfs-dns-sd.c
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ poll = avahi_simple_poll_get (simple_poll);
|
|
|
|
|
+ client = avahi_client_new (poll,
|
|
|
|
|
+ client = avahi_client_new (poll, 0,
|
|
|
|
|
+ avahi_browse_sync_client_callback, &data, &error);
|
|
|
|
|
+
|
|
|
|
|
+ /* Check wether creating the client object succeeded */
|
|
|
|
@ -470,7 +481,8 @@ diff -u -p -r1.12 gnome-vfs-dns-sd.c
|
|
|
|
|
+
|
|
|
|
|
+ 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,
|
|
|
|
|
+ AVAHI_LOOKUP_USE_MULTICAST, 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);
|
|
|
|
@ -501,7 +513,7 @@ diff -u -p -r1.12 gnome-vfs-dns-sd.c
|
|
|
|
|
sw_discovery session;
|
|
|
|
|
sw_salt salt;
|
|
|
|
|
sw_result res;
|
|
|
|
|
@@ -1599,6 +1938,62 @@ gnome_vfs_dns_sd_browse_sync (const char
|
|
|
|
|
@@ -1599,6 +1956,63 @@
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -522,7 +534,7 @@ diff -u -p -r1.12 gnome-vfs-dns-sd.c
|
|
|
|
|
+ struct sync_resolve_data *data;
|
|
|
|
|
+
|
|
|
|
|
+ data = user_data;
|
|
|
|
|
+ if (state == AVAHI_CLIENT_DISCONNECTED) {
|
|
|
|
|
+ if (state == AVAHI_CLIENT_FAILURE) {
|
|
|
|
|
+ avahi_simple_poll_quit (data->poll);
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
@ -539,6 +551,7 @@ diff -u -p -r1.12 gnome-vfs-dns-sd.c
|
|
|
|
|
+ const AvahiAddress *address,
|
|
|
|
|
+ uint16_t port,
|
|
|
|
|
+ AvahiStringList *txt,
|
|
|
|
|
+ AvahiLookupResultFlags flags,
|
|
|
|
|
+ void *user_data)
|
|
|
|
|
+{
|
|
|
|
|
+ struct sync_resolve_data *data;
|
|
|
|
@ -564,7 +577,7 @@ diff -u -p -r1.12 gnome-vfs-dns-sd.c
|
|
|
|
|
#ifdef HAVE_HOWL
|
|
|
|
|
struct sync_resolve_data {
|
|
|
|
|
gboolean got_data;
|
|
|
|
|
@@ -1672,7 +2067,64 @@ gnome_vfs_dns_sd_resolve_sync (const cha
|
|
|
|
|
@@ -1672,7 +2086,65 @@
|
|
|
|
|
GnomeVFSResult res;
|
|
|
|
|
|
|
|
|
|
if (strcmp (domain, "local") == 0) {
|
|
|
|
@ -583,7 +596,7 @@ diff -u -p -r1.12 gnome-vfs-dns-sd.c
|
|
|
|
|
+ return GNOME_VFS_ERROR_GENERIC;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ client = avahi_client_new (avahi_simple_poll_get (simple_poll),
|
|
|
|
|
+ client = avahi_client_new (avahi_simple_poll_get (simple_poll), 0,
|
|
|
|
|
+ avahi_resolve_sync_client_callback, &resolve_data, &error);
|
|
|
|
|
+
|
|
|
|
|
+ /* Check wether creating the client object succeeded */
|
|
|
|
@ -595,6 +608,7 @@ diff -u -p -r1.12 gnome-vfs-dns-sd.c
|
|
|
|
|
+
|
|
|
|
|
+ sr = avahi_service_resolver_new (client, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC,
|
|
|
|
|
+ name, type, domain, AVAHI_PROTO_UNSPEC,
|
|
|
|
|
+ AVAHI_LOOKUP_USE_MULTICAST,
|
|
|
|
|
+ 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)));
|
|
|
|
@ -630,20 +644,18 @@ diff -u -p -r1.12 gnome-vfs-dns-sd.c
|
|
|
|
|
sw_discovery session;
|
|
|
|
|
sw_salt salt;
|
|
|
|
|
sw_result res;
|
|
|
|
|
Index: modules/dns-sd-method.c
|
|
|
|
|
===================================================================
|
|
|
|
|
RCS file: /cvs/gnome/gnome-vfs/modules/dns-sd-method.c,v
|
|
|
|
|
retrieving revision 1.5
|
|
|
|
|
diff -u -p -r1.5 dns-sd-method.c
|
|
|
|
|
--- modules/dns-sd-method.c 8 May 2005 13:04:05 -0000 1.5
|
|
|
|
|
+++ modules/dns-sd-method.c 25 Oct 2005 14:04:26 -0000
|
|
|
|
|
@@ -29,6 +29,13 @@
|
|
|
|
|
diff -ur gnome-vfs-2.12.1.1.avahi/modules/dns-sd-method.c gnome-vfs-2.12.1.1/modules/dns-sd-method.c
|
|
|
|
|
--- gnome-vfs-2.12.1.1.avahi/modules/dns-sd-method.c 2005-05-08 15:04:05.000000000 +0200
|
|
|
|
|
+++ gnome-vfs-2.12.1.1/modules/dns-sd-method.c 2005-11-22 12:09:19.000000000 +0100
|
|
|
|
|
@@ -29,6 +29,15 @@
|
|
|
|
|
#include <time.h>
|
|
|
|
|
#include <sys/time.h>
|
|
|
|
|
|
|
|
|
|
+#ifdef HAVE_AVAHI
|
|
|
|
|
+#include <avahi-client/client.h>
|
|
|
|
|
+#include <avahi-client/lookup.h>
|
|
|
|
|
+#include <avahi-common/error.h>
|
|
|
|
|
+#include <avahi-common/timeval.h>
|
|
|
|
|
+#include <avahi-common/simple-watch.h>
|
|
|
|
|
+#include <avahi-glib/glib-watch.h>
|
|
|
|
|
+#endif
|
|
|
|
@ -651,7 +663,11 @@ diff -u -p -r1.5 dns-sd-method.c
|
|
|
|
|
#ifdef HAVE_HOWL
|
|
|
|
|
/* Need to work around howl exporting its config file... */
|
|
|
|
|
#undef PACKAGE
|
|
|
|
|
@@ -61,12 +68,12 @@ static struct {
|
|
|
|
|
@@ -58,15 +67,16 @@
|
|
|
|
|
} dns_sd_types[] = {
|
|
|
|
|
{"_ftp._tcp", "ftp", "gnome-fs-ftp"},
|
|
|
|
|
{"_webdav._tcp", "dav", "gnome-fs-share"},
|
|
|
|
|
+ {"_webdavs._tcp", "davs", "gnome-fs-share"},
|
|
|
|
|
{"_sftp-ssh._tcp", "sftp", "gnome-fs-ssh"},
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
@ -666,7 +682,7 @@ diff -u -p -r1.5 dns-sd-method.c
|
|
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
|
char *data;
|
|
|
|
|
@@ -216,8 +223,7 @@ encode_filename (const char *service,
|
|
|
|
|
@@ -216,8 +226,7 @@
|
|
|
|
|
return g_string_free (string, FALSE);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -676,7 +692,7 @@ diff -u -p -r1.5 dns-sd-method.c
|
|
|
|
|
static void
|
|
|
|
|
call_monitors (gboolean add, char *filename)
|
|
|
|
|
{
|
|
|
|
|
@@ -240,7 +246,6 @@ call_monitors (gboolean add, char *filen
|
|
|
|
|
@@ -240,7 +249,6 @@
|
|
|
|
|
gnome_vfs_uri_unref (info_uri);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -684,7 +700,7 @@ diff -u -p -r1.5 dns-sd-method.c
|
|
|
|
|
static void
|
|
|
|
|
local_browse (gboolean add,
|
|
|
|
|
const char *name,
|
|
|
|
|
@@ -291,6 +296,137 @@ local_browse (gboolean add,
|
|
|
|
|
@@ -291,6 +299,144 @@
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -711,7 +727,7 @@ diff -u -p -r1.5 dns-sd-method.c
|
|
|
|
|
+ AvahiSimplePoll *poll;
|
|
|
|
|
+
|
|
|
|
|
+ poll = user_data;
|
|
|
|
|
+ if (state == AVAHI_CLIENT_DISCONNECTED) {
|
|
|
|
|
+ if (state == AVAHI_CLIENT_FAILURE) {
|
|
|
|
|
+ avahi_simple_poll_quit (poll);
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
@ -724,12 +740,18 @@ diff -u -p -r1.5 dns-sd-method.c
|
|
|
|
|
+ const char *name,
|
|
|
|
|
+ const char *type,
|
|
|
|
|
+ const char *domain,
|
|
|
|
|
+ AvahiLookupResultFlags flags,
|
|
|
|
|
+ void *user_data)
|
|
|
|
|
+{
|
|
|
|
|
+ AvahiSimplePoll *poll = user_data;
|
|
|
|
|
+
|
|
|
|
|
+ if (event == AVAHI_BROWSER_NEW)
|
|
|
|
|
+ local_browse (TRUE, name, type, domain);
|
|
|
|
|
+ else if (event == AVAHI_BROWSER_REMOVE)
|
|
|
|
|
+ local_browse (FALSE, name, type, domain);
|
|
|
|
|
+ else if (event == AVAHI_BROWSER_ALL_FOR_NOW)
|
|
|
|
|
+ avahi_simple_poll_quit (poll);
|
|
|
|
|
+
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+static void
|
|
|
|
@ -776,7 +798,7 @@ diff -u -p -r1.5 dns-sd-method.c
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ poll = avahi_simple_poll_get (simple_poll);
|
|
|
|
|
+ client = avahi_client_new (poll,
|
|
|
|
|
+ client = avahi_client_new (poll, 0,
|
|
|
|
|
+ avahi_client_callback, simple_poll, &error);
|
|
|
|
|
+
|
|
|
|
|
+ /* Check wether creating the client object succeeded */
|
|
|
|
@ -791,7 +813,8 @@ diff -u -p -r1.5 dns-sd-method.c
|
|
|
|
|
+ for (i = 0; i < G_N_ELEMENTS (dns_sd_types); i++) {
|
|
|
|
|
+ sb[i] = avahi_service_browser_new (client, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC,
|
|
|
|
|
+ dns_sd_types[i].type, "local",
|
|
|
|
|
+ local_browse_callback_sync, NULL);
|
|
|
|
|
+ AVAHI_LOOKUP_USE_MULTICAST,
|
|
|
|
|
+ local_browse_callback_sync, simple_poll);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
@ -822,7 +845,7 @@ diff -u -p -r1.5 dns-sd-method.c
|
|
|
|
|
static sw_result
|
|
|
|
|
local_browse_callback_sync (sw_discovery discovery,
|
|
|
|
|
sw_discovery_oid id,
|
|
|
|
|
@@ -309,19 +445,6 @@ local_browse_callback_sync (sw_discovery
|
|
|
|
|
@@ -309,19 +455,6 @@
|
|
|
|
|
return SW_OKAY;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -842,7 +865,7 @@ diff -u -p -r1.5 dns-sd-method.c
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
init_local (void)
|
|
|
|
|
@@ -694,7 +817,7 @@ directory_handle_add_filename (Directory
|
|
|
|
|
@@ -694,7 +827,7 @@
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -851,7 +874,7 @@ diff -u -p -r1.5 dns-sd-method.c
|
|
|
|
|
static void
|
|
|
|
|
directory_handle_add_filenames (DirectoryHandle *dir_handle, GList *files)
|
|
|
|
|
{
|
|
|
|
|
@@ -703,7 +826,7 @@ directory_handle_add_filenames (Director
|
|
|
|
|
@@ -703,7 +836,7 @@
|
|
|
|
|
files = files->next;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -860,7 +883,7 @@ diff -u -p -r1.5 dns-sd-method.c
|
|
|
|
|
|
|
|
|
|
static GnomeVFSResult
|
|
|
|
|
do_open_directory (GnomeVFSMethod *method,
|
|
|
|
|
@@ -733,14 +856,14 @@ do_open_directory (GnomeVFSMethod *metho
|
|
|
|
|
@@ -733,14 +866,14 @@
|
|
|
|
|
dir_handle = directory_handle_new (options);
|
|
|
|
|
|
|
|
|
|
if (strcmp (domain, "local") == 0) {
|
|
|
|
@ -877,7 +900,7 @@ diff -u -p -r1.5 dns-sd-method.c
|
|
|
|
|
} else {
|
|
|
|
|
for (i=0; i < G_N_ELEMENTS (dns_sd_types); i++) {
|
|
|
|
|
int n_services;
|
|
|
|
|
@@ -1007,7 +1130,7 @@ do_monitor_add (GnomeVFSMethod *method,
|
|
|
|
|
@@ -1007,7 +1140,7 @@
|
|
|
|
|
return GNOME_VFS_ERROR_NOT_SUPPORTED;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -886,7 +909,7 @@ diff -u -p -r1.5 dns-sd-method.c
|
|
|
|
|
if (strcmp (uri->text, "") == 0 ||
|
|
|
|
|
strcmp (uri->text, "/") == 0) {
|
|
|
|
|
int *handle;
|
|
|
|
|
@@ -1025,7 +1148,7 @@ do_monitor_add (GnomeVFSMethod *method,
|
|
|
|
|
@@ -1025,7 +1158,7 @@
|
|
|
|
|
|
|
|
|
|
return GNOME_VFS_OK;
|
|
|
|
|
} else
|
|
|
|
@ -895,7 +918,7 @@ diff -u -p -r1.5 dns-sd-method.c
|
|
|
|
|
return GNOME_VFS_ERROR_NOT_SUPPORTED;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -1033,7 +1156,7 @@ static GnomeVFSResult
|
|
|
|
|
@@ -1033,7 +1166,7 @@
|
|
|
|
|
do_monitor_cancel (GnomeVFSMethod *method,
|
|
|
|
|
GnomeVFSMethodHandle *method_handle)
|
|
|
|
|
{
|
|
|
|
@ -904,7 +927,7 @@ diff -u -p -r1.5 dns-sd-method.c
|
|
|
|
|
G_LOCK (local);
|
|
|
|
|
|
|
|
|
|
local_monitors = g_list_remove (local_monitors, method_handle);
|
|
|
|
|
@@ -1044,7 +1167,7 @@ do_monitor_cancel (GnomeVFSMethod *metho
|
|
|
|
|
@@ -1044,7 +1177,7 @@
|
|
|
|
|
return GNOME_VFS_OK;
|
|
|
|
|
#else
|
|
|
|
|
return GNOME_VFS_ERROR_NOT_SUPPORTED;
|
|
|
|
@ -913,14 +936,10 @@ diff -u -p -r1.5 dns-sd-method.c
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Index: modules/Makefile.am
|
|
|
|
|
===================================================================
|
|
|
|
|
RCS file: /cvs/gnome/gnome-vfs/modules/Makefile.am,v
|
|
|
|
|
retrieving revision 1.112
|
|
|
|
|
diff -u -p -r1.112 Makefile.am
|
|
|
|
|
--- modules/Makefile.am 14 Apr 2005 18:48:29 -0000 1.112
|
|
|
|
|
+++ modules/Makefile.am 25 Oct 2005 15:25:51 -0000
|
|
|
|
|
@@ -7,6 +7,7 @@ INCLUDES = \
|
|
|
|
|
diff -ur gnome-vfs-2.12.1.1.avahi/modules/Makefile.am gnome-vfs-2.12.1.1/modules/Makefile.am
|
|
|
|
|
--- gnome-vfs-2.12.1.1.avahi/modules/Makefile.am 2005-04-14 20:48:29.000000000 +0200
|
|
|
|
|
+++ gnome-vfs-2.12.1.1/modules/Makefile.am 2005-11-22 12:02:34.000000000 +0100
|
|
|
|
|
@@ -7,6 +7,7 @@
|
|
|
|
|
$(MODULES_XML_GCONF_CFLAGS) \
|
|
|
|
|
$(MODULES_FILE_CFLAGS) \
|
|
|
|
|
$(HOWL_CFLAGS) \
|
|
|
|
@ -928,7 +947,7 @@ diff -u -p -r1.112 Makefile.am
|
|
|
|
|
$(LIBEFS_CFLAGS) \
|
|
|
|
|
$(SAMBA_CFLAGS) \
|
|
|
|
|
$(GSSAPI_CFLAGS) \
|
|
|
|
|
@@ -103,7 +104,7 @@ libcomputer_la_LIBADD = $(MODULES_FILE_L
|
|
|
|
|
@@ -103,7 +104,7 @@
|
|
|
|
|
|
|
|
|
|
libdns_sd_la_SOURCES = dns-sd-method.c
|
|
|
|
|
libdns_sd_la_LDFLAGS = $(module_flags)
|
|
|
|
|