]> git.meshlink.io Git - catta/blob - avahi-client/client.h
build docs for avahi-core only if --enable-core-docs was passed to configure. Build...
[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 #include <avahi-common/watch.h>
32 #include <avahi-common/gccmacro.h>
33
34 /** \file client.h Definitions and functions for the client API over D-Bus */
35
36 AVAHI_C_DECL_BEGIN
37
38 /** A connection context */
39 typedef struct AvahiClient AvahiClient;
40
41 /** States of a client object, a superset of AvahiServerState */
42 typedef enum {
43     AVAHI_CLIENT_S_REGISTERING = AVAHI_SERVER_REGISTERING,  /**< Server state: REGISTERING */
44     AVAHI_CLIENT_S_RUNNING = AVAHI_SERVER_RUNNING,          /**< Server state: RUNNING */
45     AVAHI_CLIENT_S_COLLISION = AVAHI_SERVER_COLLISION,      /**< Server state: COLLISION */
46     AVAHI_CLIENT_FAILURE = 100,                             /**< Some kind of error happened on the client side */
47     AVAHI_CLIENT_CONNECTING = 101                           /**< We're still connecting. This state is only entered when AVAHI_CLIENT_NO_FAIL has been passed to avahi_client_new() and the daemon is not yet available. */  
48 } AvahiClientState;
49
50 typedef enum {
51     AVAHI_CLIENT_IGNORE_USER_CONFIG = 1, /**< Don't read user configuration */
52     AVAHI_CLIENT_NO_FAIL = 2        /**< Don't fail if the daemon is not available when avahi_client_new() is called, instead enter AVAHI_CLIENT_CONNECTING state and wait for the daemon to appear */
53 } AvahiClientFlags;
54
55 /** The function prototype for the callback of an AvahiClient */
56 typedef void (*AvahiClientCallback) (
57     AvahiClient *s,
58     AvahiClientState state /**< The new state of the client */,
59     void* userdata /**< The user data that was passed to avahi_client_new() */);
60
61 /** Creates a new client instance */
62 AvahiClient* avahi_client_new (
63     const AvahiPoll *poll_api /**< The abstract event loop API to use */,
64     AvahiClientFlags flags /**< Some flags to modify the behaviour of  the client library */,
65     AvahiClientCallback callback /**< A callback that is called whenever the state of the client changes. This may be NULL */,
66     void *userdata /**< Some arbitrary user data pointer that will be passed to the callback function */,
67     int *error /**< If creation of the client fails, this integer will contain the error cause. May be NULL if you aren't interested in the reason why avahi_client_new() failed. */);
68
69 /** Free a client instance. This will automatically free all
70  * associated browser, resolve and entry group objects. All pointers
71  * to such objects become invalid! */
72 void avahi_client_free(AvahiClient *client);
73
74 /** Get the version of the server */
75 const char* avahi_client_get_version_string (AvahiClient*);
76
77 /** Get host name */
78 const char* avahi_client_get_host_name (AvahiClient*);
79
80 /** Get domain name */
81 const char* avahi_client_get_domain_name (AvahiClient*);
82
83 /** Get FQDN domain name */
84 const char* avahi_client_get_host_name_fqdn (AvahiClient*);
85
86 /** Get state */
87 AvahiClientState avahi_client_get_state(AvahiClient *client); 
88
89 /** Get the last error number */
90 int avahi_client_errno (AvahiClient*);
91
92 /** Return the local service cookie. returns AVAHI_SERVICE_COOKIE_INVALID on failure. */
93 uint32_t avahi_client_get_local_service_cookie(AvahiClient *client);
94
95 /** Return 1 if gethostbyname() supports mDNS lookups, 0 otherwise. \since 0.6.5 */
96 int avahi_nss_support(void);
97
98 AVAHI_C_DECL_END
99
100 #endif