00001 /* 00002 ** timer.h for in /home/anoman/work/lse/lseos/lseos-net/inet 00003 ** 00004 ** Copyright (c)2004 Arthur Kopatsy 00005 ** Login <kopats_a@epita.fr> 00006 ** 00007 ** Started on Tue Nov 9 17:17:29 2004 Arthur Kopatsy 00008 ** Last update Mon Nov 29 10:38:47 2004 Arthur Kopatsy 00009 */ 00010 00011 #ifndef TIMER_H_ 00012 #define TIMER_H_ 00013 00014 typedef void (*t_ta_fun)(void *ta_data); 00015 00016 struct s_timer_action 00017 { 00018 TAILQ_ENTRY(s_timer_action) ta_next; 00019 00020 t_ta_fun ta_fun; /* Function to call, when delay expired */ 00021 void *ta_data; 00022 00023 int64_t ta_usec_delay; /* Registered delay */ 00024 int64_t ta_usec_reg; /* Time at which action was registered */ 00025 00026 /* Next field are only used for the next coming action */ 00027 int ta_timer_id; /* Id of the registred timer */ 00028 int ta_id; 00029 }; 00030 00031 TAILQ_HEAD(s_timer_action_head, s_timer_action); 00032 00033 /* PROTO timer.c */ 00034 #ifdef __INET__ 00035 /* timer.c */ 00036 int inet_timer_init(void); 00037 int inet_timer_remove(int ta_id); 00038 int inet_timer_add(int64_t ta_usec_delay, t_ta_fun ta_fun, void *ta_data); 00039 void list_timers(void); 00040 #endif /* __INET__ */ 00041 #endif