]> git.meshlink.io Git - catta/commitdiff
* rename daemon to avahi-daemon
authorTrent Lloyd <lathiat@bur.st>
Sun, 5 Jun 2005 02:37:27 +0000 (02:37 +0000)
committerTrent Lloyd <lathiat@bur.st>
Sun, 5 Jun 2005 02:37:27 +0000 (02:37 +0000)
git-svn-id: file:///home/lennart/svn/public/avahi/trunk@101 941a03a8-eaeb-0310-b9a0-b1bbd8fe43fe

avahi-daemon/Makefile.am [new file with mode: 0644]
avahi-daemon/README [new file with mode: 0644]
avahi-daemon/avahi.conf.example [new file with mode: 0644]
avahi-daemon/main.c [new file with mode: 0644]
daemon/Makefile.am [deleted file]
daemon/README [deleted file]
daemon/avahi.conf.example [deleted file]
daemon/main.c [deleted file]

diff --git a/avahi-daemon/Makefile.am b/avahi-daemon/Makefile.am
new file mode 100644 (file)
index 0000000..8bf007d
--- /dev/null
@@ -0,0 +1,40 @@
+# $Id: Makefile.am 52 2005-05-06 16:23:30Z lennart $
+#
+# This file is part of avahi.
+# 
+# avahi is free software; you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License as
+# published by the Free Software Foundation; either version 2 of the
+# License, or (at your option) any later version.
+#
+# avahi is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
+# License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with avahi; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+# USA.
+
+AM_CFLAGS=-I$(top_srcdir) -D_GNU_SOURCE
+
+# GLIB 2.0
+AM_CFLAGS+=$(GLIB20_CFLAGS)
+AM_LDADD=$(GLIB20_LIBS)
+
+# DBUS
+AM_CFLAGS+=$(DBUS_CFLAGS)
+AM_LDADD+=$(DBUS_LIBS)
+
+# This cool debug trap works on i386/gcc only
+AM_CFLAGS+='-DDEBUG_TRAP=__asm__("int $$3")'
+
+bin_PROGRAMS = \
+       avahi
+
+avahi_SOURCES = \
+       main.c
+
+avahi_CFLAGS = $(AM_CFLAGS)
+avahi_LDADD = $(AM_LDADD) ../avahi-core/libavahi-core.la ../avahi-common/libavahi-common.la
diff --git a/avahi-daemon/README b/avahi-daemon/README
new file mode 100644 (file)
index 0000000..e5f6405
--- /dev/null
@@ -0,0 +1,6 @@
+On most systems you will need to setup a security policy for avahi to allow it to own the Avahi service on the system d-bus.
+
+You can find an example in avahi.conf.example, this usually goes in /etc/dbus-1/system.d
+You will need to change the username 'lathiat' to whatever username you use for testing this code (later it will be a dedicated 'avahi' user)
+
+In future this stuff should be handled automatically but for now some manual setup is required.
diff --git a/avahi-daemon/avahi.conf.example b/avahi-daemon/avahi.conf.example
new file mode 100644 (file)
index 0000000..39e9de9
--- /dev/null
@@ -0,0 +1,23 @@
+<!DOCTYPE busconfig PUBLIC
+ "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
+ "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
+<busconfig>
+
+  <policy user="lathiat">
+    <allow own="org.freedesktop.Avahi"/>
+  </policy>
+  <policy user="root">
+    <allow own="org.freedesktop.Avahi"/>
+  </policy>
+
+  <!-- Allow anyone to invoke methods on the Manager and Device interfaces -->
+  <policy context="default">
+    <allow send_interface="org.freedesktop.Avahi"/>
+
+    <allow receive_interface="org.freedesktop.Avahi"
+           receive_sender="org.freedesktop.Avahi"/>
+  </policy>
+
+  <limit name="max_match_rules_per_connection">512</limit>
+
+</busconfig>
diff --git a/avahi-daemon/main.c b/avahi-daemon/main.c
new file mode 100644 (file)
index 0000000..9a02391
--- /dev/null
@@ -0,0 +1,164 @@
+/* $Id$ */
+
+/***
+  This file is part of avahi.
+  avahi is free software; you can redistribute it and/or modify it
+  under the terms of the GNU Lesser General Public License as
+  published by the Free Software Foundation; either version 2.1 of the
+  License, or (at your option) any later version.
+  avahi is distributed in the hope that it will be useful, but WITHOUT
+  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+  or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+  Public License for more details.
+  You should have received a copy of the GNU Lesser General Public
+  License along with avahi; if not, write to the Free Software
+  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+  USA.
+***/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <avahi-core/core.h>
+
+#define DBUS_API_SUBJECT_TO_CHANGE
+#include <dbus/dbus.h>
+#include <dbus/dbus-glib-lowlevel.h>
+
+#define DBUS_SERVICE_AVAHI "org.freedesktop.Avahi"
+
+static DBusHandlerResult
+do_register (DBusConnection *conn, DBusMessage *message)
+{
+       DBusError error;
+       char *s;
+
+       dbus_error_init (&error);
+
+       dbus_message_get_args (message, &error,
+                       DBUS_TYPE_STRING, &s,
+                       DBUS_TYPE_INVALID);
+
+       if (dbus_error_is_set (&error))
+       {
+               g_warning ("Error parsing register attempt");
+               dbus_error_free (&error);
+
+               return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+       }
+
+       g_message ("Register received from: %s", s);
+
+       return DBUS_HANDLER_RESULT_HANDLED;
+}
+
+static DBusHandlerResult
+signal_filter (DBusConnection *conn, DBusMessage *message, void *user_data)
+{
+       GMainLoop *loop = user_data;
+       DBusError error;
+
+       dbus_error_init (&error);
+
+       g_message ("dbus: interface=%s, path=%s, member=%s",
+                       dbus_message_get_interface (message),
+                       dbus_message_get_path (message),
+                       dbus_message_get_member (message));
+
+       if (dbus_message_is_signal (message,
+                               DBUS_INTERFACE_ORG_FREEDESKTOP_LOCAL,
+                               "Disconnected"))
+       {
+               /* No, we shouldn't quit, but until we get somewhere
+                * usefull such that we can restore our state, we will */
+               g_warning ("Disconnnected from d-bus");
+
+               g_main_loop_quit (loop);
+               return DBUS_HANDLER_RESULT_HANDLED;
+       } else if (dbus_message_is_method_call (message, DBUS_SERVICE_AVAHI,
+                               "Register"))
+       {
+               return do_register (conn, message);
+       } else if (dbus_message_is_signal (message,
+                               DBUS_INTERFACE_ORG_FREEDESKTOP_DBUS,
+                               "ServiceAcquired"))
+       {
+               char *name;
+
+               dbus_message_get_args (message, &error,
+                               DBUS_TYPE_STRING, &name,
+                               DBUS_TYPE_INVALID);
+
+               if (dbus_error_is_set (&error))
+               {
+                       g_warning ("Error parsing NameAcquired message");
+                       dbus_error_free (&error);
+
+                       return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+               }
+
+               g_message ("dbus: ServiceAcquired (%s)", name);
+
+               return DBUS_HANDLER_RESULT_HANDLED;
+       }
+
+       g_message ("dbus: missed event");
+
+       return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+}
+               
+int main(int argc, char *argv[]) {
+    GMainLoop *loop = NULL;
+    DBusConnection *bus;
+    DBusError error;
+
+    loop = g_main_loop_new(NULL, FALSE);
+
+    dbus_error_init (&error);
+
+
+    bus = dbus_bus_get (DBUS_BUS_SYSTEM, &error);
+
+    if (bus == NULL)
+    {
+           g_warning ("dbus_bus_get(): %s", error.message);
+           dbus_error_free (&error);
+
+           return -1;
+    }
+
+    dbus_connection_setup_with_g_main (bus, NULL);
+    dbus_connection_set_exit_on_disconnect (bus, FALSE);
+
+    dbus_bus_acquire_service (bus, DBUS_SERVICE_AVAHI, 0, &error);
+
+    if (dbus_error_is_set (&error))
+    {
+           g_warning ("dbus_error_is_set (): %s", error.message);
+           dbus_error_free (&error);
+
+           return -1;
+    }
+
+    dbus_connection_add_filter (bus, signal_filter, loop, NULL);
+    dbus_bus_add_match (bus,
+                   "type='method_call',interface='org.freedesktop.Avahi'",
+                   &error);
+
+    if (dbus_error_is_set (&error))
+    {
+           g_warning ("dbus_bus_add_match (): %s", error.message);
+           dbus_error_free (&error);
+
+           return -1;
+    }
+
+    g_main_loop_run(loop);
+    g_main_loop_unref(loop);
+    
+    return 0;
+}
diff --git a/daemon/Makefile.am b/daemon/Makefile.am
deleted file mode 100644 (file)
index 8bf007d..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-# $Id: Makefile.am 52 2005-05-06 16:23:30Z lennart $
-#
-# This file is part of avahi.
-# 
-# avahi is free software; you can redistribute it and/or modify it
-# under the terms of the GNU Lesser General Public License as
-# published by the Free Software Foundation; either version 2 of the
-# License, or (at your option) any later version.
-#
-# avahi is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
-# License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with avahi; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA.
-
-AM_CFLAGS=-I$(top_srcdir) -D_GNU_SOURCE
-
-# GLIB 2.0
-AM_CFLAGS+=$(GLIB20_CFLAGS)
-AM_LDADD=$(GLIB20_LIBS)
-
-# DBUS
-AM_CFLAGS+=$(DBUS_CFLAGS)
-AM_LDADD+=$(DBUS_LIBS)
-
-# This cool debug trap works on i386/gcc only
-AM_CFLAGS+='-DDEBUG_TRAP=__asm__("int $$3")'
-
-bin_PROGRAMS = \
-       avahi
-
-avahi_SOURCES = \
-       main.c
-
-avahi_CFLAGS = $(AM_CFLAGS)
-avahi_LDADD = $(AM_LDADD) ../avahi-core/libavahi-core.la ../avahi-common/libavahi-common.la
diff --git a/daemon/README b/daemon/README
deleted file mode 100644 (file)
index e5f6405..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-On most systems you will need to setup a security policy for avahi to allow it to own the Avahi service on the system d-bus.
-
-You can find an example in avahi.conf.example, this usually goes in /etc/dbus-1/system.d
-You will need to change the username 'lathiat' to whatever username you use for testing this code (later it will be a dedicated 'avahi' user)
-
-In future this stuff should be handled automatically but for now some manual setup is required.
diff --git a/daemon/avahi.conf.example b/daemon/avahi.conf.example
deleted file mode 100644 (file)
index 39e9de9..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-<!DOCTYPE busconfig PUBLIC
- "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
- "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
-<busconfig>
-
-  <policy user="lathiat">
-    <allow own="org.freedesktop.Avahi"/>
-  </policy>
-  <policy user="root">
-    <allow own="org.freedesktop.Avahi"/>
-  </policy>
-
-  <!-- Allow anyone to invoke methods on the Manager and Device interfaces -->
-  <policy context="default">
-    <allow send_interface="org.freedesktop.Avahi"/>
-
-    <allow receive_interface="org.freedesktop.Avahi"
-           receive_sender="org.freedesktop.Avahi"/>
-  </policy>
-
-  <limit name="max_match_rules_per_connection">512</limit>
-
-</busconfig>
diff --git a/daemon/main.c b/daemon/main.c
deleted file mode 100644 (file)
index 9a02391..0000000
+++ /dev/null
@@ -1,164 +0,0 @@
-/* $Id$ */
-
-/***
-  This file is part of avahi.
-  avahi is free software; you can redistribute it and/or modify it
-  under the terms of the GNU Lesser General Public License as
-  published by the Free Software Foundation; either version 2.1 of the
-  License, or (at your option) any later version.
-  avahi is distributed in the hope that it will be useful, but WITHOUT
-  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-  or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
-  Public License for more details.
-  You should have received a copy of the GNU Lesser General Public
-  License along with avahi; if not, write to the Free Software
-  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-  USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <avahi-core/core.h>
-
-#define DBUS_API_SUBJECT_TO_CHANGE
-#include <dbus/dbus.h>
-#include <dbus/dbus-glib-lowlevel.h>
-
-#define DBUS_SERVICE_AVAHI "org.freedesktop.Avahi"
-
-static DBusHandlerResult
-do_register (DBusConnection *conn, DBusMessage *message)
-{
-       DBusError error;
-       char *s;
-
-       dbus_error_init (&error);
-
-       dbus_message_get_args (message, &error,
-                       DBUS_TYPE_STRING, &s,
-                       DBUS_TYPE_INVALID);
-
-       if (dbus_error_is_set (&error))
-       {
-               g_warning ("Error parsing register attempt");
-               dbus_error_free (&error);
-
-               return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
-       }
-
-       g_message ("Register received from: %s", s);
-
-       return DBUS_HANDLER_RESULT_HANDLED;
-}
-
-static DBusHandlerResult
-signal_filter (DBusConnection *conn, DBusMessage *message, void *user_data)
-{
-       GMainLoop *loop = user_data;
-       DBusError error;
-
-       dbus_error_init (&error);
-
-       g_message ("dbus: interface=%s, path=%s, member=%s",
-                       dbus_message_get_interface (message),
-                       dbus_message_get_path (message),
-                       dbus_message_get_member (message));
-
-       if (dbus_message_is_signal (message,
-                               DBUS_INTERFACE_ORG_FREEDESKTOP_LOCAL,
-                               "Disconnected"))
-       {
-               /* No, we shouldn't quit, but until we get somewhere
-                * usefull such that we can restore our state, we will */
-               g_warning ("Disconnnected from d-bus");
-
-               g_main_loop_quit (loop);
-               return DBUS_HANDLER_RESULT_HANDLED;
-       } else if (dbus_message_is_method_call (message, DBUS_SERVICE_AVAHI,
-                               "Register"))
-       {
-               return do_register (conn, message);
-       } else if (dbus_message_is_signal (message,
-                               DBUS_INTERFACE_ORG_FREEDESKTOP_DBUS,
-                               "ServiceAcquired"))
-       {
-               char *name;
-
-               dbus_message_get_args (message, &error,
-                               DBUS_TYPE_STRING, &name,
-                               DBUS_TYPE_INVALID);
-
-               if (dbus_error_is_set (&error))
-               {
-                       g_warning ("Error parsing NameAcquired message");
-                       dbus_error_free (&error);
-
-                       return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
-               }
-
-               g_message ("dbus: ServiceAcquired (%s)", name);
-
-               return DBUS_HANDLER_RESULT_HANDLED;
-       }
-
-       g_message ("dbus: missed event");
-
-       return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
-}
-               
-int main(int argc, char *argv[]) {
-    GMainLoop *loop = NULL;
-    DBusConnection *bus;
-    DBusError error;
-
-    loop = g_main_loop_new(NULL, FALSE);
-
-    dbus_error_init (&error);
-
-
-    bus = dbus_bus_get (DBUS_BUS_SYSTEM, &error);
-
-    if (bus == NULL)
-    {
-           g_warning ("dbus_bus_get(): %s", error.message);
-           dbus_error_free (&error);
-
-           return -1;
-    }
-
-    dbus_connection_setup_with_g_main (bus, NULL);
-    dbus_connection_set_exit_on_disconnect (bus, FALSE);
-
-    dbus_bus_acquire_service (bus, DBUS_SERVICE_AVAHI, 0, &error);
-
-    if (dbus_error_is_set (&error))
-    {
-           g_warning ("dbus_error_is_set (): %s", error.message);
-           dbus_error_free (&error);
-
-           return -1;
-    }
-
-    dbus_connection_add_filter (bus, signal_filter, loop, NULL);
-    dbus_bus_add_match (bus,
-                   "type='method_call',interface='org.freedesktop.Avahi'",
-                   &error);
-
-    if (dbus_error_is_set (&error))
-    {
-           g_warning ("dbus_bus_add_match (): %s", error.message);
-           dbus_error_free (&error);
-
-           return -1;
-    }
-
-    g_main_loop_run(loop);
-    g_main_loop_unref(loop);
-    
-    return 0;
-}