X-Git-Url: http://git.meshlink.io/?a=blobdiff_plain;f=server.h;h=f90bfe77aaa11e009ca7b63f2e884417502cb74b;hb=ba8547ee3f34d8fe7bedb559530b2c0374f2089c;hp=4134638dd6fd88d5dae95d787f9bf1142d4c076c;hpb=927f8b06fe3550f45c8d7b119acaa77d9b22888c;p=catta diff --git a/server.h b/server.h index 4134638..f90bfe7 100644 --- a/server.h +++ b/server.h @@ -1,75 +1,55 @@ #ifndef fooflxserverhfoo #define fooflxserverhfoo +typedef struct _flxServerEntry flxServerEntry; + #include "flx.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; +struct _flxServerEntry { + flxRecord *record; gint id; gint interface; guchar protocol; - gboolean unique; + flxServerEntryFlags flags; - flxEntry *next, *prev; - flxEntry *next_by_name, *prev_by_name; - flxEntry *next_by_id, *prev_by_id; + FLX_LLIST_FIELDS(flxServerEntry, entry); + FLX_LLIST_FIELDS(flxServerEntry, by_key); + FLX_LLIST_FIELDS(flxServerEntry, by_id); + + FLX_LLIST_HEAD(flxAnnouncement, announcements); }; -typedef struct _flxQueryJob { - gint ref; - GTimeVal time; - flxQuery query; -} flxQueryJob; - -typedef struct _flxQueryJobInstance { - flxPrioQueueNode *node; - flxQueryJob *job; - gint interface; - guchar protocol; -} flxQueryJobInstance; - -typedef struct _flxResponseJob { - gint ref; - GTimeVal time; - flxRecord response; -} flxResponseJob; - -typedef struct _flxResponseJobInstance { - flxPrioQueueNode *node; - flxResponseJob *job; - gint interface; - guchar protocol; -} flxResponseJobInstance; - struct _flxServer { GMainContext *context; flxInterfaceMonitor *monitor; gint current_id; + FLX_LLIST_HEAD(flxServerEntry, entries); GHashTable *rrset_by_id; - GHashTable *rrset_by_name; + GHashTable *rrset_by_key; - flxEntry *entries; - - flxPrioQueue *query_job_queue; - flxPrioQueue *response_job_queue; -}; + FLX_LLIST_HEAD(flxSubscription, subscriptions); + GHashTable *subscription_hashtable; -flxQueryJob* flx_query_job_new(void); -flxQueryJob* flx_query_job_ref(flxQueryJob *job); -void flx_query_job_unref(flxQueryJob *job); + flxTimeEventQueue *time_event_queue; + + gchar *hostname; -void flx_server_post_query_job(flxServer *s, gint interface, guchar protocol, const GTimeVal *tv, const flxQuery *q); -void flx_server_drop_query_job(flxServer *s, gint interface, guchar protocol, const flxQuery *q); + gint fd_ipv4, fd_ipv6; -void flx_server_remove_query_job_instance(flxServer *s, flxQueryJobInstance *i); + GPollFD pollfd_ipv4, pollfd_ipv6; + GSource *source; + +}; -gboolean flx_query_equal(const flxQuery *a, const flxQuery *b); +gboolean flx_server_entry_match_interface(flxServerEntry *e, flxInterface *i); #endif