X-Git-Url: http://git.meshlink.io/?a=blobdiff_plain;f=server.h;h=3960ee5f4a1a9ee2637ec1599892121a82e7a4a2;hb=844f6b5a8213018c3d42b5ef924b61cf3eafcdbb;hp=7c96e780152c07005b1784d704fe1d37b4ac93ea;hpb=33ccd714ea9469b5b7d3b36bbe468ba1b0f31dfc;p=catta diff --git a/server.h b/server.h index 7c96e78..3960ee5 100644 --- a/server.h +++ b/server.h @@ -3,31 +3,77 @@ #include "flx.h" #include "iface.h" +#include "prioq.h" +#include "llist.h" +#include "timeeventq.h" +#include "announce.h" +#include "subscribe.h" struct _flxEntry { - flxRecord rr; - gint id; - gint interface; + flxServer *server; + flxEntryGroup *group; - int unique; + gboolean dead; + + flxEntryFlags flags; + flxRecord *record; + gint interface; + guchar protocol; - struct _flxEntry *next, *prev; - struct _flxEntry *next_by_name, *prev_by_name; - struct _flxEntry *next_by_id, *prev_by_id; + FLX_LLIST_FIELDS(flxEntry, entries); + FLX_LLIST_FIELDS(flxEntry, by_key); + FLX_LLIST_FIELDS(flxEntry, by_group); + + FLX_LLIST_HEAD(flxAnnouncement, announcements); }; -typedef struct _flxEntry flxEntry; +struct _flxEntryGroup { + flxServer *server; + gboolean dead; + + flxEntryGroupState state; + gpointer userdata; + flxEntryGroupCallback callback; + + guint n_probing; + + FLX_LLIST_FIELDS(flxEntryGroup, groups); + FLX_LLIST_HEAD(flxEntry, entries); +}; struct _flxServer { GMainContext *context; flxInterfaceMonitor *monitor; - gint current_id; + FLX_LLIST_HEAD(flxEntry, entries); + GHashTable *entries_by_key; + + FLX_LLIST_HEAD(flxEntryGroup, groups); - GHashTable *rrset_by_id; - GHashTable *rrset_by_name; + FLX_LLIST_HEAD(flxSubscription, subscriptions); + GHashTable *subscription_hashtable; - flxEntry *entries; + gboolean need_entry_cleanup, need_group_cleanup; + + flxTimeEventQueue *time_event_queue; + + gchar *hostname; + + gint fd_ipv4, fd_ipv6; + + GPollFD pollfd_ipv4, pollfd_ipv6; + GSource *source; + + gboolean ignore_bad_ttl; }; +gboolean flx_server_entry_match_interface(flxEntry *e, flxInterface *i); + +void flx_server_post_query(flxServer *s, gint interface, guchar protocol, flxKey *key); +void flx_server_post_response(flxServer *s, gint interface, guchar protocol, flxRecord *record, gboolean flush_cache); + +void flx_entry_group_change_state(flxEntryGroup *g, flxEntryGroupState state); + +gboolean flx_entry_commited(flxEntry *e); + #endif