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 /** Clean up and free an AvahiEntryGroup object */
88 int avahi_entry_group_free (AvahiEntryGroup *);
90 /** Commit an AvahiEntryGroup */
91 int avahi_entry_group_commit (AvahiEntryGroup*);
93 /** Reset an AvahiEntryGroup */
94 int avahi_entry_group_reset (AvahiEntryGroup*);
96 /** Get an AvahiEntryGroup's state */
97 int avahi_entry_group_get_state (AvahiEntryGroup*);
99 /** Check if an AvahiEntryGroup is empty */
100 int avahi_entry_group_is_empty (AvahiEntryGroup*);
102 /** Get the last error number */
103 int avahi_client_errno (AvahiClient*);
105 /** Get an AvahiEntryGroup's owning client instance */
106 AvahiClient* avahi_entry_group_get_client (AvahiEntryGroup*);
108 /** Add a service, takes an AvahiStringList for text records */
110 avahi_entry_group_add_service (AvahiEntryGroup *group,
111 AvahiIfIndex interface,
112 AvahiProtocol protocol,
118 AvahiStringList *txt);
120 /** Get the D-Bus path of an AvahiEntryGroup object, for debugging purposes only. */
121 char* avahi_entry_group_path (AvahiEntryGroup *);
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 AvahiDomainBrowser object, for debugging purposes only. */
133 char* avahi_domain_browser_path (AvahiDomainBrowser *);
135 /** Cleans up and frees an AvahiDomainBrowser object */
136 int avahi_domain_browser_free (AvahiDomainBrowser *);
138 /** Browse for service types on the local network */
139 AvahiServiceTypeBrowser* avahi_service_type_browser_new (
141 AvahiIfIndex interface,
142 AvahiProtocol protocol,
144 AvahiServiceTypeBrowserCallback callback,
147 /** Get the D-Bus path of an AvahiServiceTypeBrowser object, for debugging purposes only. */
148 char* avahi_service_type_browser_path (AvahiServiceTypeBrowser *);
150 /** Cleans up and frees an AvahiServiceTypeBrowser object */
151 int avahi_service_type_browser_free (AvahiServiceTypeBrowser *);
153 /** Browse for services of a type on the local network */
154 AvahiServiceBrowser* avahi_service_browser_new (
156 AvahiIfIndex interface,
157 AvahiProtocol protocol,
160 AvahiServiceBrowserCallback callback,
163 /** Get the D-Bus path of an AvahiServiceBrowser object, for debugging purposes only. */
164 char* avahi_service_browser_path (AvahiServiceBrowser *);
166 /* Cleans up and frees an AvahiServiceBrowser object */
167 int avahi_service_browser_free (AvahiServiceBrowser *);
169 #ifndef DOXYGEN_SHOULD_SKIP_THIS