]> git.meshlink.io Git - catta/blob - libavahi-core/avahi.h
move the sources to libavahi-core/
[catta] / libavahi-core / avahi.h
1 #ifndef fooAvahihfoo
2 #define fooAvahihfoo
3
4 #include <stdio.h>
5 #include <glib.h>
6
7 typedef struct _AvahiServer AvahiServer;
8 typedef struct _AvahiEntry AvahiEntry;
9 typedef struct _AvahiEntryGroup AvahiEntryGroup;
10
11 #include "address.h"
12 #include "rr.h"
13
14 typedef enum {
15     AVAHI_ENTRY_NULL = 0,
16     AVAHI_ENTRY_UNIQUE = 1,
17     AVAHI_ENTRY_NOPROBE = 2,
18     AVAHI_ENTRY_NOANNOUNCE = 4
19 } AvahiEntryFlags;
20
21 typedef enum {
22     AVAHI_ENTRY_GROUP_UNCOMMITED,
23     AVAHI_ENTRY_GROUP_REGISTERING,
24     AVAHI_ENTRY_GROUP_ESTABLISHED,
25     AVAHI_ENTRY_GROUP_COLLISION
26 } AvahiEntryGroupState;
27
28 typedef void (*AvahiEntryGroupCallback) (AvahiServer *s, AvahiEntryGroup *g, AvahiEntryGroupState state, gpointer userdata);
29
30 AvahiServer *avahi_server_new(GMainContext *c);
31 void avahi_server_free(AvahiServer* s);
32
33 const AvahiRecord *avahi_server_iterate(AvahiServer *s, AvahiEntryGroup *g, void **state);
34 void avahi_server_dump(AvahiServer *s, FILE *f);
35
36 AvahiEntryGroup *avahi_entry_group_new(AvahiServer *s, AvahiEntryGroupCallback callback, gpointer userdata);
37 void avahi_entry_group_free(AvahiEntryGroup *g);
38 void avahi_entry_group_commit(AvahiEntryGroup *g);
39 AvahiEntryGroupState avahi_entry_group_get_state(AvahiEntryGroup *g);
40
41 void avahi_server_add(
42     AvahiServer *s,
43     AvahiEntryGroup *g,
44     gint interface,
45     guchar protocol,
46     AvahiEntryFlags flags,
47     AvahiRecord *r);
48
49 void avahi_server_add_ptr(
50     AvahiServer *s,
51     AvahiEntryGroup *g,
52     gint interface,
53     guchar protocol,
54     AvahiEntryFlags flags,
55     const gchar *name,
56     const gchar *dest);
57
58 void avahi_server_add_address(
59     AvahiServer *s,
60     AvahiEntryGroup *g,
61     gint interface,
62     guchar protocol,
63     AvahiEntryFlags flags,
64     const gchar *name,
65     AvahiAddress *a);
66
67 void avahi_server_add_text(
68     AvahiServer *s,
69     AvahiEntryGroup *g,
70     gint interface,
71     guchar protocol,
72     AvahiEntryFlags flags,
73     const gchar *name,
74     ... /* text records, terminated by NULL */);
75
76 void avahi_server_add_text_va(
77     AvahiServer *s,
78     AvahiEntryGroup *g,
79     gint interface,
80     guchar protocol,
81     AvahiEntryFlags flags,
82     const gchar *name,
83     va_list va);
84
85 void avahi_server_add_text_strlst(
86     AvahiServer *s,
87     AvahiEntryGroup *g,
88     gint interface,
89     guchar protocol,
90     AvahiEntryFlags flags,
91     const gchar *name,
92     AvahiStringList *strlst);
93
94 void avahi_server_add_service(
95     AvahiServer *s,
96     AvahiEntryGroup *g,
97     gint interface,
98     guchar protocol,
99     const gchar *type,
100     const gchar *name,
101     const gchar *domain,
102     const gchar *host,
103     guint16 port,
104     ...  /* text records, terminated by NULL */);
105
106 void avahi_server_add_service_va(
107     AvahiServer *s,
108     AvahiEntryGroup *g,
109     gint interface,
110     guchar protocol,
111     const gchar *type,
112     const gchar *name,
113     const gchar *domain,
114     const gchar *host,
115     guint16 port,
116     va_list va);
117
118 void avahi_server_add_service_strlst(
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     AvahiStringList *strlst);
129
130 typedef enum {
131     AVAHI_SUBSCRIPTION_NEW,
132     AVAHI_SUBSCRIPTION_REMOVE,
133     AVAHI_SUBSCRIPTION_CHANGE
134 } AvahiSubscriptionEvent;
135
136 typedef struct _AvahiSubscription AvahiSubscription;
137
138 typedef void (*AvahiSubscriptionCallback)(AvahiSubscription *s, AvahiRecord *record, gint interface, guchar protocol, AvahiSubscriptionEvent event, gpointer userdata);
139
140 AvahiSubscription *avahi_subscription_new(AvahiServer *s, AvahiKey *key, gint interface, guchar protocol, AvahiSubscriptionCallback callback, gpointer userdata);
141 void avahi_subscription_free(AvahiSubscription *s);
142
143 #endif