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