]> git.meshlink.io Git - catta/blob - avahi-client/client.h
de6f207207bb56af868126ab6154e061921fe17a
[catta] / avahi-client / client.h
1 #ifndef fooclienthfoo
2 #define fooclienthfoo
3
4 /* $Id$ */
5
6 /***
7   This file is part of avahi.
8  
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.
13  
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.
18  
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
22   USA.
23 ***/
24
25 #include <inttypes.h>
26
27 #include <avahi-common/cdecl.h>
28 #include <avahi-common/address.h>
29 #include <avahi-common/strlst.h>
30 #include <avahi-common/defs.h>
31 #include <avahi-common/watch.h>
32
33 /** \file client.h Definitions and functions for the client API over D-Bus */
34
35 #ifndef DOXYGEN_SHOULD_SKIP_THIS
36 AVAHI_C_DECL_BEGIN
37 #endif
38
39 typedef struct _AvahiClient AvahiClient;
40
41 typedef struct _AvahiEntryGroup AvahiEntryGroup;
42
43 typedef struct _AvahiDomainBrowser AvahiDomainBrowser;
44
45 typedef struct _AvahiServiceBrowser AvahiServiceBrowser;
46
47 typedef struct _AvahiServiceTypeBrowser AvahiServiceTypeBrowser;
48
49 /** States of a client object, note that AvahiServerStates are also emitted */
50 typedef enum {
51     AVAHI_CLIENT_DISCONNECTED = 100, /**< Lost DBUS connection to the Avahi daemon */
52     AVAHI_CLIENT_RECONNECTED  = 101  /**< Regained connection to the daemon, all records need to be re-added */
53 } AvahiClientState;
54
55 /** The function prototype for the callback of an AvahiClient */
56 typedef void (*AvahiClientCallback) (AvahiClient *s, AvahiClientState state, void* userdata);
57
58 /** The function prototype for the callback of an AvahiEntryGroup */
59 typedef void (*AvahiEntryGroupCallback) (AvahiEntryGroup *g, AvahiEntryGroupState state, void* userdata);
60
61 /** The function prototype for the callback of an AvahiDomainBrowser */
62 typedef void (*AvahiDomainBrowserCallback) (AvahiDomainBrowser *b, AvahiIfIndex interface, AvahiProtocol protocol, AvahiBrowserEvent event, const char *domain, void *user_data);
63
64 /** The function prototype for the callback of an AvahiServiceBrowser */
65 typedef void (*AvahiServiceBrowserCallback) (AvahiServiceBrowser *b, AvahiIfIndex interface, AvahiProtocol protocol, AvahiBrowserEvent event, const char *name, const char *type, const char *domain, void *user_data);
66
67 /** The function prototype for the callback of an AvahiServiceTypeBrowser */
68 typedef void (*AvahiServiceTypeBrowserCallback) (AvahiServiceTypeBrowser *b, AvahiIfIndex interface, AvahiProtocol protocol, AvahiBrowserEvent event, const char *type, const char *domain, void *user_data);
69
70 /** Creates a new client instance */
71 AvahiClient* avahi_client_new (const AvahiPoll *poll_api, AvahiClientCallback callback, void *user_data);
72
73 /** Get the version of the server */
74 char* avahi_client_get_version_string (AvahiClient*);
75
76 /** Get host name */
77 char* avahi_client_get_host_name (AvahiClient*);
78
79 /** Get domain name */
80 char* avahi_client_get_domain_name (AvahiClient*);
81
82 /** Get FQDN domain name */
83 char* avahi_client_get_host_name_fqdn (AvahiClient*);
84
85 /** Create a new AvahiEntryGroup object */
86 AvahiEntryGroup* avahi_entry_group_new (AvahiClient*, AvahiEntryGroupCallback callback, void *user_data);
87
88 /** Clean up and free an AvahiEntryGroup object */
89 int avahi_entry_group_free (AvahiEntryGroup *);
90
91 /** Commit an AvahiEntryGroup */
92 int avahi_entry_group_commit (AvahiEntryGroup*);
93
94 /** Reset an AvahiEntryGroup */
95 int avahi_entry_group_reset (AvahiEntryGroup*);
96
97 /** Get an AvahiEntryGroup's state */
98 int avahi_entry_group_get_state (AvahiEntryGroup*);
99
100 /** Check if an AvahiEntryGroup is empty */
101 int avahi_entry_group_is_empty (AvahiEntryGroup*);
102
103 /** Get the last error number */
104 int avahi_client_errno (AvahiClient*);
105
106 /** Get an AvahiEntryGroup's owning client instance */
107 AvahiClient* avahi_entry_group_get_client (AvahiEntryGroup*);
108
109 /** Add a service, takes an AvahiStringList for text records */
110 int
111 avahi_entry_group_add_service (AvahiEntryGroup *group,
112                                AvahiIfIndex interface,
113                                AvahiProtocol protocol,
114                                const char *name,
115                                const char *type,
116                                const char *domain,
117                                const char *host,
118                                uint16_t port,
119                                AvahiStringList *txt);
120
121 /** Get the D-Bus path of an AvahiEntryGroup object, for debugging purposes only. */
122 const char* avahi_entry_group_path (AvahiEntryGroup *);
123
124 /** Browse for domains on the local network */
125 AvahiDomainBrowser* avahi_domain_browser_new (AvahiClient *client,
126                                               AvahiIfIndex interface,
127                                               AvahiProtocol protocol,
128                                               const char *domain,
129                                               AvahiDomainBrowserType btype,
130                                               AvahiDomainBrowserCallback callback,
131                                               void *user_data);
132
133 /** Get the D-Bus path of an AvahiDomainBrowser object, for debugging purposes only. */
134 const char* avahi_domain_browser_path (AvahiDomainBrowser *);
135
136 /** Cleans up and frees an AvahiDomainBrowser object */
137 int avahi_domain_browser_free (AvahiDomainBrowser *);
138
139 /** Browse for service types on the local network */
140 AvahiServiceTypeBrowser* avahi_service_type_browser_new (
141                 AvahiClient *client,
142                 AvahiIfIndex interface,
143                 AvahiProtocol protocol,
144                 const char *domain,
145                 AvahiServiceTypeBrowserCallback callback,
146                 void *user_data);
147
148 /** Get the D-Bus path of an AvahiServiceTypeBrowser object, for debugging purposes only. */
149 const char* avahi_service_type_browser_path (AvahiServiceTypeBrowser *);
150
151 /** Cleans up and frees an AvahiServiceTypeBrowser object */
152 int avahi_service_type_browser_free (AvahiServiceTypeBrowser *);
153
154 /** Browse for services of a type on the local network */
155 AvahiServiceBrowser* avahi_service_browser_new (
156                 AvahiClient *client,
157                 AvahiIfIndex interface,
158                 AvahiProtocol protocol,
159                 const char *type,
160                 const char *domain,
161                 AvahiServiceBrowserCallback callback,
162                 void *user_data);
163
164 /** Get the D-Bus path of an AvahiServiceBrowser object, for debugging purposes only. */
165 const char* avahi_service_browser_path (AvahiServiceBrowser *);
166
167 /* Cleans up and frees an AvahiServiceBrowser object */
168 int avahi_service_browser_free (AvahiServiceBrowser *);
169
170 #ifndef DOXYGEN_SHOULD_SKIP_THIS
171 AVAHI_C_DECL_END
172 #endif
173
174 #endif