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