]> git.meshlink.io Git - catta/blob - avahi-client/client.h
* avahi-utils: replace python avahi-browse with a version written in C.
[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 /** \example glib-integration.c Example of how to integrate
37  * avahi use with GLIB/GTK applications */
38
39 AVAHI_C_DECL_BEGIN
40
41 /** A connection context */
42 typedef struct AvahiClient AvahiClient;
43
44 /** States of a client object, a superset of AvahiServerState */
45 typedef enum {
46     AVAHI_CLIENT_S_REGISTERING = AVAHI_SERVER_REGISTERING,
47     AVAHI_CLIENT_S_RUNNING = AVAHI_SERVER_RUNNING,
48     AVAHI_CLIENT_S_COLLISION = AVAHI_SERVER_COLLISION,
49     AVAHI_CLIENT_DISCONNECTED = 100 /**< Lost DBUS connection to the Avahi daemon */
50 } AvahiClientState;
51
52 /** The function prototype for the callback of an AvahiClient */
53 typedef void (*AvahiClientCallback) (AvahiClient *s, AvahiClientState state, void* userdata);
54
55 /** Creates a new client instance */
56 AvahiClient* avahi_client_new (const AvahiPoll *poll_api, AvahiClientCallback callback, void *userdata, int *error);
57
58 /** Free a client instance */
59 void avahi_client_free(AvahiClient *client);
60
61 /** Get the version of the server */
62 const char* avahi_client_get_version_string (AvahiClient*);
63
64 /** Get host name */
65 const char* avahi_client_get_host_name (AvahiClient*);
66
67 /** Get domain name */
68 const char* avahi_client_get_domain_name (AvahiClient*);
69
70 /** Get FQDN domain name */
71 const char* avahi_client_get_host_name_fqdn (AvahiClient*);
72
73 /** Get state */
74 AvahiClientState avahi_client_get_state(AvahiClient *client); 
75
76 /** Get the last error number */
77 int avahi_client_errno (AvahiClient*);
78
79 /** Return the local service cookie. returns AVAHI_SERVICE_COOKIE_INVALID on failure. */
80 uint32_t avahi_client_get_local_service_cookie(AvahiClient *client);
81
82 AVAHI_C_DECL_END
83
84 #endif