]> git.meshlink.io Git - catta/blob - timeeventq.h
* add DNS packet name compression
[catta] / timeeventq.h
1 #ifndef footimeeventqhfoo
2 #define footimeeventqhfoo
3
4 typedef struct _flxTimeEventQueue flxTimeEventQueue;
5 typedef struct _flxTimeEvent flxTimeEvent;
6
7 #include "prioq.h"
8
9 struct _flxTimeEvent {
10     flxTimeEventQueue *queue;
11     flxPrioQueueNode *node;
12     GTimeVal expiry;
13     void (*callback)(flxTimeEvent *e, void *userdata);
14     void *userdata;
15 };
16
17 struct _flxTimeEventQueue {
18     GSource source;
19     flxPrioQueue *prioq;
20 };
21
22 flxTimeEventQueue* flx_time_event_queue_new(GMainContext *context);
23 void flx_time_event_queue_free(flxTimeEventQueue *q);
24
25 flxTimeEvent* flx_time_event_queue_add(flxTimeEventQueue *q, const GTimeVal *timeval, void (*callback)(flxTimeEvent *e, void *userdata), void *userdata);
26 void flx_time_event_queue_remove(flxTimeEventQueue *q, flxTimeEvent *e);
27
28 void flx_time_event_queue_update(flxTimeEventQueue *q, flxTimeEvent *e, const GTimeVal *timeval);
29
30 flxTimeEvent* flx_time_event_queue_root(flxTimeEventQueue *q);
31 flxTimeEvent* flx_time_event_next(flxTimeEvent *e);
32
33
34
35
36 #endif