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 _AvahiClientEntryGroup AvahiClientEntryGroup;
42 typedef struct _AvahiClientDomainBrowser AvahiClientDomainBrowser;
44 typedef struct _AvahiClientServiceTypeBrowser AvahiClientServiceTypeBrowser;
46 /* Convenience typedefs for slight name differences */
47 typedef AvahiDomainBrowserType AvahiClientDomainBrowserType;
48 typedef AvahiEntryGroupState AvahiClientEntryGroupState;
50 /** States of a client object, note that AvahiServerStates are also emitted */
52 AVAHI_CLIENT_DISCONNECTED = 100, /**< Lost DBUS connection to the Avahi daemon */
53 AVAHI_CLIENT_RECONNECTED = 101 /**< Regained connection to the daemon, all records need to be re-added */
56 /** The function prototype for the callback of an AvahiClient */
57 typedef void (*AvahiClientCallback) (AvahiClient *s,
58 AvahiClientState state,
61 /** The function prototype for the callback of an AvahiClientEntryGroup */
62 typedef void (*AvahiClientEntryGroupCallback)
63 (AvahiClientEntryGroup *g,
64 AvahiEntryGroupState state,
67 /** The function prototype for the callback of an AvahiClientDomainBrowser */
68 typedef void (*AvahiClientDomainBrowserCallback)
69 (AvahiClientDomainBrowser *b,
70 AvahiIfIndex interface,
71 AvahiProtocol protocol,
72 AvahiBrowserEvent event,
76 /** The function prototype for the callback of an AvahiClientServiceTypeBrowser */
77 typedef void (*AvahiClientServiceTypeBrowserCallback)
78 (AvahiClientServiceTypeBrowser *b,
79 AvahiIfIndex interface,
80 AvahiProtocol protocol,
81 AvahiBrowserEvent event,
86 /** Creates a new client instance */
87 AvahiClient* avahi_client_new (AvahiClientCallback callback, void *user_data);
89 /** Get the version of the server */
90 char* avahi_client_get_version_string (AvahiClient*);
93 char* avahi_client_get_host_name (AvahiClient*);
95 /** Get domain name */
96 char* avahi_client_get_domain_name (AvahiClient*);
98 /** Get FQDN domain name */
99 char* avahi_client_get_host_name_fqdn (AvahiClient*);
101 /** Create a new AvahiClientEntryGroup object */
102 AvahiClientEntryGroup* avahi_entry_group_new
104 AvahiClientEntryGroupCallback callback,
107 /** Commit an AvahiClientEntryGroup */
108 int avahi_entry_group_commit (AvahiClientEntryGroup*);
110 /** Reset an AvahiClientEntryGroup */
111 int avahi_entry_group_reset (AvahiClientEntryGroup*);
113 /** Get an AvahiClientEntryGroup's state */
114 int avahi_entry_group_get_state (AvahiClientEntryGroup*);
116 /** Check if an AvahiClientEntryGroup is empty */
117 int avahi_entry_group_is_empty (AvahiClientEntryGroup*);
119 /** Get the last error number */
120 int avahi_client_errno (AvahiClient*);
122 /** Get an AvahiClientEntryGroup's owning client instance */
123 AvahiClient* avahi_entry_group_get_client (AvahiClientEntryGroup*);
125 /** Add a service, takes an AvahiStringList for text records */
127 avahi_entry_group_add_service (AvahiClientEntryGroup *group,
128 AvahiIfIndex interface,
129 AvahiProtocol protocol,
135 AvahiStringList *txt);
137 /** Get the D-Bus path of an AvahiClientEntryGroup object, for debugging purposes only. */
138 char* avahi_entry_group_path (AvahiClientEntryGroup *);
140 /** Get the D-Bus path of an AvahiClientDomainBrowser object, for debugging purposes only. */
141 char* avahi_domain_browser_path (AvahiClientDomainBrowser *);
143 /** Browse for domains on the local network */
144 AvahiClientDomainBrowser* avahi_domain_browser_new
145 (AvahiClient *client,
146 AvahiIfIndex interface,
147 AvahiProtocol protocol,
149 AvahiDomainBrowserType btype,
150 AvahiClientDomainBrowserCallback callback,
153 /** Get the D-Bus path of an AvahiClientServiceTypeBrowser object, for debugging purposes only. */
154 char* avahi_service_type_browser_path (AvahiClientServiceTypeBrowser *);
156 /** Browse for service types on the local network */
157 AvahiClientServiceTypeBrowser* avahi_service_type_browser_new (
159 AvahiIfIndex interface,
160 AvahiProtocol protocol,
162 AvahiClientServiceTypeBrowserCallback callback,
166 #ifndef DOXYGEN_SHOULD_SKIP_THIS