7 This file is part of avahi.
9 avahi is free software; you can redistribute it and/or modify it
10 under the terms of the GNU Lesser General Public License as
11 published by the Free Software Foundation; either version 2.1 of the
12 License, or (at your option) any later version.
14 avahi is distributed in the hope that it will be useful, but WITHOUT
15 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
16 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
17 Public License for more details.
19 You should have received a copy of the GNU Lesser General Public
20 License along with avahi; if not, write to the Free Software
21 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
27 #include <avahi-common/cdecl.h>
28 #include <avahi-common/address.h>
29 #include <avahi-common/strlst.h>
30 #include <avahi-common/defs.h>
32 /** \file client.h Definitions and functions for the client API over D-Bus */
34 #ifndef DOXYGEN_SHOULD_SKIP_THIS
38 typedef struct _AvahiClient AvahiClient;
40 typedef struct _AvahiEntryGroup AvahiEntryGroup;
42 typedef struct _AvahiDomainBrowser AvahiDomainBrowser;
44 typedef struct _AvahiServiceBrowser AvahiServiceBrowser;
46 typedef struct _AvahiServiceTypeBrowser AvahiServiceTypeBrowser;
48 /** States of a client object, note that AvahiServerStates are also emitted */
50 AVAHI_CLIENT_DISCONNECTED = 100, /**< Lost DBUS connection to the Avahi daemon */
51 AVAHI_CLIENT_RECONNECTED = 101 /**< Regained connection to the daemon, all records need to be re-added */
54 /** The function prototype for the callback of an AvahiClient */
55 typedef void (*AvahiClientCallback) (AvahiClient *s, AvahiClientState state, void* userdata);
57 /** The function prototype for the callback of an AvahiEntryGroup */
58 typedef void (*AvahiEntryGroupCallback) (AvahiEntryGroup *g, AvahiEntryGroupState state, void* userdata);
60 /** The function prototype for the callback of an AvahiDomainBrowser */
61 typedef void (*AvahiDomainBrowserCallback) (AvahiDomainBrowser *b, AvahiIfIndex interface, AvahiProtocol protocol, AvahiBrowserEvent event, char *domain, void *user_data);
63 /** The function prototype for the callback of an AvahiServiceBrowser */
64 typedef void (*AvahiServiceBrowserCallback) (AvahiServiceBrowser *b, AvahiIfIndex interface, AvahiProtocol protocol, AvahiBrowserEvent event, char *name, char *type, char *domain, void *user_data);
66 /** The function prototype for the callback of an AvahiServiceTypeBrowser */
67 typedef void (*AvahiServiceTypeBrowserCallback) (AvahiServiceTypeBrowser *b, AvahiIfIndex interface, AvahiProtocol protocol, AvahiBrowserEvent event, char *type, char *domain, void *user_data);
69 /** Creates a new client instance */
70 AvahiClient* avahi_client_new (AvahiClientCallback callback, void *user_data);
72 /** Get the version of the server */
73 char* avahi_client_get_version_string (AvahiClient*);
76 char* avahi_client_get_host_name (AvahiClient*);
78 /** Get domain name */
79 char* avahi_client_get_domain_name (AvahiClient*);
81 /** Get FQDN domain name */
82 char* avahi_client_get_host_name_fqdn (AvahiClient*);
84 /** Create a new AvahiEntryGroup object */
85 AvahiEntryGroup* avahi_entry_group_new (AvahiClient*, AvahiEntryGroupCallback callback, void *user_data);
87 /** Commit an AvahiEntryGroup */
88 int avahi_entry_group_commit (AvahiEntryGroup*);
90 /** Reset an AvahiEntryGroup */
91 int avahi_entry_group_reset (AvahiEntryGroup*);
93 /** Get an AvahiEntryGroup's state */
94 int avahi_entry_group_get_state (AvahiEntryGroup*);
96 /** Check if an AvahiEntryGroup is empty */
97 int avahi_entry_group_is_empty (AvahiEntryGroup*);
99 /** Get the last error number */
100 int avahi_client_errno (AvahiClient*);
102 /** Get an AvahiEntryGroup's owning client instance */
103 AvahiClient* avahi_entry_group_get_client (AvahiEntryGroup*);
105 /** Add a service, takes an AvahiStringList for text records */
107 avahi_entry_group_add_service (AvahiEntryGroup *group,
108 AvahiIfIndex interface,
109 AvahiProtocol protocol,
115 AvahiStringList *txt);
117 /** Get the D-Bus path of an AvahiEntryGroup object, for debugging purposes only. */
118 char* avahi_entry_group_path (AvahiEntryGroup *);
120 /** Get the D-Bus path of an AvahiDomainBrowser object, for debugging purposes only. */
121 char* avahi_domain_browser_path (AvahiDomainBrowser *);
123 /** Browse for domains on the local network */
124 AvahiDomainBrowser* avahi_domain_browser_new (AvahiClient *client,
125 AvahiIfIndex interface,
126 AvahiProtocol protocol,
128 AvahiDomainBrowserType btype,
129 AvahiDomainBrowserCallback callback,
132 /** Get the D-Bus path of an AvahiServiceTypeBrowser object, for debugging purposes only. */
133 char* avahi_service_type_browser_path (AvahiServiceTypeBrowser *);
135 /** Browse for service types on the local network */
136 AvahiServiceTypeBrowser* avahi_service_type_browser_new (
138 AvahiIfIndex interface,
139 AvahiProtocol protocol,
141 AvahiServiceTypeBrowserCallback callback,
144 /** Get the D-Bus path of an AvahiServiceBrowser object, for debugging purposes only. */
145 char* avahi_service_browser_path (AvahiServiceBrowser *);
147 /** Browse for services of a type on the local network */
148 AvahiServiceBrowser* avahi_service_browser_new (
150 AvahiIfIndex interface,
151 AvahiProtocol protocol,
154 AvahiServiceBrowserCallback callback,
157 #ifndef DOXYGEN_SHOULD_SKIP_THIS