]> git.meshlink.io Git - catta/commitdiff
* Move dbus service #defines to avahi-common/dbus.h
authorTrent Lloyd <lathiat@bur.st>
Fri, 29 Jul 2005 02:03:26 +0000 (02:03 +0000)
committerTrent Lloyd <lathiat@bur.st>
Fri, 29 Jul 2005 02:03:26 +0000 (02:03 +0000)
 * Move cdecl.h to installed common headers
 * Remove glib use from avahi-client
 * Only build avahi-client if dbus is enabled

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

avahi-client/Makefile.am
avahi-client/client-test.c
avahi-client/client.c
avahi-client/client.h
avahi-common/Makefile.am
avahi-common/dbus.h [new file with mode: 0644]
avahi-daemon/dbus-protocol.c

index 8f9dce0435612644300c9e2e11951c8695ccc777..2d5a6544a01b73f18742ba9a4c02379397d9ce0a 100644 (file)
@@ -23,9 +23,15 @@ AM_CFLAGS=-I$(top_srcdir)
 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")'
 
+if ENABLE_DBUS
+
 avahi_clientincludedir=$(includedir)/avahi-client
 
 avahi_clientinclude_HEADERS = \
@@ -44,3 +50,5 @@ client_test_SOURCES = \
        client-test.c
 client_test_CFLAGS = $(AM_CFLAGS)
 client_test_LDADD = $(AM_LDADD) libavahi-client.la
+
+endif
index 72a8e65530a52fa50de3b68dc928c2554cf12b2f..71d509698680a403926baf859cf417cd49b39336 100644 (file)
@@ -1,11 +1,15 @@
 #include <avahi-client/client.h>
+#include <stdio.h>
 
 int
 main (int argc, char *argv[])
 {
-       AvahiClient *avahi;
+    AvahiClient *avahi;
+    
+    avahi = avahi_client_new ();
 
-       avahi = avahi_client_new ();
+    if (avahi != NULL)
+        free (avahi);
 
-       g_message ("Got server ID %d", avahi->serverid);
+    return 0;
 }
index 949e5ef39336558c76ec018543a39d4ce8618c7c..36434036aeca2e062b3b44a1cb4d631ffca7bd5d 100644 (file)
@@ -1,11 +1,18 @@
 #include <avahi-client/client.h>
+#include <avahi-common/dbus.h>
+#include <glib.h>
+
+#define DBUS_API_SUBJECT_TO_CHANGE
+#include <dbus/dbus.h>
+
+#include <stdlib.h>
 
 AvahiClient *
 avahi_client_new ()
 {
-       AvahiClient *tmp;
+    AvahiClient *tmp;
 
-       tmp = g_new0 (AvahiClient, 1);
+    tmp = malloc (sizeof (AvahiClient));
 
-       return tmp;
+    return tmp;
 }
index a33f1d2cdde68abab7e4c2e4ef0fae098196762c..91f5af5825779b54087e88b381ad4787156f1b8e 100644 (file)
   USA.
 ***/
 
-#include <glib.h>
+#include <avahi-common/cdecl.h>
 
-typedef struct AvahiClient {
-       gint serverid;
+/** \file client.h Definitions and functions for the client API over D-Bus */
+
+AVAHI_C_DECL_BEGIN
+
+typedef struct {
+       int serverid;
 } AvahiClient;
 
+/** Creates a new client instance */
 AvahiClient* avahi_client_new ();
 
+AVAHI_C_DECL_END
+
 #endif
index 208aa94e916890a3ace521f111ef2da3ca3a713e..b4125d62f91804d6242fb6b23671f1c0cbf4030a 100644 (file)
@@ -33,10 +33,9 @@ avahi_commoninclude_HEADERS = \
        address.h \
        alternative.h \
        rr.h \
-       util.h
-
-noinst_HEADERS = \
-       cdecl.h
+       util.h \
+       cdecl.h \
+       dbus.h
 
 noinst_PROGRAMS = \
        strlst-test \
diff --git a/avahi-common/dbus.h b/avahi-common/dbus.h
new file mode 100644 (file)
index 0000000..27ee40a
--- /dev/null
@@ -0,0 +1,35 @@
+#ifndef foodbushfoo
+/* $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
+
+#define AVAHI_DBUS_NAME "org.freedesktop.Avahi"
+#define AVAHI_DBUS_INTERFACE_SERVER AVAHI_DBUS_NAME".Server"
+#define AVAHI_DBUS_PATH_SERVER "/org/freedesktop/Avahi/Server"
+#define AVAHI_DBUS_INTERFACE_ENTRY_GROUP AVAHI_DBUS_NAME".EntryGroup"
+#define AVAHI_DBUS_INTERFACE_DOMAIN_BROWSER AVAHI_DBUS_NAME".DomainBrowser"
+#define AVAHI_DBUS_INTERFACE_SERVICE_TYPE_BROWSER AVAHI_DBUS_NAME".ServiceTypeBrowser"
+#define AVAHI_DBUS_INTERFACE_SERVICE_BROWSER AVAHI_DBUS_NAME".ServiceBrowser"
+
+#endif
index ced746c220efb000eb64aab97be4d480009b9150..f2d34d1b2dfa4254f9ecf2eb6baad4492deef845 100644 (file)
 #include <avahi-core/llist.h>
 #include <avahi-core/log.h>
 #include <avahi-core/core.h>
+#include <avahi-common/dbus.h>
 
 #include "dbus-protocol.h"
 #include "main.h"
 
-#define AVAHI_DBUS_NAME "org.freedesktop.Avahi"
-#define AVAHI_DBUS_INTERFACE_SERVER AVAHI_DBUS_NAME".Server"
-#define AVAHI_DBUS_PATH_SERVER "/org/freedesktop/Avahi/Server"
-#define AVAHI_DBUS_INTERFACE_ENTRY_GROUP AVAHI_DBUS_NAME".EntryGroup"
-#define AVAHI_DBUS_INTERFACE_DOMAIN_BROWSER AVAHI_DBUS_NAME".DomainBrowser"
-#define AVAHI_DBUS_INTERFACE_SERVICE_TYPE_BROWSER AVAHI_DBUS_NAME".ServiceTypeBrowser"
-#define AVAHI_DBUS_INTERFACE_SERVICE_BROWSER AVAHI_DBUS_NAME".ServiceBrowser"
-
 typedef struct Server Server;
 typedef struct Client Client;
 typedef struct EntryGroupInfo EntryGroupInfo;