7 This file is part of avahi.
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.
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.
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
25 #include <avahi-common/cdecl.h>
26 #include <avahi-common/address.h>
27 #include <avahi-common/strlst.h>
28 #include <avahi-common/defs.h>
30 /** \file client.h Definitions and functions for the client API over D-Bus */
32 #ifndef DOXYGEN_SHOULD_SKIP_THIS
36 typedef struct _AvahiClient AvahiClient;
38 typedef struct _AvahiEntryGroup AvahiEntryGroup;
40 /** States of a client object, note that AvahiServerStates are also emitted */
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 */
46 typedef void (*AvahiClientCallback) (AvahiClient *s, AvahiClientState state, void* userdata);
48 typedef void (*AvahiEntryGroupCallback) (AvahiClient *s, AvahiEntryGroup *g, AvahiEntryGroupState state, void* userdata);
50 /** Creates a new client instance */
51 AvahiClient* avahi_client_new (AvahiClientCallback callback, void *user_data);
53 /** Get the version of the server */
54 char* avahi_client_get_version_string (AvahiClient*);
57 char* avahi_client_get_host_name (AvahiClient*);
59 /** Get domain name */
60 char* avahi_client_get_domain_name (AvahiClient*);
62 /** Get FQDN domain name */
63 char* avahi_client_get_host_name_fqdn (AvahiClient*);
65 /** Create a new AvahiEntryGroup object */
66 AvahiEntryGroup* avahi_entry_group_new (AvahiClient*, AvahiEntryGroupCallback callback, void *user_data);
68 /** Commit an AvahiEntryGroup */
69 int avahi_entry_group_commit (AvahiEntryGroup*);
71 /** Reset an AvahiEntryGroup */
72 int avahi_entry_group_reset (AvahiEntryGroup*);
74 /** Get an AvahiEntryGroup's state */
75 int avahi_entry_group_state (AvahiEntryGroup*);
77 /** Check if an AvahiEntryGroup is empty */
78 int avahi_entry_group_is_empty (AvahiEntryGroup*);
80 /** Get the last error number */
81 int avahi_client_errno (AvahiClient*);
83 /** Get an AvahiEntryGroup's owning client instance */
84 AvahiClient* avahi_entry_group_get_client (AvahiEntryGroup*);
86 /** Add a service, takes an AvahiStringList for text records */
88 avahi_entry_group_add_service (AvahiEntryGroup *group,
89 AvahiIfIndex interface,
90 AvahiProtocol protocol,
96 AvahiStringList *txt);
98 /** Get the D-Bus path of an AvahiEntryGroup object, for debugging purposes only. */
99 char* avahi_entry_group_get_path (AvahiEntryGroup *);
101 #ifndef DOXYGEN_SHOULD_SKIP_THIS