summaryrefslogtreecommitdiffstats
path: root/server.h
blob: f90bfe77aaa11e009ca7b63f2e884417502cb74b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
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 _flxServerEntry {
    flxRecord *record;
    gint id;
    gint interface;
    guchar protocol;

    flxServerEntryFlags flags;

    FLX_LLIST_FIELDS(flxServerEntry, entry);
    FLX_LLIST_FIELDS(flxServerEntry, by_key);
    FLX_LLIST_FIELDS(flxServerEntry, by_id);
    
    FLX_LLIST_HEAD(flxAnnouncement, announcements);
};

struct _flxServer {
    GMainContext *context;
    flxInterfaceMonitor *monitor;

    gint current_id;
    
    FLX_LLIST_HEAD(flxServerEntry, entries);
    GHashTable *rrset_by_id;
    GHashTable *rrset_by_key;

    FLX_LLIST_HEAD(flxSubscription, subscriptions);
    GHashTable *subscription_hashtable;

    flxTimeEventQueue *time_event_queue;
    
    gchar *hostname;

    gint fd_ipv4, fd_ipv6;

    GPollFD pollfd_ipv4, pollfd_ipv6;
    GSource *source;
    
};

gboolean flx_server_entry_match_interface(flxServerEntry *e, flxInterface *i);

#endif