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