1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
|
#ifndef foointernalhfoo
#define foointernalhfoo
/* $Id$ */
/***
This file is part of avahi.
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
USA.
***/
#include <dbus/dbus.h>
#include "client.h"
#include "lookup.h"
#include "publish.h"
struct AvahiClient {
const AvahiPoll *poll_api;
DBusConnection *bus;
int error;
AvahiClientState state;
AvahiClientFlags flags;
/* Cache for some seldom changing server data */
char *version_string, *host_name, *host_name_fqdn, *domain_name;
uint32_t local_service_cookie;
int local_service_cookie_valid;
AvahiClientCallback callback;
void *userdata;
AVAHI_LLIST_HEAD(AvahiEntryGroup, groups);
AVAHI_LLIST_HEAD(AvahiDomainBrowser, domain_browsers);
AVAHI_LLIST_HEAD(AvahiServiceBrowser, service_browsers);
AVAHI_LLIST_HEAD(AvahiServiceTypeBrowser, service_type_browsers);
AVAHI_LLIST_HEAD(AvahiServiceResolver, service_resolvers);
AVAHI_LLIST_HEAD(AvahiHostNameResolver, host_name_resolvers);
AVAHI_LLIST_HEAD(AvahiAddressResolver, address_resolvers);
AVAHI_LLIST_HEAD(AvahiRecordBrowser, record_browsers);
};
struct AvahiEntryGroup {
char *path;
AvahiEntryGroupState state;
int state_valid;
AvahiClient *client;
AvahiEntryGroupCallback callback;
void *userdata;
AVAHI_LLIST_FIELDS(AvahiEntryGroup, groups);
};
struct AvahiDomainBrowser {
int ref;
char *path;
AvahiClient *client;
AvahiDomainBrowserCallback callback;
void *userdata;
AVAHI_LLIST_FIELDS(AvahiDomainBrowser, domain_browsers);
AvahiIfIndex interface;
AvahiProtocol protocol;
AvahiTimeout *defer_timeout;
AvahiStringList *static_browse_domains;
};
struct AvahiServiceBrowser {
char *path;
AvahiClient *client;
AvahiServiceBrowserCallback callback;
void *userdata;
AVAHI_LLIST_FIELDS(AvahiServiceBrowser, service_browsers);
char *type, *domain;
AvahiIfIndex interface;
AvahiProtocol protocol;
};
struct AvahiServiceTypeBrowser {
char *path;
AvahiClient *client;
AvahiServiceTypeBrowserCallback callback;
void *userdata;
AVAHI_LLIST_FIELDS(AvahiServiceTypeBrowser, service_type_browsers);
char *domain;
AvahiIfIndex interface;
AvahiProtocol protocol;
};
struct AvahiServiceResolver {
char *path;
AvahiClient *client;
AvahiServiceResolverCallback callback;
void *userdata;
AVAHI_LLIST_FIELDS(AvahiServiceResolver, service_resolvers);
char *name, *type, *domain;
AvahiIfIndex interface;
AvahiProtocol protocol;
};
struct AvahiHostNameResolver {
char *path;
AvahiClient *client;
AvahiHostNameResolverCallback callback;
void *userdata;
AVAHI_LLIST_FIELDS(AvahiHostNameResolver, host_name_resolvers);
char *host_name;
AvahiIfIndex interface;
AvahiProtocol protocol;
};
struct AvahiAddressResolver {
char *path;
AvahiClient *client;
AvahiAddressResolverCallback callback;
void *userdata;
AVAHI_LLIST_FIELDS(AvahiAddressResolver, address_resolvers);
AvahiAddress address;
AvahiIfIndex interface;
AvahiProtocol protocol;
};
struct AvahiRecordBrowser {
char *path;
AvahiClient *client;
AvahiRecordBrowserCallback callback;
void *userdata;
AVAHI_LLIST_FIELDS(AvahiRecordBrowser, record_browsers);
char *name;
uint16_t clazz, type;
AvahiIfIndex interface;
AvahiProtocol protocol;
};
int avahi_client_set_errno (AvahiClient *client, int error);
int avahi_client_set_dbus_error(AvahiClient *client, DBusError *error);
void avahi_entry_group_set_state(AvahiEntryGroup *group, AvahiEntryGroupState state);
DBusHandlerResult avahi_domain_browser_event (AvahiClient *client, AvahiBrowserEvent event, DBusMessage *message);
DBusHandlerResult avahi_service_type_browser_event (AvahiClient *client, AvahiBrowserEvent event, DBusMessage *message);
DBusHandlerResult avahi_service_browser_event (AvahiClient *client, AvahiBrowserEvent event, DBusMessage *message);
DBusHandlerResult avahi_record_browser_event(AvahiClient *client, AvahiBrowserEvent event, DBusMessage *message);
DBusHandlerResult avahi_service_resolver_event (AvahiClient *client, AvahiResolverEvent event, DBusMessage *message);
DBusHandlerResult avahi_host_name_resolver_event (AvahiClient *client, AvahiResolverEvent event, DBusMessage *message);
DBusHandlerResult avahi_address_resolver_event (AvahiClient *client, AvahiResolverEvent event, DBusMessage *message);
int avahi_client_simple_method_call(AvahiClient *client, const char *path, const char *interface, const char *method);
int avahi_client_is_connected(AvahiClient *client);
#endif
|