#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;
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;
}
char*
-avahi_domain_browser_path (AvahiClientDomainBrowser *b)
+avahi_domain_browser_path (AvahiDomainBrowser *b)
{
return b->path;
}
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;
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;
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;
}
char*
-avahi_service_type_browser_path (AvahiClientServiceTypeBrowser *b)
+avahi_service_type_browser_path (AvahiServiceTypeBrowser *b)
{
return b->path;
}
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;
}
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);
}
{
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);
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)
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);
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 {
} 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);
/** 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,
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);
#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;
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;
goto fail;
}
- tmp = malloc (sizeof (AvahiClientEntryGroup));
+ tmp = malloc (sizeof (AvahiEntryGroup));
tmp->client = client;
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);
}
int
-avahi_entry_group_commit (AvahiClientEntryGroup *group)
+avahi_entry_group_commit (AvahiEntryGroup *group)
{
DBusMessage *message;
DBusError error;
}
int
-avahi_entry_group_reset (AvahiClientEntryGroup *group)
+avahi_entry_group_reset (AvahiEntryGroup *group)
{
DBusMessage *message;
}
int
-avahi_entry_group_get_state (AvahiClientEntryGroup *group)
+avahi_entry_group_get_state (AvahiEntryGroup *group)
{
DBusMessage *message, *reply;
DBusError error;
}
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,
}
/* 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;
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);