]> git.meshlink.io Git - catta/commitdiff
* Rename various data structures to prevent a namespace conflict with avahi-core
authorTrent Lloyd <lathiat@bur.st>
Fri, 12 Aug 2005 04:49:23 +0000 (04:49 +0000)
committerTrent Lloyd <lathiat@bur.st>
Fri, 12 Aug 2005 04:49:23 +0000 (04:49 +0000)
git-svn-id: file:///home/lennart/svn/public/avahi/trunk@304 941a03a8-eaeb-0310-b9a0-b1bbd8fe43fe

avahi-client/browser.c
avahi-client/client-test.c
avahi-client/client.c
avahi-client/client.h
avahi-client/entrygroup.c
avahi-client/internal.h

index 3e3011004ebe37ce27f1fdb7cfd75e0196d8d2ae..54ae7c434445075fccfe8c42582f59b0ee623bf0 100644 (file)
 #include "client.h"
 #include "internal.h"
 
-/* AvahiDomainBrowser */
+/* AvahiClientDomainBrowser */
 
-AvahiDomainBrowser* avahi_domain_browser_new (AvahiClient *client, AvahiIfIndex interface, AvahiProtocol protocol, char *domain, AvahiDomainBrowserType btype, AvahiDomainBrowserCallback callback, void *user_data)
+AvahiClientDomainBrowser* avahi_domain_browser_new (AvahiClient *client, AvahiIfIndex interface, AvahiProtocol protocol, char *domain, AvahiDomainBrowserType btype, AvahiClientDomainBrowserCallback callback, void *user_data)
 {
-    AvahiDomainBrowser *tmp = NULL;
+    AvahiClientDomainBrowser *tmp = NULL;
     DBusMessage *message = NULL, *reply;
     DBusError error;
     char *path;
@@ -71,13 +71,13 @@ AvahiDomainBrowser* avahi_domain_browser_new (AvahiClient *client, AvahiIfIndex
     if (dbus_error_is_set (&error) || path == NULL)
         goto dbus_error;
 
-    tmp = malloc (sizeof (AvahiDomainBrowser));
+    tmp = malloc (sizeof (AvahiClientDomainBrowser));
     tmp->client = client;
     tmp->callback = callback;
     tmp->user_data = user_data;
     tmp->path = strdup (path);
 
-    AVAHI_LLIST_PREPEND(AvahiDomainBrowser, domain_browsers, client->domain_browsers, tmp);
+    AVAHI_LLIST_PREPEND(AvahiClientDomainBrowser, domain_browsers, client->domain_browsers, tmp);
 
     return tmp;
 
@@ -89,7 +89,7 @@ dbus_error:
 }
 
 char*
-avahi_domain_browser_path (AvahiDomainBrowser *b)
+avahi_domain_browser_path (AvahiClientDomainBrowser *b)
 {
     return b->path;
 }
@@ -97,7 +97,7 @@ avahi_domain_browser_path (AvahiDomainBrowser *b)
 DBusHandlerResult
 avahi_domain_browser_event (AvahiClient *client, AvahiBrowserEvent event, DBusMessage *message)
 {
-    AvahiDomainBrowser *n, *db = NULL;
+    AvahiClientDomainBrowser *n, *db = NULL;
     DBusError error;
     const char *path;
     char *domain;
@@ -137,10 +137,10 @@ out:
     return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
 }
 
-/* AvahiServiceTypeBrowser */
-AvahiServiceTypeBrowser* avahi_service_type_browser_new (AvahiClient *client, AvahiIfIndex interface, AvahiProtocol protocol, char *domain, AvahiServiceTypeBrowserCallback callback, void *user_data)
+/* AvahiClientServiceTypeBrowser */
+AvahiClientServiceTypeBrowser* avahi_service_type_browser_new (AvahiClient *client, AvahiIfIndex interface, AvahiProtocol protocol, char *domain, AvahiClientServiceTypeBrowserCallback callback, void *user_data)
 {
-    AvahiServiceTypeBrowser *tmp = NULL;
+    AvahiClientServiceTypeBrowser *tmp = NULL;
     DBusMessage *message = NULL, *reply;
     DBusError error;
     char *path;
@@ -169,13 +169,13 @@ AvahiServiceTypeBrowser* avahi_service_type_browser_new (AvahiClient *client, Av
     if (dbus_error_is_set (&error) || path == NULL)
         goto dbus_error;
 
-    tmp = malloc (sizeof (AvahiServiceTypeBrowser));
+    tmp = malloc (sizeof (AvahiClientServiceTypeBrowser));
     tmp->client = client;
     tmp->callback = callback;
     tmp->user_data = user_data;
     tmp->path = strdup (path);
 
-    AVAHI_LLIST_PREPEND(AvahiServiceTypeBrowser, service_type_browsers, client->service_type_browsers, tmp);
+    AVAHI_LLIST_PREPEND(AvahiClientServiceTypeBrowser, service_type_browsers, client->service_type_browsers, tmp);
 
     return tmp;
 
@@ -187,7 +187,7 @@ dbus_error:
 }
 
 char*
-avahi_service_type_browser_path (AvahiServiceTypeBrowser *b)
+avahi_service_type_browser_path (AvahiClientServiceTypeBrowser *b)
 {
     return b->path;
 }
@@ -195,7 +195,7 @@ avahi_service_type_browser_path (AvahiServiceTypeBrowser *b)
 DBusHandlerResult
 avahi_service_type_browser_event (AvahiClient *client, AvahiBrowserEvent event, DBusMessage *message)
 {
-    AvahiServiceTypeBrowser *n, *db = NULL;
+    AvahiClientServiceTypeBrowser *n, *db = NULL;
     DBusError error;
     const char *path;
     char *domain, *type;
index 18997d5d4740a88e432b7b8f326a486ae9e4565f..4a0aa068c410417d40fc6decd56a665475247316 100644 (file)
@@ -35,19 +35,19 @@ avahi_client_callback (AvahiClient *c, AvahiClientState state, void *user_data)
 }
 
 void
-avahi_entry_group_callback (AvahiEntryGroup *g, AvahiEntryGroupState state, void *user_data)
+avahi_entry_group_callback (AvahiClientEntryGroup *g, AvahiEntryGroupState state, void *user_data)
 {
     printf ("XXX: Callback on %s, state -> %d, data -> %s\n", avahi_entry_group_path (g), state, (char*)user_data);
 }
 
 void
-avahi_domain_browser_callback (AvahiDomainBrowser *b, AvahiIfIndex interface, AvahiProtocol protocol, AvahiBrowserEvent event, char *domain, void *user_data)
+avahi_domain_browser_callback (AvahiClientDomainBrowser *b, AvahiIfIndex interface, AvahiProtocol protocol, AvahiBrowserEvent event, char *domain, void *user_data)
 {
     printf ("XXX: Callback on %s, interface (%d), protocol (%d), event (%d), domain (%s), data (%s)\n", avahi_domain_browser_path (b), interface, protocol, event, domain, (char*)user_data);
 }
 
 void
-avahi_service_type_browser_callback (AvahiServiceTypeBrowser *b, AvahiIfIndex interface, AvahiProtocol protocol, AvahiBrowserEvent event, char *type, char *domain, void *user_data)
+avahi_service_type_browser_callback (AvahiClientServiceTypeBrowser *b, AvahiIfIndex interface, AvahiProtocol protocol, AvahiBrowserEvent event, char *type, char *domain, void *user_data)
 {
     printf ("XXX: Callback on %s, interface (%d), protocol (%d), event (%d), type (%s), domain (%s), data (%s)\n", avahi_service_type_browser_path (b), interface, protocol, event, type, domain, (char*)user_data);
 }
@@ -56,10 +56,10 @@ main (int argc, char *argv[])
 {
     GMainLoop *loop;
     AvahiClient *avahi;
-    AvahiEntryGroup *group;
+    AvahiClientEntryGroup *group;
     AvahiStringList *txt;
-    AvahiDomainBrowser *domain;
-    AvahiServiceTypeBrowser *st;
+    AvahiClientDomainBrowser *domain;
+    AvahiClientServiceTypeBrowser *st;
     char *ret;
 
     loop = g_main_loop_new (NULL, FALSE);
index 49c82d53d086cc8061eee0069f2be1868f891473..3bac33cbb5717f56ce5e95c7e0f9faa19dd48ae3 100644 (file)
@@ -147,7 +147,7 @@ filter_func (DBusConnection *bus, DBusMessage *message, void *data)
         printf ("server statehcange\n");
     } else if (dbus_message_is_signal (message, AVAHI_DBUS_INTERFACE_ENTRY_GROUP, "StateChanged")) {
         const char *path;
-        AvahiEntryGroup *n, *group = NULL;
+        AvahiClientEntryGroup *n, *group = NULL;
         path = dbus_message_get_path (message);
 
         for (n = client->groups; n != NULL; n = n->groups_next)
@@ -202,9 +202,9 @@ avahi_client_new (AvahiClientCallback callback, void *user_data)
     if (!(tmp = malloc(sizeof(AvahiClient))))
         goto fail;
 
-    AVAHI_LLIST_HEAD_INIT(AvahiEntryGroup, tmp->groups);
-    AVAHI_LLIST_HEAD_INIT(AvahiDomainBrowser, tmp->domain_browsers);
-    AVAHI_LLIST_HEAD_INIT(AvahiServieTypeBrowser, tmp->service_type_browsers);
+    AVAHI_LLIST_HEAD_INIT(AvahiClientEntryGroup, tmp->groups);
+    AVAHI_LLIST_HEAD_INIT(AvahiClientDomainBrowser, tmp->domain_browsers);
+    AVAHI_LLIST_HEAD_INIT(AvahiClientServiceTypeBrowser, tmp->service_type_browsers);
     
     tmp->bus = dbus_bus_get (DBUS_BUS_SYSTEM, &error);
 
index f3716ebc049de21bc095dbe8a8df243ecf1d3f66..f58a7591309b341eb0a6f5b9a438f6842bce04ec 100644 (file)
@@ -37,11 +37,15 @@ AVAHI_C_DECL_BEGIN
 
 typedef struct _AvahiClient AvahiClient;
 
-typedef struct _AvahiEntryGroup AvahiEntryGroup;
+typedef struct _AvahiClientEntryGroup AvahiClientEntryGroup;
 
-typedef struct _AvahiDomainBrowser AvahiDomainBrowser;
+typedef struct _AvahiClientDomainBrowser AvahiClientDomainBrowser;
 
-typedef struct _AvahiServiceTypeBrowser AvahiServiceTypeBrowser;
+typedef struct _AvahiClientServiceTypeBrowser AvahiClientServiceTypeBrowser;
+
+/* Convenience typedefs for slight name differences */
+typedef AvahiDomainBrowserType AvahiClientDomainBrowserType;
+typedef AvahiEntryGroupState AvahiClientEntryGroupState;
 
 /** States of a client object, note that AvahiServerStates are also emitted */
 typedef enum {
@@ -50,16 +54,34 @@ typedef enum {
 } AvahiClientState;
 
 /** The function prototype for the callback of an AvahiClient */
-typedef void (*AvahiClientCallback) (AvahiClient *s, AvahiClientState state, void* userdata);
-
-/** The function prototype for the callback of an AvahiEntryGroup */
-typedef void (*AvahiEntryGroupCallback) (AvahiEntryGroup *g, AvahiEntryGroupState state, void* userdata);
-
-/** The function prototype for the callback of an AvahiDomainBrowser */
-typedef void (*AvahiDomainBrowserCallback) (AvahiDomainBrowser *b, AvahiIfIndex interface, AvahiProtocol protocol, AvahiBrowserEvent event, char *domain, void *user_data);
-
-/** The function prototype for the callback of an AvahiServiceTypeBrowser */
-typedef void (*AvahiServiceTypeBrowserCallback) (AvahiServiceTypeBrowser *b, AvahiIfIndex interface, AvahiProtocol protocol, AvahiBrowserEvent event, char *type, char *domain, void *user_data);
+typedef void (*AvahiClientCallback) (AvahiClient *s,
+                                     AvahiClientState state,
+                                     void* userdata);
+
+/** The function prototype for the callback of an AvahiClientEntryGroup */
+typedef void (*AvahiClientEntryGroupCallback)
+                    (AvahiClientEntryGroup *g,
+                     AvahiEntryGroupState state,
+                     void* userdata);
+
+/** The function prototype for the callback of an AvahiClientDomainBrowser */
+typedef void (*AvahiClientDomainBrowserCallback)
+                    (AvahiClientDomainBrowser *b,
+                     AvahiIfIndex interface,
+                     AvahiProtocol protocol,
+                     AvahiBrowserEvent event,
+                     char *domain,
+                     void *user_data);
+
+/** The function prototype for the callback of an AvahiClientServiceTypeBrowser */
+typedef void (*AvahiClientServiceTypeBrowserCallback)
+                    (AvahiClientServiceTypeBrowser *b, 
+                     AvahiIfIndex interface,
+                     AvahiProtocol protocol,
+                     AvahiBrowserEvent event,
+                     char *type,
+                     char *domain,
+                     void *user_data);
 
 /** Creates a new client instance */
 AvahiClient* avahi_client_new (AvahiClientCallback callback, void *user_data);
@@ -76,30 +98,33 @@ char* avahi_client_get_domain_name (AvahiClient*);
 /** Get FQDN domain name */
 char* avahi_client_get_host_name_fqdn (AvahiClient*);
 
-/** Create a new AvahiEntryGroup object */
-AvahiEntryGroup* avahi_entry_group_new (AvahiClient*, AvahiEntryGroupCallback callback, void *user_data);
+/** Create a new AvahiClientEntryGroup object */
+AvahiClientEntryGroup* avahi_entry_group_new
+                    (AvahiClient*,
+                     AvahiClientEntryGroupCallback callback,
+                     void *user_data);
 
-/** Commit an AvahiEntryGroup */
-int avahi_entry_group_commit (AvahiEntryGroup*);
+/** Commit an AvahiClientEntryGroup */
+int avahi_entry_group_commit (AvahiClientEntryGroup*);
 
-/** Reset an AvahiEntryGroup */
-int avahi_entry_group_reset (AvahiEntryGroup*);
+/** Reset an AvahiClientEntryGroup */
+int avahi_entry_group_reset (AvahiClientEntryGroup*);
 
-/** Get an AvahiEntryGroup's state */
-int avahi_entry_group_get_state (AvahiEntryGroup*);
+/** Get an AvahiClientEntryGroup's state */
+int avahi_entry_group_get_state (AvahiClientEntryGroup*);
 
-/** Check if an AvahiEntryGroup is empty */
-int avahi_entry_group_is_empty (AvahiEntryGroup*);
+/** Check if an AvahiClientEntryGroup is empty */
+int avahi_entry_group_is_empty (AvahiClientEntryGroup*);
 
 /** Get the last error number */
 int avahi_client_errno (AvahiClient*);
 
-/** Get an AvahiEntryGroup's owning client instance */
-AvahiClient* avahi_entry_group_get_client (AvahiEntryGroup*);
+/** Get an AvahiClientEntryGroup's owning client instance */
+AvahiClient* avahi_entry_group_get_client (AvahiClientEntryGroup*);
 
 /** Add a service, takes an AvahiStringList for text records */
 int
-avahi_entry_group_add_service (AvahiEntryGroup *group,
+avahi_entry_group_add_service (AvahiClientEntryGroup *group,
                                AvahiIfIndex interface,
                                AvahiProtocol protocol,
                                const char *name,
@@ -109,31 +134,32 @@ avahi_entry_group_add_service (AvahiEntryGroup *group,
                                uint16_t port,
                                AvahiStringList *txt);
 
-/** Get the D-Bus path of an AvahiEntryGroup object, for debugging purposes only. */
-char* avahi_entry_group_path (AvahiEntryGroup *);
+/** Get the D-Bus path of an AvahiClientEntryGroup object, for debugging purposes only. */
+char* avahi_entry_group_path (AvahiClientEntryGroup *);
 
-/** Get the D-Bus path of an AvahiDomainBrowser object, for debugging purposes only. */
-char* avahi_domain_browser_path (AvahiDomainBrowser *);
+/** Get the D-Bus path of an AvahiClientDomainBrowser object, for debugging purposes only. */
+char* avahi_domain_browser_path (AvahiClientDomainBrowser *);
 
 /** Browse for domains on the local network */
-AvahiDomainBrowser* avahi_domain_browser_new (AvahiClient *client,
-                                              AvahiIfIndex interface,
-                                              AvahiProtocol protocol,
-                                              char *domain,
-                                              AvahiDomainBrowserType btype,
-                                              AvahiDomainBrowserCallback callback,
-                                              void *user_data);
-
-/** Get the D-Bus path of an AvahiServiceTypeBrowser object, for debugging purposes only. */
-char* avahi_service_type_browser_path (AvahiServiceTypeBrowser *);
+AvahiClientDomainBrowser* avahi_domain_browser_new
+                                (AvahiClient *client,
+                                AvahiIfIndex interface,
+                                AvahiProtocol protocol,
+                                char *domain,
+                                AvahiDomainBrowserType btype,
+                                AvahiClientDomainBrowserCallback callback,
+                                void *user_data);
+
+/** Get the D-Bus path of an AvahiClientServiceTypeBrowser object, for debugging purposes only. */
+char* avahi_service_type_browser_path (AvahiClientServiceTypeBrowser *);
 
 /** Browse for service types on the local network */
-AvahiServiceTypeBrowser* avahi_service_type_browser_new (
+AvahiClientServiceTypeBrowser* avahi_service_type_browser_new (
                 AvahiClient *client,
                 AvahiIfIndex interface,
                 AvahiProtocol protocol,
                 char *domain,
-                AvahiServiceTypeBrowserCallback callback,
+                AvahiClientServiceTypeBrowserCallback callback,
                 void *user_data);
 
 
index ea56ee2591fc362ebeb76657ab20d59dcfc138ef..b22fdf767eb3daa75e83192866046494a4d091ea 100644 (file)
@@ -40,7 +40,7 @@
 #include "client.h"
 #include "internal.h"
 
-void avahi_entry_group_state_change (AvahiEntryGroup *group, int state)
+void avahi_entry_group_state_change (AvahiClientEntryGroup *group, int state)
 {
     if (group == NULL || group->callback == NULL)
         return;
@@ -48,10 +48,10 @@ void avahi_entry_group_state_change (AvahiEntryGroup *group, int state)
     group->callback (group, state, group->user_data);
 }
 
-AvahiEntryGroup*
-avahi_entry_group_new (AvahiClient *client, AvahiEntryGroupCallback callback, void *user_data)
+AvahiClientEntryGroup*
+avahi_entry_group_new (AvahiClient *client, AvahiClientEntryGroupCallback callback, void *user_data)
 {
-    AvahiEntryGroup *tmp = NULL;
+    AvahiClientEntryGroup *tmp = NULL;
     DBusMessage *message = NULL, *reply;
     DBusError error;
     char *path;
@@ -92,7 +92,7 @@ avahi_entry_group_new (AvahiClient *client, AvahiEntryGroupCallback callback, vo
         goto fail;
     }
 
-    tmp = malloc (sizeof (AvahiEntryGroup));
+    tmp = malloc (sizeof (AvahiClientEntryGroup));
 
     tmp->client = client;
 
@@ -100,7 +100,7 @@ avahi_entry_group_new (AvahiClient *client, AvahiEntryGroupCallback callback, vo
     tmp->callback = callback;
     tmp->user_data = user_data;
 
-    AVAHI_LLIST_PREPEND(AvahiEntryGroup, groups, client->groups, tmp);
+    AVAHI_LLIST_PREPEND(AvahiClientEntryGroup, groups, client->groups, tmp);
 
     dbus_message_unref (message);
 
@@ -114,7 +114,7 @@ fail:
 }
 
 int
-avahi_entry_group_commit (AvahiEntryGroup *group)
+avahi_entry_group_commit (AvahiClientEntryGroup *group)
 {
     DBusMessage *message;
     DBusError error;
@@ -130,7 +130,7 @@ avahi_entry_group_commit (AvahiEntryGroup *group)
 }
 
 int
-avahi_entry_group_reset (AvahiEntryGroup *group)
+avahi_entry_group_reset (AvahiClientEntryGroup *group)
 {
     DBusMessage *message;
 
@@ -143,7 +143,7 @@ avahi_entry_group_reset (AvahiEntryGroup *group)
 }
 
 int
-avahi_entry_group_get_state (AvahiEntryGroup *group)
+avahi_entry_group_get_state (AvahiClientEntryGroup *group)
 {
     DBusMessage *message, *reply;
     DBusError error;
@@ -185,19 +185,19 @@ avahi_client_errno (AvahiClient *client)
 }
 
 AvahiClient*
-avahi_entry_group_get_client (AvahiEntryGroup *group)
+avahi_entry_group_get_client (AvahiClientEntryGroup *group)
 {
     return group->client;
 }
 
 int
-avahi_entry_group_is_empty (AvahiEntryGroup *group)
+avahi_entry_group_is_empty (AvahiClientEntryGroup *group)
 {
     return AVAHI_OK;
 }
 
 int
-avahi_entry_group_add_service (AvahiEntryGroup *group,
+avahi_entry_group_add_service (AvahiClientEntryGroup *group,
                                AvahiIfIndex interface,
                                AvahiProtocol protocol,
                                const char *name,
@@ -249,7 +249,7 @@ avahi_entry_group_add_service (AvahiEntryGroup *group,
 }
 
 /* XXX: debug function */
-char* avahi_entry_group_path (AvahiEntryGroup *group)
+char* avahi_entry_group_path (AvahiClientEntryGroup *group)
 {
     if (group != NULL) return group->path;
     else return NULL;
index ad39af3641d581584302e12da97abf1d271ca057..4feffc078c5691c997bc6bc0808ea5cf513b8c45 100644 (file)
@@ -30,38 +30,38 @@ struct _AvahiClient
     int error;
     AvahiClientCallback callback;
     void *user_data;
-    AVAHI_LLIST_HEAD(AvahiEntryGroup, groups);
-    AVAHI_LLIST_HEAD(AvahiDomainBrowser, domain_browsers);
-    AVAHI_LLIST_HEAD(AvahiServiceTypeBrowser, service_type_browsers);
+    AVAHI_LLIST_HEAD(AvahiClientEntryGroup, groups);
+    AVAHI_LLIST_HEAD(AvahiClientDomainBrowser, domain_browsers);
+    AVAHI_LLIST_HEAD(AvahiClientServiceTypeBrowser, service_type_browsers);
 };
 
-struct _AvahiEntryGroup {
+struct _AvahiClientEntryGroup {
     char *path;
     AvahiClient *client;
-    AvahiEntryGroupCallback callback;
+    AvahiClientEntryGroupCallback callback;
     void *user_data;
-    AVAHI_LLIST_FIELDS(AvahiEntryGroup, groups);
+    AVAHI_LLIST_FIELDS(AvahiClientEntryGroup, groups);
 };
 
-struct _AvahiDomainBrowser {
+struct _AvahiClientDomainBrowser {
     char *path;
     AvahiClient *client;
-    AvahiDomainBrowserCallback callback;
+    AvahiClientDomainBrowserCallback callback;
     void *user_data;
-    AVAHI_LLIST_FIELDS(AvahiDomainBrowser, domain_browsers);
+    AVAHI_LLIST_FIELDS(AvahiClientDomainBrowser, domain_browsers);
 };
 
-struct _AvahiServiceTypeBrowser {
+struct _AvahiClientServiceTypeBrowser {
     char *path;
     AvahiClient *client;
-    AvahiServiceTypeBrowserCallback callback;
+    AvahiClientServiceTypeBrowserCallback callback;
     void *user_data;
-    AVAHI_LLIST_FIELDS(AvahiServiceTypeBrowser, service_type_browsers);
+    AVAHI_LLIST_FIELDS(AvahiClientServiceTypeBrowser, service_type_browsers);
 };
 
 int avahi_client_set_errno (AvahiClient *client, int error);
 
-void avahi_entry_group_state_change (AvahiEntryGroup *group, int state);
+void avahi_entry_group_state_change (AvahiClientEntryGroup *group, int state);
 
 DBusHandlerResult avahi_domain_browser_event (AvahiClient *client, AvahiBrowserEvent event, DBusMessage *message);