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