]> git.meshlink.io Git - catta/blob - avahi-client/internal.h
f4ff938f15e96a38276c259ff107ec6f34c6bfa1
[catta] / avahi-client / internal.h
1 #ifndef foointernalhfoo
2 #define foointernalhfoo
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 <dbus/dbus.h>
26
27 #include "client.h"
28 #include "lookup.h"
29 #include "publish.h"
30
31 struct AvahiClient {
32     const AvahiPoll *poll_api;
33     DBusConnection *bus;
34     int error;
35     AvahiClientState state;
36     AvahiClientFlags flags;
37
38     /* Cache for some seldom changing server data */
39     char *version_string, *host_name, *host_name_fqdn, *domain_name;
40     uint32_t local_service_cookie;
41     int local_service_cookie_valid;
42
43     AvahiClientCallback callback;
44     void *userdata;
45
46     AVAHI_LLIST_HEAD(AvahiEntryGroup, groups);
47     AVAHI_LLIST_HEAD(AvahiDomainBrowser, domain_browsers);
48     AVAHI_LLIST_HEAD(AvahiServiceBrowser, service_browsers);
49     AVAHI_LLIST_HEAD(AvahiServiceTypeBrowser, service_type_browsers);
50     AVAHI_LLIST_HEAD(AvahiServiceResolver, service_resolvers);
51     AVAHI_LLIST_HEAD(AvahiHostNameResolver, host_name_resolvers);
52     AVAHI_LLIST_HEAD(AvahiAddressResolver, address_resolvers);
53     AVAHI_LLIST_HEAD(AvahiRecordBrowser, record_browsers);
54 };
55
56 struct AvahiEntryGroup {
57     char *path;
58     AvahiEntryGroupState state;
59     int state_valid;
60     AvahiClient *client;
61     AvahiEntryGroupCallback callback;
62     void *userdata;
63     AVAHI_LLIST_FIELDS(AvahiEntryGroup, groups);
64 };
65
66 struct AvahiDomainBrowser {
67     int ref;
68
69     char *path;
70     AvahiClient *client;
71     AvahiDomainBrowserCallback callback;
72     void *userdata;
73     AVAHI_LLIST_FIELDS(AvahiDomainBrowser, domain_browsers);
74
75     AvahiIfIndex interface;
76     AvahiProtocol protocol;
77
78     AvahiTimeout *defer_timeout;
79
80     AvahiStringList *static_browse_domains;
81 };
82
83 struct AvahiServiceBrowser {
84     char *path;
85     AvahiClient *client;
86     AvahiServiceBrowserCallback callback;
87     void *userdata;
88     AVAHI_LLIST_FIELDS(AvahiServiceBrowser, service_browsers);
89
90     char *type, *domain;
91     AvahiIfIndex interface;
92     AvahiProtocol protocol;
93 };
94
95 struct AvahiServiceTypeBrowser {
96     char *path;
97     AvahiClient *client;
98     AvahiServiceTypeBrowserCallback callback;
99     void *userdata;
100     AVAHI_LLIST_FIELDS(AvahiServiceTypeBrowser, service_type_browsers);
101
102     char *domain;
103     AvahiIfIndex interface;
104     AvahiProtocol protocol;
105 };
106
107 struct AvahiServiceResolver {
108     char *path;
109     AvahiClient *client;
110     AvahiServiceResolverCallback callback;
111     void *userdata;
112     AVAHI_LLIST_FIELDS(AvahiServiceResolver, service_resolvers);
113
114     char *name, *type, *domain;
115     AvahiIfIndex interface;
116     AvahiProtocol protocol;
117 };
118
119 struct AvahiHostNameResolver {
120     char *path;
121     AvahiClient *client;
122     AvahiHostNameResolverCallback callback;
123     void *userdata;
124     AVAHI_LLIST_FIELDS(AvahiHostNameResolver, host_name_resolvers);
125
126     char *host_name;
127     AvahiIfIndex interface;
128     AvahiProtocol protocol;
129 };
130
131 struct AvahiAddressResolver {
132     char *path;
133     AvahiClient *client;
134     AvahiAddressResolverCallback callback;
135     void *userdata;
136     AVAHI_LLIST_FIELDS(AvahiAddressResolver, address_resolvers);
137
138     AvahiAddress address;
139     AvahiIfIndex interface;
140     AvahiProtocol protocol;
141 };
142
143 struct AvahiRecordBrowser {
144     char *path;
145     AvahiClient *client;
146     AvahiRecordBrowserCallback callback;
147     void *userdata;
148     AVAHI_LLIST_FIELDS(AvahiRecordBrowser, record_browsers);
149
150     char *name;
151     uint16_t clazz, type;
152     AvahiIfIndex interface;
153     AvahiProtocol protocol;
154 };
155
156 int avahi_client_set_errno (AvahiClient *client, int error);
157 int avahi_client_set_dbus_error(AvahiClient *client, DBusError *error);
158
159 void avahi_entry_group_set_state(AvahiEntryGroup *group, AvahiEntryGroupState state);
160
161 DBusHandlerResult avahi_domain_browser_event (AvahiClient *client, AvahiBrowserEvent event, DBusMessage *message);
162 DBusHandlerResult avahi_service_type_browser_event (AvahiClient *client, AvahiBrowserEvent event, DBusMessage *message);
163 DBusHandlerResult avahi_service_browser_event (AvahiClient *client, AvahiBrowserEvent event, DBusMessage *message);
164 DBusHandlerResult avahi_record_browser_event(AvahiClient *client, AvahiBrowserEvent event, DBusMessage *message);
165
166 DBusHandlerResult avahi_service_resolver_event (AvahiClient *client, AvahiResolverEvent event, DBusMessage *message);
167 DBusHandlerResult avahi_host_name_resolver_event (AvahiClient *client, AvahiResolverEvent event, DBusMessage *message);
168 DBusHandlerResult avahi_address_resolver_event (AvahiClient *client, AvahiResolverEvent event, DBusMessage *message);
169
170 int avahi_client_simple_method_call(AvahiClient *client, const char *path, const char *interface, const char *method);
171
172 int avahi_client_is_connected(AvahiClient *client);
173
174 #endif