]> git.meshlink.io Git - catta/blob - avahi-client/client.h
* Some minor error handling cleanups
[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 _AvahiServiceTypeBrowser AvahiServiceTypeBrowser;
45
46 /** States of a client object, note that AvahiServerStates are also emitted */
47 typedef enum {
48     AVAHI_CLIENT_DISCONNECTED = 100, /**< Lost DBUS connection to the Avahi daemon */
49     AVAHI_CLIENT_RECONNECTED  = 101  /**< Regained connection to the daemon, all records need to be re-added */
50 } AvahiClientState;
51
52 /** The function prototype for the callback of an AvahiClient */
53 typedef void (*AvahiClientCallback) (AvahiClient *s, AvahiClientState state, void* userdata);
54
55 /** The function prototype for the callback of an AvahiEntryGroup */
56 typedef void (*AvahiEntryGroupCallback) (AvahiEntryGroup *g, AvahiEntryGroupState state, void* userdata);
57
58 /** The function prototype for the callback of an AvahiDomainBrowser */
59 typedef void (*AvahiDomainBrowserCallback) (AvahiDomainBrowser *b, AvahiIfIndex interface, AvahiProtocol protocol, AvahiBrowserEvent event, char *domain, void *user_data);
60
61 /** The function prototype for the callback of an AvahiServiceTypeBrowser */
62 typedef void (*AvahiServiceTypeBrowserCallback) (AvahiServiceTypeBrowser *b, AvahiIfIndex interface, AvahiProtocol protocol, AvahiBrowserEvent event, char *type, char *domain, void *user_data);
63
64 /** Creates a new client instance */
65 AvahiClient* avahi_client_new (AvahiClientCallback callback, void *user_data);
66
67 /** Get the version of the server */
68 char* avahi_client_get_version_string (AvahiClient*);
69
70 /** Get host name */
71 char* avahi_client_get_host_name (AvahiClient*);
72
73 /** Get domain name */
74 char* avahi_client_get_domain_name (AvahiClient*);
75
76 /** Get FQDN domain name */
77 char* avahi_client_get_host_name_fqdn (AvahiClient*);
78
79 /** Create a new AvahiEntryGroup object */
80 AvahiEntryGroup* avahi_entry_group_new (AvahiClient*, AvahiEntryGroupCallback callback, void *user_data);
81
82 /** Commit an AvahiEntryGroup */
83 int avahi_entry_group_commit (AvahiEntryGroup*);
84
85 /** Reset an AvahiEntryGroup */
86 int avahi_entry_group_reset (AvahiEntryGroup*);
87
88 /** Get an AvahiEntryGroup's state */
89 int avahi_entry_group_get_state (AvahiEntryGroup*);
90
91 /** Check if an AvahiEntryGroup is empty */
92 int avahi_entry_group_is_empty (AvahiEntryGroup*);
93
94 /** Get the last error number */
95 int avahi_client_errno (AvahiClient*);
96
97 /** Get an AvahiEntryGroup's owning client instance */
98 AvahiClient* avahi_entry_group_get_client (AvahiEntryGroup*);
99
100 /** Add a service, takes an AvahiStringList for text records */
101 int
102 avahi_entry_group_add_service (AvahiEntryGroup *group,
103                                AvahiIfIndex interface,
104                                AvahiProtocol protocol,
105                                const char *name,
106                                const char *type,
107                                const char *domain,
108                                const char *host,
109                                uint16_t port,
110                                AvahiStringList *txt);
111
112 /** Get the D-Bus path of an AvahiEntryGroup object, for debugging purposes only. */
113 char* avahi_entry_group_path (AvahiEntryGroup *);
114
115 /** Get the D-Bus path of an AvahiDomainBrowser object, for debugging purposes only. */
116 char* avahi_domain_browser_path (AvahiDomainBrowser *);
117
118 /** Browse for domains on the local network */
119 AvahiDomainBrowser* avahi_domain_browser_new (AvahiClient *client,
120                                               AvahiIfIndex interface,
121                                               AvahiProtocol protocol,
122                                               char *domain,
123                                               AvahiDomainBrowserType btype,
124                                               AvahiDomainBrowserCallback callback,
125                                               void *user_data);
126
127 /** Get the D-Bus path of an AvahiServiceTypeBrowser object, for debugging purposes only. */
128 char* avahi_service_type_browser_path (AvahiServiceTypeBrowser *);
129
130 /** Browse for service types on the local network */
131 AvahiServiceTypeBrowser* avahi_service_type_browser_new (
132                 AvahiClient *client,
133                 AvahiIfIndex interface,
134                 AvahiProtocol protocol,
135                 char *domain,
136                 AvahiServiceTypeBrowserCallback callback,
137                 void *user_data);
138
139
140 #ifndef DOXYGEN_SHOULD_SKIP_THIS
141 AVAHI_C_DECL_END
142 #endif
143
144 #endif