]> git.meshlink.io Git - catta/commitdiff
* remove some --disable in boostrap.sh for osx
authorSebastien Estienne <sebastien.estienne@gmail.com>
Wed, 19 Oct 2005 20:31:51 +0000 (20:31 +0000)
committerSebastien Estienne <sebastien.estienne@gmail.com>
Wed, 19 Oct 2005 20:31:51 +0000 (20:31 +0000)
 * added a missing include in dus-protocol.h
 * remove getinterface in a-d-s replaced by if_indextoname
 * avahi-discover-standalone is now working on osx

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

avahi-daemon/dbus-protocol.c
avahi-discover-standalone/main.c
bootstrap.sh

index 76111562d217d6864e4ab74bd72e5aada480ac06..8994a25bd7c74f4fccd5d18281202af6c6d0a3ef 100644 (file)
@@ -25,6 +25,7 @@
 
 #include <string.h>
 #include <sys/ioctl.h>
+#include <netinet/in.h>
 #include <net/if.h>
 #include <errno.h>
 #include <unistd.h>
@@ -1809,6 +1810,7 @@ static DBusHandlerResult msg_server_impl(DBusConnection *c, DBusMessage *m, void
             }
 
         memset(&ifr, 0, sizeof(ifr));
+
         ifr.ifr_ifindex = idx;
 
         if (ioctl(fd, SIOCGIFNAME, &ifr) < 0) {
index bfc270d9e28a9a4a1b2fdf7a1c3e391cda3818e7..74dabd74b6070fd0af83cd4122036edaf9c487cc 100644 (file)
@@ -25,6 +25,7 @@
 
 #include <sys/ioctl.h>
 #include <string.h>
+#include <sys/socket.h>
 #include <net/if.h>
 #include <unistd.h>
 
@@ -72,34 +73,6 @@ static GHashTable *service_type_hash_table = NULL;
 static AvahiSServiceResolver *service_resolver = NULL;
 static struct Service *current_service = NULL;
 
-static const char* getifname(int idx) {
-    static char t[256];
-    static struct ifreq ifreq;
-    int fd = -1;
-
-    memset(&ifreq, 0, sizeof(ifreq));
-
-    if ((fd = socket(PF_INET, SOCK_DGRAM, 0)) < 0)
-        if ((fd = socket(PF_INET6, SOCK_DGRAM, 0)) < 0)
-            goto fail;
-    
-    ifreq.ifr_ifindex = idx;
-    if (ioctl(fd, SIOCGIFNAME, &ifreq) < 0)
-        goto fail;
-
-    close(fd);
-    
-    return ifreq.ifr_name;
-
-    
-fail:
-    if (fd >= 0)
-        close(fd);
-
-    snprintf(t, sizeof(t), "#%i", idx);
-    return t;
-}
-
 static struct Service *get_service(const gchar *service_type, const gchar *service_name, const gchar*domain_name, AvahiIfIndex interface, AvahiProtocol protocol) {
     struct ServiceType *st;
     GList *l;
@@ -167,6 +140,7 @@ static void service_browser_callback(
         GtkTreeIter iter, piter;
         GtkTreePath *path, *ppath;
         gchar iface[256];
+       char name[IF_NAMESIZE];
         
         s = g_new(struct Service, 1);
         s->service_name = g_strdup(service_name);
@@ -181,7 +155,7 @@ static void service_browser_callback(
         ppath = gtk_tree_row_reference_get_path(s->service_type->tree_ref);
         gtk_tree_model_get_iter(GTK_TREE_MODEL(tree_store), &piter, ppath);
 
-        snprintf(iface, sizeof(iface), "%s %s", getifname(interface), avahi_proto_to_string(protocol));
+        snprintf(iface, sizeof(iface), "%s %s", if_indextoname(interface, name), avahi_proto_to_string(protocol));
 
         gtk_tree_store_append(tree_store, &iter, &piter);
         gtk_tree_store_set(tree_store, &iter, 0, s->service_name, 1, iface, 2, s, -1);
@@ -240,6 +214,7 @@ static void service_type_browser_callback(
 
 static void update_label(struct Service *s, const gchar *hostname, const AvahiAddress *a, guint16 port, AvahiStringList *txt) {
     gchar t[512], address[64], *txt_s;
+    char name[IF_NAMESIZE];
 
     if (a && hostname) {
         char na[AVAHI_ADDRESS_STR_MAX];
@@ -265,7 +240,7 @@ static void update_label(struct Service *s, const gchar *hostname, const AvahiAd
              s->service_type->service_type,
              s->service_name,
              s->domain_name,
-             getifname(s->interface), avahi_proto_to_string(s->protocol),
+             if_indextoname(s->interface,name), avahi_proto_to_string(s->protocol),
              address,
              txt_s);
 
index 62d1e316923d48674c770e59675ffc1c0ca6349f..4c345662f6a0117b8c00d00cc84b8c57c80fcd51 100755 (executable)
@@ -28,7 +28,7 @@ case "$MACHTYPE" in
     export CFLAGS="-I/opt/local/include"
     export LDFLAGS="-L/opt/local/lib"
     export PKG_CONFIG_PATH="/opt/local/lib/pkgconfig"
-    FLAGS="$FLAGS --disable-monodoc --disable-mono --disable-qt3 --disable-qt4 --disable-python --disable-glib --disable-gtk --disable-xmltoman --disable-dbus --prefix=/opt --with-distro=none"
+    FLAGS="$FLAGS --disable-monodoc --disable-mono --disable-qt3 --disable-qt4 --disable-xmltoman --prefix=/opt --with-distro=none --disable-python"
     ;;
 esac