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