]> git.meshlink.io Git - catta/blob - avahi-core/core.h
rename avahi.h => core.h
[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 AvahiRecord *avahi_server_iterate(AvahiServer *s, AvahiEntryGroup *g, void **state);
55 void avahi_server_dump(AvahiServer *s, FILE *f);
56
57 AvahiEntryGroup *avahi_entry_group_new(AvahiServer *s, AvahiEntryGroupCallback callback, gpointer userdata);
58 void avahi_entry_group_free(AvahiEntryGroup *g);
59 void avahi_entry_group_commit(AvahiEntryGroup *g);
60 AvahiEntryGroupState avahi_entry_group_get_state(AvahiEntryGroup *g);
61
62 void avahi_server_add(
63     AvahiServer *s,
64     AvahiEntryGroup *g,
65     gint interface,
66     guchar protocol,
67     AvahiEntryFlags flags,
68     AvahiRecord *r);
69
70 void avahi_server_add_ptr(
71     AvahiServer *s,
72     AvahiEntryGroup *g,
73     gint interface,
74     guchar protocol,
75     AvahiEntryFlags flags,
76     const gchar *name,
77     const gchar *dest);
78
79 void avahi_server_add_address(
80     AvahiServer *s,
81     AvahiEntryGroup *g,
82     gint interface,
83     guchar protocol,
84     AvahiEntryFlags flags,
85     const gchar *name,
86     AvahiAddress *a);
87
88 void avahi_server_add_text(
89     AvahiServer *s,
90     AvahiEntryGroup *g,
91     gint interface,
92     guchar protocol,
93     AvahiEntryFlags flags,
94     const gchar *name,
95     ... /* text records, terminated by NULL */);
96
97 void avahi_server_add_text_va(
98     AvahiServer *s,
99     AvahiEntryGroup *g,
100     gint interface,
101     guchar protocol,
102     AvahiEntryFlags flags,
103     const gchar *name,
104     va_list va);
105
106 void avahi_server_add_text_strlst(
107     AvahiServer *s,
108     AvahiEntryGroup *g,
109     gint interface,
110     guchar protocol,
111     AvahiEntryFlags flags,
112     const gchar *name,
113     AvahiStringList *strlst);
114
115 void avahi_server_add_service(
116     AvahiServer *s,
117     AvahiEntryGroup *g,
118     gint interface,
119     guchar protocol,
120     const gchar *type,
121     const gchar *name,
122     const gchar *domain,
123     const gchar *host,
124     guint16 port,
125     ...  /* text records, terminated by NULL */);
126
127 void avahi_server_add_service_va(
128     AvahiServer *s,
129     AvahiEntryGroup *g,
130     gint interface,
131     guchar protocol,
132     const gchar *type,
133     const gchar *name,
134     const gchar *domain,
135     const gchar *host,
136     guint16 port,
137     va_list va);
138
139 void avahi_server_add_service_strlst(
140     AvahiServer *s,
141     AvahiEntryGroup *g,
142     gint interface,
143     guchar protocol,
144     const gchar *type,
145     const gchar *name,
146     const gchar *domain,
147     const gchar *host,
148     guint16 port,
149     AvahiStringList *strlst);
150
151 typedef enum {
152     AVAHI_SUBSCRIPTION_NEW,
153     AVAHI_SUBSCRIPTION_REMOVE,
154     AVAHI_SUBSCRIPTION_CHANGE
155 } AvahiSubscriptionEvent;
156
157 typedef struct _AvahiSubscription AvahiSubscription;
158
159 typedef void (*AvahiSubscriptionCallback)(AvahiSubscription *s, AvahiRecord *record, gint interface, guchar protocol, AvahiSubscriptionEvent event, gpointer userdata);
160
161 AvahiSubscription *avahi_subscription_new(AvahiServer *s, AvahiKey *key, gint interface, guchar protocol, AvahiSubscriptionCallback callback, gpointer userdata);
162 void avahi_subscription_free(AvahiSubscription *s);
163
164 #endif