]> git.meshlink.io Git - catta/blob - avahi-core/core.h
* case insensitive name comparisons
[catta] / avahi-core / core.h
1 #ifndef foocorehfoo
2 #define foocorehfoo
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 <stdio.h>
26 #include <glib.h>
27
28 typedef struct AvahiServer AvahiServer;
29 typedef struct AvahiEntry AvahiEntry;
30 typedef struct AvahiEntryGroup AvahiEntryGroup;
31
32 #include <avahi-core/address.h>
33 #include <avahi-core/rr.h>
34
35 typedef enum {
36     AVAHI_ENTRY_NULL = 0,
37     AVAHI_ENTRY_UNIQUE = 1,
38     AVAHI_ENTRY_NOPROBE = 2,
39     AVAHI_ENTRY_NOANNOUNCE = 4
40 } AvahiEntryFlags;
41
42 typedef enum {
43     AVAHI_ENTRY_GROUP_UNCOMMITED,
44     AVAHI_ENTRY_GROUP_REGISTERING,
45     AVAHI_ENTRY_GROUP_ESTABLISHED,
46     AVAHI_ENTRY_GROUP_COLLISION
47 } AvahiEntryGroupState;
48
49 typedef void (*AvahiEntryGroupCallback) (AvahiServer *s, AvahiEntryGroup *g, AvahiEntryGroupState state, gpointer userdata);
50
51 AvahiServer *avahi_server_new(GMainContext *c);
52 void avahi_server_free(AvahiServer* s);
53
54 const gchar* avahi_server_get_domain(AvahiServer *s);
55 const gchar* avahi_server_get_host_name(AvahiServer *s);
56
57 const AvahiRecord *avahi_server_iterate(AvahiServer *s, AvahiEntryGroup *g, void **state);
58 void avahi_server_dump(AvahiServer *s, FILE *f);
59
60 AvahiEntryGroup *avahi_entry_group_new(AvahiServer *s, AvahiEntryGroupCallback callback, gpointer userdata);
61 void avahi_entry_group_free(AvahiEntryGroup *g);
62 void avahi_entry_group_commit(AvahiEntryGroup *g);
63 AvahiEntryGroupState avahi_entry_group_get_state(AvahiEntryGroup *g);
64
65 void avahi_server_add(
66     AvahiServer *s,
67     AvahiEntryGroup *g,
68     gint interface,
69     guchar protocol,
70     AvahiEntryFlags flags,
71     AvahiRecord *r);
72
73 void avahi_server_add_ptr(
74     AvahiServer *s,
75     AvahiEntryGroup *g,
76     gint interface,
77     guchar protocol,
78     AvahiEntryFlags flags,
79     const gchar *name,
80     const gchar *dest);
81
82 void avahi_server_add_address(
83     AvahiServer *s,
84     AvahiEntryGroup *g,
85     gint interface,
86     guchar protocol,
87     AvahiEntryFlags flags,
88     const gchar *name,
89     AvahiAddress *a);
90
91 void avahi_server_add_text(
92     AvahiServer *s,
93     AvahiEntryGroup *g,
94     gint interface,
95     guchar protocol,
96     AvahiEntryFlags flags,
97     const gchar *name,
98     ... /* text records, terminated by NULL */);
99
100 void avahi_server_add_text_va(
101     AvahiServer *s,
102     AvahiEntryGroup *g,
103     gint interface,
104     guchar protocol,
105     AvahiEntryFlags flags,
106     const gchar *name,
107     va_list va);
108
109 void avahi_server_add_text_strlst(
110     AvahiServer *s,
111     AvahiEntryGroup *g,
112     gint interface,
113     guchar protocol,
114     AvahiEntryFlags flags,
115     const gchar *name,
116     AvahiStringList *strlst);
117
118 void avahi_server_add_service(
119     AvahiServer *s,
120     AvahiEntryGroup *g,
121     gint interface,
122     guchar protocol,
123     const gchar *type,
124     const gchar *name,
125     const gchar *domain,
126     const gchar *host,
127     guint16 port,
128     ...  /* text records, terminated by NULL */);
129
130 void avahi_server_add_service_va(
131     AvahiServer *s,
132     AvahiEntryGroup *g,
133     gint interface,
134     guchar protocol,
135     const gchar *type,
136     const gchar *name,
137     const gchar *domain,
138     const gchar *host,
139     guint16 port,
140     va_list va);
141
142 void avahi_server_add_service_strlst(
143     AvahiServer *s,
144     AvahiEntryGroup *g,
145     gint interface,
146     guchar protocol,
147     const gchar *type,
148     const gchar *name,
149     const gchar *domain,
150     const gchar *host,
151     guint16 port,
152     AvahiStringList *strlst);
153
154 typedef enum {
155     AVAHI_SUBSCRIPTION_NEW,
156     AVAHI_SUBSCRIPTION_REMOVE,
157 } AvahiSubscriptionEvent;
158
159 typedef struct AvahiSubscription AvahiSubscription;
160
161 typedef void (*AvahiSubscriptionCallback)(AvahiSubscription *s, AvahiRecord *record, gint interface, guchar protocol, AvahiSubscriptionEvent event, gpointer userdata);
162
163 AvahiSubscription *avahi_subscription_new(AvahiServer *s, AvahiKey *key, gint interface, guchar protocol, AvahiSubscriptionCallback callback, gpointer userdata);
164 void avahi_subscription_free(AvahiSubscription *s);
165
166 #endif