summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--avahi-client/browser.c28
-rw-r--r--avahi-client/client-test.c12
-rw-r--r--avahi-client/client.c8
-rw-r--r--avahi-client/client.h110
-rw-r--r--avahi-client/entrygroup.c26
-rw-r--r--avahi-client/internal.h26
6 files changed, 92 insertions, 118 deletions
diff --git a/avahi-client/browser.c b/avahi-client/browser.c
index 54ae7c4..3e30110 100644
--- a/avahi-client/browser.c
+++ b/avahi-client/browser.c
@@ -40,11 +40,11 @@
#include "client.h"
#include "internal.h"
-/* AvahiClientDomainBrowser */
+/* AvahiDomainBrowser */
-AvahiClientDomainBrowser* avahi_domain_browser_new (AvahiClient *client, AvahiIfIndex interface, AvahiProtocol protocol, char *domain, AvahiDomainBrowserType btype, AvahiClientDomainBrowserCallback callback, void *user_data)
+AvahiDomainBrowser* avahi_domain_browser_new (AvahiClient *client, AvahiIfIndex interface, AvahiProtocol protocol, char *domain, AvahiDomainBrowserType btype, AvahiDomainBrowserCallback callback, void *user_data)
{
- AvahiClientDomainBrowser *tmp = NULL;
+ AvahiDomainBrowser *tmp = NULL;
DBusMessage *message = NULL, *reply;
DBusError error;
char *path;
@@ -71,13 +71,13 @@ AvahiClientDomainBrowser* avahi_domain_browser_new (AvahiClient *client, AvahiIf
if (dbus_error_is_set (&error) || path == NULL)
goto dbus_error;
- tmp = malloc (sizeof (AvahiClientDomainBrowser));
+ tmp = malloc (sizeof (AvahiDomainBrowser));
tmp->client = client;
tmp->callback = callback;
tmp->user_data = user_data;
tmp->path = strdup (path);
- AVAHI_LLIST_PREPEND(AvahiClientDomainBrowser, domain_browsers, client->domain_browsers, tmp);
+ AVAHI_LLIST_PREPEND(AvahiDomainBrowser, domain_browsers, client->domain_browsers, tmp);
return tmp;
@@ -89,7 +89,7 @@ dbus_error:
}
char*
-avahi_domain_browser_path (AvahiClientDomainBrowser *b)
+avahi_domain_browser_path (AvahiDomainBrowser *b)
{
return b->path;
}
@@ -97,7 +97,7 @@ avahi_domain_browser_path (AvahiClientDomainBrowser *b)
DBusHandlerResult
avahi_domain_browser_event (AvahiClient *client, AvahiBrowserEvent event, DBusMessage *message)
{
- AvahiClientDomainBrowser *n, *db = NULL;
+ AvahiDomainBrowser *n, *db = NULL;
DBusError error;
const char *path;
char *domain;
@@ -137,10 +137,10 @@ out:
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
}
-/* AvahiClientServiceTypeBrowser */
-AvahiClientServiceTypeBrowser* avahi_service_type_browser_new (AvahiClient *client, AvahiIfIndex interface, AvahiProtocol protocol, char *domain, AvahiClientServiceTypeBrowserCallback callback, void *user_data)
+/* AvahiServiceTypeBrowser */
+AvahiServiceTypeBrowser* avahi_service_type_browser_new (AvahiClient *client, AvahiIfIndex interface, AvahiProtocol protocol, char *domain, AvahiServiceTypeBrowserCallback callback, void *user_data)
{
- AvahiClientServiceTypeBrowser *tmp = NULL;
+ AvahiServiceTypeBrowser *tmp = NULL;
DBusMessage *message = NULL, *reply;
DBusError error;
char *path;
@@ -169,13 +169,13 @@ AvahiClientServiceTypeBrowser* avahi_service_type_browser_new (AvahiClient *clie
if (dbus_error_is_set (&error) || path == NULL)
goto dbus_error;
- tmp = malloc (sizeof (AvahiClientServiceTypeBrowser));
+ tmp = malloc (sizeof (AvahiServiceTypeBrowser));
tmp->client = client;
tmp->callback = callback;
tmp->user_data = user_data;
tmp->path = strdup (path);
- AVAHI_LLIST_PREPEND(AvahiClientServiceTypeBrowser, service_type_browsers, client->service_type_browsers, tmp);
+ AVAHI_LLIST_PREPEND(AvahiServiceTypeBrowser, service_type_browsers, client->service_type_browsers, tmp);
return tmp;
@@ -187,7 +187,7 @@ dbus_error:
}
char*
-avahi_service_type_browser_path (AvahiClientServiceTypeBrowser *b)
+avahi_service_type_browser_path (AvahiServiceTypeBrowser *b)
{
return b->path;
}
@@ -195,7 +195,7 @@ avahi_service_type_browser_path (AvahiClientServiceTypeBrowser *b)
DBusHandlerResult
avahi_service_type_browser_event (AvahiClient *client, AvahiBrowserEvent event, DBusMessage *message)
{
- AvahiClientServiceTypeBrowser *n, *db = NULL;
+ AvahiServiceTypeBrowser *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 4a0aa06..18997d5 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 (AvahiClientEntryGroup *g, AvahiEntryGroupState state, void *user_data)
+avahi_entry_group_callback (AvahiEntryGroup *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 (AvahiClientDomainBrowser *b, AvahiIfIndex interface, AvahiProtocol protocol, AvahiBrowserEvent event, char *domain, void *user_data)
+avahi_domain_browser_callback (AvahiDomainBrowser *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 (AvahiClientServiceTypeBrowser *b, AvahiIfIndex interface, AvahiProtocol protocol, AvahiBrowserEvent event, char *type, char *domain, void *user_data)
+avahi_service_type_browser_callback (AvahiServiceTypeBrowser *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;
- AvahiClientEntryGroup *group;
+ AvahiEntryGroup *group;
AvahiStringList *txt;
- AvahiClientDomainBrowser *domain;
- AvahiClientServiceTypeBrowser *st;
+ AvahiDomainBrowser *domain;
+ AvahiServiceTypeBrowser *st;
char *ret;
loop = g_main_loop_new (NULL, FALSE);
diff --git a/avahi-client/client.c b/avahi-client/client.c
index 3bac33c..49c82d5 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;
- AvahiClientEntryGroup *n, *group = NULL;
+ AvahiEntryGroup *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(AvahiClientEntryGroup, tmp->groups);
- AVAHI_LLIST_HEAD_INIT(AvahiClientDomainBrowser, tmp->domain_browsers);
- AVAHI_LLIST_HEAD_INIT(AvahiClientServiceTypeBrowser, tmp->service_type_browsers);
+ AVAHI_LLIST_HEAD_INIT(AvahiEntryGroup, tmp->groups);
+ AVAHI_LLIST_HEAD_INIT(AvahiDomainBrowser, tmp->domain_browsers);
+ AVAHI_LLIST_HEAD_INIT(AvahiServieTypeBrowser, 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 f58a759..f3716eb 100644
--- a/avahi-client/client.h
+++ b/avahi-client/client.h
@@ -37,15 +37,11 @@ AVAHI_C_DECL_BEGIN
typedef struct _AvahiClient AvahiClient;
-typedef struct _AvahiClientEntryGroup AvahiClientEntryGroup;
+typedef struct _AvahiEntryGroup AvahiEntryGroup;
-typedef struct _AvahiClientDomainBrowser AvahiClientDomainBrowser;
+typedef struct _AvahiDomainBrowser AvahiDomainBrowser;
-typedef struct _AvahiClientServiceTypeBrowser AvahiClientServiceTypeBrowser;
-
-/* Convenience typedefs for slight name differences */
-typedef AvahiDomainBrowserType AvahiClientDomainBrowserType;
-typedef AvahiEntryGroupState AvahiClientEntryGroupState;
+typedef struct _AvahiServiceTypeBrowser AvahiServiceTypeBrowser;
/** States of a client object, note that AvahiServerStates are also emitted */
typedef enum {
@@ -54,34 +50,16 @@ 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 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);
+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);
/** Creates a new client instance */
AvahiClient* avahi_client_new (AvahiClientCallback callback, void *user_data);
@@ -98,33 +76,30 @@ char* avahi_client_get_domain_name (AvahiClient*);
/** Get FQDN domain name */
char* avahi_client_get_host_name_fqdn (AvahiClient*);
-/** Create a new AvahiClientEntryGroup object */
-AvahiClientEntryGroup* avahi_entry_group_new
- (AvahiClient*,
- AvahiClientEntryGroupCallback callback,
- void *user_data);
+/** Create a new AvahiEntryGroup object */
+AvahiEntryGroup* avahi_entry_group_new (AvahiClient*, AvahiEntryGroupCallback callback, void *user_data);
-/** Commit an AvahiClientEntryGroup */
-int avahi_entry_group_commit (AvahiClientEntryGroup*);
+/** Commit an AvahiEntryGroup */
+int avahi_entry_group_commit (AvahiEntryGroup*);
-/** Reset an AvahiClientEntryGroup */
-int avahi_entry_group_reset (AvahiClientEntryGroup*);
+/** Reset an AvahiEntryGroup */
+int avahi_entry_group_reset (AvahiEntryGroup*);
-/** Get an AvahiClientEntryGroup's state */
-int avahi_entry_group_get_state (AvahiClientEntryGroup*);
+/** Get an AvahiEntryGroup's state */
+int avahi_entry_group_get_state (AvahiEntryGroup*);
-/** Check if an AvahiClientEntryGroup is empty */
-int avahi_entry_group_is_empty (AvahiClientEntryGroup*);
+/** Check if an AvahiEntryGroup is empty */
+int avahi_entry_group_is_empty (AvahiEntryGroup*);
/** Get the last error number */
int avahi_client_errno (AvahiClient*);
-/** Get an AvahiClientEntryGroup's owning client instance */
-AvahiClient* avahi_entry_group_get_client (AvahiClientEntryGroup*);
+/** Get an AvahiEntryGroup's owning client instance */
+AvahiClient* avahi_entry_group_get_client (AvahiEntryGroup*);
/** Add a service, takes an AvahiStringList for text records */
int
-avahi_entry_group_add_service (AvahiClientEntryGroup *group,
+avahi_entry_group_add_service (AvahiEntryGroup *group,
AvahiIfIndex interface,
AvahiProtocol protocol,
const char *name,
@@ -134,32 +109,31 @@ avahi_entry_group_add_service (AvahiClientEntryGroup *group,
uint16_t port,
AvahiStringList *txt);
-/** 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 AvahiEntryGroup object, for debugging purposes only. */
+char* avahi_entry_group_path (AvahiEntryGroup *);
-/** Get the D-Bus path of an AvahiClientDomainBrowser object, for debugging purposes only. */
-char* avahi_domain_browser_path (AvahiClientDomainBrowser *);
+/** Get the D-Bus path of an AvahiDomainBrowser object, for debugging purposes only. */
+char* avahi_domain_browser_path (AvahiDomainBrowser *);
/** Browse for domains on the local network */
-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 *);
+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 *);
/** Browse for service types on the local network */
-AvahiClientServiceTypeBrowser* avahi_service_type_browser_new (
+AvahiServiceTypeBrowser* avahi_service_type_browser_new (
AvahiClient *client,
AvahiIfIndex interface,
AvahiProtocol protocol,
char *domain,
- AvahiClientServiceTypeBrowserCallback callback,
+ AvahiServiceTypeBrowserCallback callback,
void *user_data);
diff --git a/avahi-client/entrygroup.c b/avahi-client/entrygroup.c
index b22fdf7..ea56ee2 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 (AvahiClientEntryGroup *group, int state)
+void avahi_entry_group_state_change (AvahiEntryGroup *group, int state)
{
if (group == NULL || group->callback == NULL)
return;
@@ -48,10 +48,10 @@ void avahi_entry_group_state_change (AvahiClientEntryGroup *group, int state)
group->callback (group, state, group->user_data);
}
-AvahiClientEntryGroup*
-avahi_entry_group_new (AvahiClient *client, AvahiClientEntryGroupCallback callback, void *user_data)
+AvahiEntryGroup*
+avahi_entry_group_new (AvahiClient *client, AvahiEntryGroupCallback callback, void *user_data)
{
- AvahiClientEntryGroup *tmp = NULL;
+ AvahiEntryGroup *tmp = NULL;
DBusMessage *message = NULL, *reply;
DBusError error;
char *path;
@@ -92,7 +92,7 @@ avahi_entry_group_new (AvahiClient *client, AvahiClientEntryGroupCallback callba
goto fail;
}
- tmp = malloc (sizeof (AvahiClientEntryGroup));
+ tmp = malloc (sizeof (AvahiEntryGroup));
tmp->client = client;
@@ -100,7 +100,7 @@ avahi_entry_group_new (AvahiClient *client, AvahiClientEntryGroupCallback callba
tmp->callback = callback;
tmp->user_data = user_data;
- AVAHI_LLIST_PREPEND(AvahiClientEntryGroup, groups, client->groups, tmp);
+ AVAHI_LLIST_PREPEND(AvahiEntryGroup, groups, client->groups, tmp);
dbus_message_unref (message);
@@ -114,7 +114,7 @@ fail:
}
int
-avahi_entry_group_commit (AvahiClientEntryGroup *group)
+avahi_entry_group_commit (AvahiEntryGroup *group)
{
DBusMessage *message;
DBusError error;
@@ -130,7 +130,7 @@ avahi_entry_group_commit (AvahiClientEntryGroup *group)
}
int
-avahi_entry_group_reset (AvahiClientEntryGroup *group)
+avahi_entry_group_reset (AvahiEntryGroup *group)
{
DBusMessage *message;
@@ -143,7 +143,7 @@ avahi_entry_group_reset (AvahiClientEntryGroup *group)
}
int
-avahi_entry_group_get_state (AvahiClientEntryGroup *group)
+avahi_entry_group_get_state (AvahiEntryGroup *group)
{
DBusMessage *message, *reply;
DBusError error;
@@ -185,19 +185,19 @@ avahi_client_errno (AvahiClient *client)
}
AvahiClient*
-avahi_entry_group_get_client (AvahiClientEntryGroup *group)
+avahi_entry_group_get_client (AvahiEntryGroup *group)
{
return group->client;
}
int
-avahi_entry_group_is_empty (AvahiClientEntryGroup *group)
+avahi_entry_group_is_empty (AvahiEntryGroup *group)
{
return AVAHI_OK;
}
int
-avahi_entry_group_add_service (AvahiClientEntryGroup *group,
+avahi_entry_group_add_service (AvahiEntryGroup *group,
AvahiIfIndex interface,
AvahiProtocol protocol,
const char *name,
@@ -249,7 +249,7 @@ avahi_entry_group_add_service (AvahiClientEntryGroup *group,
}
/* XXX: debug function */
-char* avahi_entry_group_path (AvahiClientEntryGroup *group)
+char* avahi_entry_group_path (AvahiEntryGroup *group)
{
if (group != NULL) return group->path;
else return NULL;
diff --git a/avahi-client/internal.h b/avahi-client/internal.h
index 4feffc0..ad39af3 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(AvahiClientEntryGroup, groups);
- AVAHI_LLIST_HEAD(AvahiClientDomainBrowser, domain_browsers);
- AVAHI_LLIST_HEAD(AvahiClientServiceTypeBrowser, service_type_browsers);
+ AVAHI_LLIST_HEAD(AvahiEntryGroup, groups);
+ AVAHI_LLIST_HEAD(AvahiDomainBrowser, domain_browsers);
+ AVAHI_LLIST_HEAD(AvahiServiceTypeBrowser, service_type_browsers);
};
-struct _AvahiClientEntryGroup {
+struct _AvahiEntryGroup {
char *path;
AvahiClient *client;
- AvahiClientEntryGroupCallback callback;
+ AvahiEntryGroupCallback callback;
void *user_data;
- AVAHI_LLIST_FIELDS(AvahiClientEntryGroup, groups);
+ AVAHI_LLIST_FIELDS(AvahiEntryGroup, groups);
};
-struct _AvahiClientDomainBrowser {
+struct _AvahiDomainBrowser {
char *path;
AvahiClient *client;
- AvahiClientDomainBrowserCallback callback;
+ AvahiDomainBrowserCallback callback;
void *user_data;
- AVAHI_LLIST_FIELDS(AvahiClientDomainBrowser, domain_browsers);
+ AVAHI_LLIST_FIELDS(AvahiDomainBrowser, domain_browsers);
};
-struct _AvahiClientServiceTypeBrowser {
+struct _AvahiServiceTypeBrowser {
char *path;
AvahiClient *client;
- AvahiClientServiceTypeBrowserCallback callback;
+ AvahiServiceTypeBrowserCallback callback;
void *user_data;
- AVAHI_LLIST_FIELDS(AvahiClientServiceTypeBrowser, service_type_browsers);
+ AVAHI_LLIST_FIELDS(AvahiServiceTypeBrowser, service_type_browsers);
};
int avahi_client_set_errno (AvahiClient *client, int error);
-void avahi_entry_group_state_change (AvahiClientEntryGroup *group, int state);
+void avahi_entry_group_state_change (AvahiEntryGroup *group, int state);
DBusHandlerResult avahi_domain_browser_event (AvahiClient *client, AvahiBrowserEvent event, DBusMessage *message);