X-Git-Url: http://git.meshlink.io/?a=blobdiff_plain;f=server.h;h=63f2bf6557704d4ae32fae456c5fba070a17c469;hb=f0f4bb0c37eeed71934e3191cffa5afb1cfdca0d;hp=4134638dd6fd88d5dae95d787f9bf1142d4c076c;hpb=927f8b06fe3550f45c8d7b119acaa77d9b22888c;p=catta diff --git a/server.h b/server.h index 4134638..63f2bf6 100644 --- a/server.h +++ b/server.h @@ -1,50 +1,33 @@ #ifndef fooflxserverhfoo #define fooflxserverhfoo +typedef struct _flxEntry flxEntry; +typedef struct _flxResponseJob flxResponseJob; + #include "flx.h" #include "iface.h" #include "prioq.h" +#include "llist.h" +#include "timeeventq.h" -struct _flxEntry; -typedef struct _flxEntry flxEntry; struct _flxEntry { - flxRecord rr; + flxRecord *record; gint id; gint interface; guchar protocol; gboolean unique; - flxEntry *next, *prev; - flxEntry *next_by_name, *prev_by_name; - flxEntry *next_by_id, *prev_by_id; + FLX_LLIST_FIELDS(flxEntry, entry); + FLX_LLIST_FIELDS(flxEntry, by_name); + FLX_LLIST_FIELDS(flxEntry, by_id); }; -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 _flxResponseJob { + flxTimeEvent *time_event; + flxRecord *record; + FLX_LLIST_FIELDS(flxResponseJob, response); +}; struct _flxServer { GMainContext *context; @@ -55,21 +38,18 @@ struct _flxServer { GHashTable *rrset_by_id; GHashTable *rrset_by_name; - flxEntry *entries; - - flxPrioQueue *query_job_queue; - flxPrioQueue *response_job_queue; -}; + FLX_LLIST_HEAD(flxEntry, entries); -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); #endif