]> git.meshlink.io Git - catta/blobdiff - server.h
Rename flx_* to avahi_*
[catta] / server.h
index f1a15fc9efc4e8ed2c4535f37ceeb2a439f51b81..ba1af789f2b7b5dbc46446d96dff36372d7634cc 100644 (file)
--- a/server.h
+++ b/server.h
@@ -1,77 +1,79 @@
-#ifndef fooflxserverhfoo
-#define fooflxserverhfoo
+#ifndef fooAvahiserverhfoo
+#define fooAvahiserverhfoo
 
-#include "flx.h"
+#include "Avahi.h"
 #include "iface.h"
+#include "prioq.h"
+#include "llist.h"
+#include "timeeventq.h"
+#include "announce.h"
+#include "subscribe.h"
 
-struct _flxEntry;
-typedef struct _flxEntry flxEntry;
-struct _flxEntry {
-    flxRecord rr;
-    gint id;
+struct _AvahiEntry {
+    AvahiServer *server;
+    AvahiEntryGroup *group;
+
+    gboolean dead;
+    
+    AvahiEntryFlags flags;
+    AvahiRecord *record;
     gint interface;
     guchar protocol;
 
-    gboolean unique;
-
-    flxEntry *next, *prev;
-    flxEntry *next_by_name, *prev_by_name;
-    flxEntry *next_by_id, *prev_by_id;
+    AVAHI_LLIST_FIELDS(AvahiEntry, entries);
+    AVAHI_LLIST_FIELDS(AvahiEntry, by_key);
+    AVAHI_LLIST_FIELDS(AvahiEntry, by_group);
+    
+    AVAHI_LLIST_HEAD(AvahiAnnouncement, announcements);
 };
 
-typedef struct _flxQueryJob {
-    gint ref;
-    flxQuery query;
-} flxQueryJob;
+struct _AvahiEntryGroup {
+    AvahiServer *server;
+    gboolean dead;
 
-struct _flxQueryJobInstance;
-typedef struct _flxQueryJobInstance flxQueryJobInstance;
-struct _flxQueryJobInstance {
-    flxQueryJob *job;
-    gint interface;
-    guchar protocol;
-    flxQueryJobInstance *next, *prev;
-};
+    AvahiEntryGroupState state;
+    gpointer userdata;
+    AvahiEntryGroupCallback callback;
 
-typedef struct _flxResponseJob {
-    gint ref;
-    flxRecord response;
-} flxResponseJob;
-
-struct _flxResponseJobInstance;
-typedef struct _flxResponseJobInstance flxResponseJobInstance;
-struct _flxResponseJobInstance {
-    flxResponseJob *job;
-    gint interface;
-    guchar protocol;
-    flxResponseJob *next, *prev;
+    guint n_probing;
+    
+    AVAHI_LLIST_FIELDS(AvahiEntryGroup, groups);
+    AVAHI_LLIST_HEAD(AvahiEntry, entries);
 };
 
-struct _flxServer {
+struct _AvahiServer {
     GMainContext *context;
-    flxInterfaceMonitor *monitor;
+    AvahiInterfaceMonitor *monitor;
+
+    AVAHI_LLIST_HEAD(AvahiEntry, entries);
+    GHashTable *entries_by_key;
+
+    AVAHI_LLIST_HEAD(AvahiEntryGroup, groups);
+    
+    AVAHI_LLIST_HEAD(AvahiSubscription, subscriptions);
+    GHashTable *subscription_hashtable;
 
-    gint current_id;
+    gboolean need_entry_cleanup, need_group_cleanup;
+    
+    AvahiTimeEventQueue *time_event_queue;
     
-    GHashTable *rrset_by_id;
-    GHashTable *rrset_by_name;
+    gchar *hostname;
 
-    flxEntry *entries;
+    gint fd_ipv4, fd_ipv6;
 
-    flxResponseJobInstance *first_response_job, *last_response_job;
-    flxQueryJobInstance *first_query_job, *last_query_job;
-};
+    GPollFD pollfd_ipv4, pollfd_ipv6;
+    GSource *source;
 
-flxQueryJob* flx_query_job_new(void);
-flxQueryJob* flx_query_job_ref(flxQueryJob *job);
-void flx_query_job_unref(flxQueryJob *job);
+    gboolean ignore_bad_ttl;
+};
 
-void flx_server_post_query_job(flxServer *s, gint interface, guchar protocol, const flxQuery *q);
-void flx_server_drop_query_job(flxServer *s, gint interface, guchar protocol, const flxQuery *q);
+gboolean avahi_server_entry_match_interface(AvahiEntry *e, AvahiInterface *i);
 
-void flx_server_remove_query_job_instance(flxServer *s, flxQueryJobInstance *i);
+void avahi_server_post_query(AvahiServer *s, gint interface, guchar protocol, AvahiKey *key);
+void avahi_server_post_response(AvahiServer *s, gint interface, guchar protocol, AvahiRecord *record, gboolean flush_cache);
 
-gboolean flx_query_equal(const flxQuery *a, const flxQuery *b);
+void avahi_entry_group_change_state(AvahiEntryGroup *g, AvahiEntryGroupState state);
 
+gboolean avahi_entry_commited(AvahiEntry *e);
 
 #endif