diff options
author | /C=EU/ST=EU/CN=Pablo Neira Ayuso/emailAddress=pablo@netfilter.org </C=EU/ST=EU/CN=Pablo Neira Ayuso/emailAddress=pablo@netfilter.org> | 2008-01-29 13:54:24 +0000 |
---|---|---|
committer | /C=EU/ST=EU/CN=Pablo Neira Ayuso/emailAddress=pablo@netfilter.org </C=EU/ST=EU/CN=Pablo Neira Ayuso/emailAddress=pablo@netfilter.org> | 2008-01-29 13:54:24 +0000 |
commit | c66ed8fdb8b64fcb8973f6b60a9696b59ba29ee6 (patch) | |
tree | 1f4b8453d082371ded73f67b763d56c7c96fd08d /include/alarm.h | |
parent | b5a30cfc0b58a4ae7b3169ec9a8955b323b85ed6 (diff) | |
download | conntrack-tools-c66ed8fdb8b64fcb8973f6b60a9696b59ba29ee6.tar.gz conntrack-tools-c66ed8fdb8b64fcb8973f6b60a9696b59ba29ee6.zip |
implement a rb-tree based alarm framework
Diffstat (limited to 'include/alarm.h')
-rw-r--r-- | include/alarm.h | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/include/alarm.h b/include/alarm.h index e3e08c1..38aaa01 100644 --- a/include/alarm.h +++ b/include/alarm.h @@ -1,30 +1,28 @@ -#ifndef _TIMER_H_ -#define _TIMER_H_ +#ifndef _ALARM_H_ +#define _ALARM_H_ +#include "linux_rbtree.h" #include "linux_list.h" #include <sys/time.h> -struct alarm_list { - struct list_head head; +struct alarm_block { + struct rb_node node; + struct list_head list; struct timeval tv; void *data; - void (*function)(struct alarm_list *a, void *data); + void (*function)(struct alarm_block *a, void *data); }; -int init_alarm_hash(void); - -void destroy_alarm_hash(void); - -void init_alarm(struct alarm_list *t, +void init_alarm(struct alarm_block *t, void *data, - void (*fcn)(struct alarm_list *a, void *data)); + void (*fcn)(struct alarm_block *a, void *data)); -void add_alarm(struct alarm_list *alarm, unsigned long sc, unsigned long usc); +void add_alarm(struct alarm_block *alarm, unsigned long sc, unsigned long usc); -void del_alarm(struct alarm_list *alarm); +void del_alarm(struct alarm_block *alarm); -int alarm_pending(struct alarm_list *alarm); +int alarm_pending(struct alarm_block *alarm); struct timeval * get_next_alarm_run(struct timeval *next_alarm); |