]> git.meshlink.io Git - catta/blobdiff - flx.h
Rename flx_* to avahi_*
[catta] / flx.h
diff --git a/flx.h b/flx.h
index ea616472f4e7a3d29f9b1deae184a8b76deb2eb9..1c59faf6313e330c36b2ae281e2773eb6e846ad9 100644 (file)
--- a/flx.h
+++ b/flx.h
-#ifndef fooflxhfoo
-#define fooflxhfoo
+#ifndef fooAvahihfoo
+#define fooAvahihfoo
 
 #include <stdio.h>
 #include <glib.h>
 
-struct _flxServer;
-typedef struct _flxServer flxServer;
+typedef struct _AvahiServer AvahiServer;
+typedef struct _AvahiEntry AvahiEntry;
+typedef struct _AvahiEntryGroup AvahiEntryGroup;
 
 #include "address.h"
 #include "rr.h"
 
-flxServer *flx_server_new(GMainContext *c);
-void flx_server_free(flxServer* s);
+typedef enum {
+    AVAHI_ENTRY_NULL = 0,
+    AVAHI_ENTRY_UNIQUE = 1,
+    AVAHI_ENTRY_NOPROBE = 2,
+    AVAHI_ENTRY_NOANNOUNCE = 4
+} AvahiEntryFlags;
 
-gint flx_server_get_next_id(flxServer *s);
+typedef enum {
+    AVAHI_ENTRY_GROUP_UNCOMMITED,
+    AVAHI_ENTRY_GROUP_REGISTERING,
+    AVAHI_ENTRY_GROUP_ESTABLISHED,
+    AVAHI_ENTRY_GROUP_COLLISION
+} AvahiEntryGroupState;
 
-void flx_server_add(
-    flxServer *s,
-    gint id,
+typedef void (*AvahiEntryGroupCallback) (AvahiServer *s, AvahiEntryGroup *g, AvahiEntryGroupState state, gpointer userdata);
+
+AvahiServer *avahi_server_new(GMainContext *c);
+void avahi_server_free(AvahiServer* s);
+
+const AvahiRecord *avahi_server_iterate(AvahiServer *s, AvahiEntryGroup *g, void **state);
+void avahi_server_dump(AvahiServer *s, FILE *f);
+
+AvahiEntryGroup *avahi_entry_group_new(AvahiServer *s, AvahiEntryGroupCallback callback, gpointer userdata);
+void avahi_entry_group_free(AvahiEntryGroup *g);
+void avahi_entry_group_commit(AvahiEntryGroup *g);
+AvahiEntryGroupState avahi_entry_group_get_state(AvahiEntryGroup *g);
+
+void avahi_server_add(
+    AvahiServer *s,
+    AvahiEntryGroup *g,
     gint interface,
     guchar protocol,
-    gboolean unique,
-    flxRecord *r);
+    AvahiEntryFlags flags,
+    AvahiRecord *r);
 
-void flx_server_add_full(
-    flxServer *s,
-    gint id,
+void avahi_server_add_ptr(
+    AvahiServer *s,
+    AvahiEntryGroup *g,
     gint interface,
     guchar protocol,
-    gboolean unique,
+    AvahiEntryFlags flags,
     const gchar *name,
-    guint16 class,
-    guint16 type,
-    gconstpointer data,
-    guint size,
-    guint32 ttl);
-
-void flx_server_add_address(
-    flxServer *s,
-    gint id,
+    const gchar *dest);
+
+void avahi_server_add_address(
+    AvahiServer *s,
+    AvahiEntryGroup *g,
+    gint interface,
+    guchar protocol,
+    AvahiEntryFlags flags,
+    const gchar *name,
+    AvahiAddress *a);
+
+void avahi_server_add_text(
+    AvahiServer *s,
+    AvahiEntryGroup *g,
+    gint interface,
+    guchar protocol,
+    AvahiEntryFlags flags,
+    const gchar *name,
+    ... /* text records, terminated by NULL */);
+
+void avahi_server_add_text_va(
+    AvahiServer *s,
+    AvahiEntryGroup *g,
+    gint interface,
+    guchar protocol,
+    AvahiEntryFlags flags,
+    const gchar *name,
+    va_list va);
+
+void avahi_server_add_text_strlst(
+    AvahiServer *s,
+    AvahiEntryGroup *g,
+    gint interface,
+    guchar protocol,
+    AvahiEntryFlags flags,
+    const gchar *name,
+    AvahiStringList *strlst);
+
+void avahi_server_add_service(
+    AvahiServer *s,
+    AvahiEntryGroup *g,
+    gint interface,
+    guchar protocol,
+    const gchar *type,
+    const gchar *name,
+    const gchar *domain,
+    const gchar *host,
+    guint16 port,
+    ...  /* text records, terminated by NULL */);
+
+void avahi_server_add_service_va(
+    AvahiServer *s,
+    AvahiEntryGroup *g,
     gint interface,
     guchar protocol,
-    gboolean unique,
+    const gchar *type,
     const gchar *name,
-    flxAddress *a);
+    const gchar *domain,
+    const gchar *host,
+    guint16 port,
+    va_list va);
 
-void flx_server_add_text(
-    flxServer *s,
-    gint id,
+void avahi_server_add_service_strlst(
+    AvahiServer *s,
+    AvahiEntryGroup *g,
     gint interface,
     guchar protocol,
-    gboolean unique,
+    const gchar *type,
     const gchar *name,
-    const gchar *text);
+    const gchar *domain,
+    const gchar *host,
+    guint16 port,
+    AvahiStringList *strlst);
 
-void flx_server_remove(flxServer *s, gint id);
+typedef enum {
+    AVAHI_SUBSCRIPTION_NEW,
+    AVAHI_SUBSCRIPTION_REMOVE,
+    AVAHI_SUBSCRIPTION_CHANGE
+} AvahiSubscriptionEvent;
 
-void flx_server_post_query(flxServer *s, gint interface, guchar protocol, flxKey *k);
+typedef struct _AvahiSubscription AvahiSubscription;
 
-const flxRecord *flx_server_iterate(flxServer *s, gint id, void **state);
+typedef void (*AvahiSubscriptionCallback)(AvahiSubscription *s, AvahiRecord *record, gint interface, guchar protocol, AvahiSubscriptionEvent event, gpointer userdata);
 
-void flx_server_dump(flxServer *s, FILE *f);
+AvahiSubscription *avahi_subscription_new(AvahiServer *s, AvahiKey *key, gint interface, guchar protocol, AvahiSubscriptionCallback callback, gpointer userdata);
+void avahi_subscription_free(AvahiSubscription *s);
 
 #endif