X-Git-Url: http://git.meshlink.io/?a=blobdiff_plain;f=server.h;fp=server.h;h=982143b038bf48d56222b76aa3a38efd5fb49c2d;hb=0781d5363fb6fd723a2316fc7558aef6439b2f71;hp=daaa815ebd967cc129f63b2f8a81494762ebb3b0;hpb=d6e2dbabccb08970da991e6d2b0fda7a56d83e6f;p=catta diff --git a/server.h b/server.h index daaa815..982143b 100644 --- a/server.h +++ b/server.h @@ -1,51 +1,33 @@ #ifndef fooflxserverhfoo #define fooflxserverhfoo -struct _flxEntry; 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 { - 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; @@ -56,25 +38,12 @@ struct _flxServer { GHashTable *rrset_by_id; GHashTable *rrset_by_name; - flxEntry *entries; - - flxPrioQueue *query_job_queue; - flxPrioQueue *response_job_queue; - - gint hinfo_rr_id; + FLX_LLIST_HEAD(flxEntry, entries); + flxTimeEventQueue *time_event_queue; + gchar *hostname; }; -flxQueryJob* flx_query_job_new(void); -flxQueryJob* flx_query_job_ref(flxQueryJob *job); -void flx_query_job_unref(flxQueryJob *job); - -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); - -void flx_server_remove_query_job_instance(flxServer *s, flxQueryJobInstance *i); - -gboolean flx_query_equal(const flxQuery *a, const flxQuery *b); #endif