From: Trent Lloyd Date: Fri, 12 Aug 2005 04:49:23 +0000 (+0000) Subject: * Rename various data structures to prevent a namespace conflict with avahi-core X-Git-Url: https://git.meshlink.io/?a=commitdiff_plain;h=f8c479234af6b676027df4fb6b38ce8e22949049;p=catta * Rename various data structures to prevent a namespace conflict with avahi-core git-svn-id: file:///home/lennart/svn/public/avahi/trunk@304 941a03a8-eaeb-0310-b9a0-b1bbd8fe43fe --- diff --git a/avahi-client/browser.c b/avahi-client/browser.c index 3e30110..54ae7c4 100644 --- a/avahi-client/browser.c +++ b/avahi-client/browser.c @@ -40,11 +40,11 @@ #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; diff --git a/avahi-client/client-test.c b/avahi-client/client-test.c index 18997d5..4a0aa06 100644 --- a/avahi-client/client-test.c +++ b/avahi-client/client-test.c @@ -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); diff --git a/avahi-client/client.c b/avahi-client/client.c index 49c82d5..3bac33c 100644 --- a/avahi-client/client.c +++ b/avahi-client/client.c @@ -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); diff --git a/avahi-client/client.h b/avahi-client/client.h index f3716eb..f58a759 100644 --- a/avahi-client/client.h +++ b/avahi-client/client.h @@ -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); diff --git a/avahi-client/entrygroup.c b/avahi-client/entrygroup.c index ea56ee2..b22fdf7 100644 --- a/avahi-client/entrygroup.c +++ b/avahi-client/entrygroup.c @@ -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; diff --git a/avahi-client/internal.h b/avahi-client/internal.h index ad39af3..4feffc0 100644 --- a/avahi-client/internal.h +++ b/avahi-client/internal.h @@ -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);