]> git.meshlink.io Git - catta/blobdiff - flx.h
add support for dots and backslashes in domain names (required for DNS-SD)
[catta] / flx.h
diff --git a/flx.h b/flx.h
index dad707e7bf1ea27d147ff893610f06f7d8b32e4b..d60dede029c39b6c4d67ade7f8ebe22520ce8265 100644 (file)
--- a/flx.h
+++ b/flx.h
@@ -4,63 +4,99 @@
 #include <stdio.h>
 #include <glib.h>
 
-struct _flxServer;
 typedef struct _flxServer flxServer;
 
 #include "address.h"
+#include "rr.h"
 
-typedef struct  {
-    gchar *name;
-    guint16 type;
-    guint16 class;
-    gpointer data;
-    guint16 size;
-    guint32 ttl;
-} flxRecord;
-
-typedef struct {
-    gchar *name;
-    guint16 type;
-    guint16 class;
-} flxQuery;
+typedef enum {
+    FLX_SERVER_ENTRY_NULL = 0,
+    FLX_SERVER_ENTRY_UNIQUE = 1,
+    FLX_SERVER_ENTRY_NOPROBE = 2,
+    FLX_SERVER_ENTRY_NOANNOUNCE = 4
+} flxServerEntryFlags;
 
 flxServer *flx_server_new(GMainContext *c);
 void flx_server_free(flxServer* s);
 
 gint flx_server_get_next_id(flxServer *s);
 
-void flx_server_add_rr(flxServer *s, gint id, gint interface, guchar protocol, const flxRecord *rr);
-void flx_server_add(flxServer *s, gint id, gint interface, guchar protocol, const gchar *name, guint16 type, gconstpointer data, guint size);
-void flx_server_add_address(flxServer *s, gint id, gint interface, guchar protocol, const gchar *name, flxAddress *a);
-void flx_server_add_text(flxServer *s, gint id, gint interface, guchar protocol, const gchar *name, const gchar *text);
+void flx_server_add(
+    flxServer *s,
+    gint id,
+    gint interface,
+    guchar protocol,
+    flxServerEntryFlags flags,
+    flxRecord *r);
+
+void flx_server_add_ptr(
+    flxServer *s,
+    gint id,
+    gint interface,
+    guchar protocol,
+    flxServerEntryFlags flags,
+    const gchar *name,
+    const gchar *dest);
+
+void flx_server_add_address(
+    flxServer *s,
+    gint id,
+    gint interface,
+    guchar protocol,
+    flxServerEntryFlags flags,
+    const gchar *name,
+    flxAddress *a);
+
+void flx_server_add_text(
+    flxServer *s,
+    gint id,
+    gint interface,
+    guchar protocol,
+    flxServerEntryFlags flags,
+    const gchar *name,
+    ... /* text records, terminated by NULL */);
+
+void flx_server_add_text_va(
+    flxServer *s,
+    gint id,
+    gint interface,
+    guchar protocol,
+    flxServerEntryFlags flags,
+    const gchar *name,
+    va_list va);
+
+void flx_server_add_service(
+    flxServer *s,
+    gint id,
+    gint interface,
+    guchar protocol,
+    const gchar *type,
+    const gchar *name,
+    const gchar *domain,
+    const gchar *host,
+    guint16 port,
+    ...  /* text records, terminated by NULL */);
+
+void flx_server_add_service_va(
+    flxServer *s,
+    gint id,
+    gint interface,
+    guchar protocol,
+    const gchar *type,
+    const gchar *name,
+    const gchar *domain,
+    const gchar *host,
+    guint16 port,
+    va_list va);
+
 
 void flx_server_remove(flxServer *s, gint id);
 
-const flxRecord *flx_server_iterate(flxServer *s, gint id, void **state);
+void flx_server_post_query(flxServer *s, gint interface, guchar protocol, flxKey *key);
+void flx_server_post_response(flxServer *s, gint interface, guchar protocol, flxRecord *record, gboolean flush_cache);
 
-flxRecord *flx_record_copy_normalize(flxRecord *ret_dest, const flxRecord*src);
+const flxRecord *flx_server_iterate(flxServer *s, gint id, void **state);
 
 void flx_server_dump(flxServer *s, FILE *f);
 
-struct _flxLocalAddrSource;
-typedef struct _flxLocalAddrSource flxLocalAddrSource;
-
-enum {
-    FLX_DNS_TYPE_A = 0x01,
-    FLX_DNS_TYPE_NS = 0x02,
-    FLX_DNS_TYPE_CNAME = 0x05,
-    FLX_DNS_TYPE_SOA = 0x06,
-    FLX_DNS_TYPE_PTR = 0x0C,
-    FLX_DNS_TYPE_HINFO = 0x0D,
-    FLX_DNS_TYPE_MX = 0x0F,
-    FLX_DNS_TYPE_TXT = 0x10,
-    FLX_DNS_TYPE_AAAA = 0x1C,
-};
-
-enum {
-    FLX_DNS_CLASS_IN = 0x01
-};
-
-#define FLX_DEFAULT_TTL (120*60)
-
 #endif