]> git.meshlink.io Git - catta/blobdiff - server.h
add infrastrtcur for creating and sending DNS packets
[catta] / server.h
index f1a15fc9efc4e8ed2c4535f37ceeb2a439f51b81..b1cc57bbad2dfdc6a464091abb99e4985f4ea325 100644 (file)
--- a/server.h
+++ b/server.h
@@ -1,50 +1,32 @@
 #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;
-    flxQuery query;
-} flxQueryJob;
-
-struct _flxQueryJobInstance;
-typedef struct _flxQueryJobInstance flxQueryJobInstance;
-struct _flxQueryJobInstance {
-    flxQueryJob *job;
-    gint interface;
-    guchar protocol;
-    flxQueryJobInstance *next, *prev;
-};
-
-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;
+struct _flxResponseJob {
+    flxTimeEvent *time_event;
+    flxRecord *record;
+    FLX_LLIST_FIELDS(flxResponseJob, response);
 };
 
 struct _flxServer {
@@ -56,22 +38,14 @@ struct _flxServer {
     GHashTable *rrset_by_id;
     GHashTable *rrset_by_name;
 
-    flxEntry *entries;
-
-    flxResponseJobInstance *first_response_job, *last_response_job;
-    flxQueryJobInstance *first_query_job, *last_query_job;
-};
-
-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 flxQuery *q);
-void flx_server_drop_query_job(flxServer *s, gint interface, guchar protocol, const flxQuery *q);
+    FLX_LLIST_HEAD(flxEntry, entries);
 
-void flx_server_remove_query_job_instance(flxServer *s, flxQueryJobInstance *i);
+    flxTimeEventQueue *time_event_queue;
+    
+    gchar *hostname;
 
-gboolean flx_query_equal(const flxQuery *a, const flxQuery *b);
+    gint fd_ipv4, fd_ipv6;
+};
 
 
 #endif