]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Implemented timers. Using bird_clock_t for absolute time from now...
authorMartin Mares <mj@ucw.cz>
Sun, 24 May 1998 14:40:29 +0000 (14:40 +0000)
committerMartin Mares <mj@ucw.cz>
Sun, 24 May 1998 14:40:29 +0000 (14:40 +0000)
nest/route.h
sysdep/config.h
sysdep/unix/Modules
sysdep/unix/timer.h

index e191a5fa90ec85bf598f5f01a3ce7bc2d226489d..255d31a57c54c43c2876223271662b0a695d3fb7 100644 (file)
@@ -10,6 +10,7 @@
 #define _BIRD_ROUTE_H_
 
 #include "lib/resource.h"
+#include "lib/timer.h"
 
 struct protocol;
 
@@ -106,7 +107,7 @@ typedef struct rte {
   byte flags;                          /* Flags (REF_...) */
   byte pflags;                         /* Protocol-specific flags */
   word pref;                           /* Route preference */
-  u32 lastmod;                         /* Last modified (time) */
+  bird_clock_t lastmod;                        /* Last modified */
   union {                              /* Protocol-dependent data (metrics etc.) */
 #ifdef CONFIG_STATIC
     struct {
@@ -144,6 +145,7 @@ rte *rte_get_temp(struct rtattr *);
 void rte_update(net *net, rte *new);
 void rte_dump(rte *);
 void rt_dump(rtable *);
+void rt_dump_all(void);
 
 /*
  *     Route Attributes
index c9c13936e45fd577149a30b8b93788c3abcd9934..65a0110392c6e0bbd95a7c372c432ed4294f9537 100644 (file)
@@ -40,6 +40,11 @@ typedef u16 word;
 
 #define CPU_STRUCT_ALIGN 4
 
+/* Timers */
+
+#undef TIME_T_IS_64BIT
+#define TIME_T_IS_SIGNED
+
 /* Protocol options */
 
 #define CONFIG_STATIC
index 450f5795b20d280ec4b6dcef4ad5e857b93b3b58..95b80b3813cc9249e5f2236565a93ad52a3351fa 100644 (file)
@@ -1,3 +1,5 @@
 log.c
 main.c
 timer.h
+io.c
+unix.h
index 506e3c9450e347bb1f4122ff7444b2c3192ada00..0589ec0f3cc10a02fcaa1c513ce0c4e2d6ce97f3 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *     BIRD Timers
+ *     BIRD -- Unix Timers
  *
  *     (c) 1998 Martin Mares <mj@ucw.cz>
  *
@@ -9,18 +9,26 @@
 #ifndef _BIRD_TIMER_H_
 #define _BIRD_TIMER_H_
 
+#include <sys/time.h>
+
 #include "lib/resource.h"
 
+typedef time_t bird_clock_t;           /* Use instead of time_t */
+
 typedef struct timer {
-       resource r;
-       void (*hook)(struct timer *);
-       void *data;
-       /* internal fields should be here */
+  resource r;
+  void (*hook)(struct timer *);
+  void *data;
+  unsigned randomize;                  /* Amount of randomization */
+  node n;                              /* Internal link */
+  clock_t expires;                     /* 0=inactive */
 } timer;
 
-timer *tm_new(pool *, void (*hook)(timer *), void *data);
+timer *tm_new(pool *);
 void tm_start(timer *, unsigned after);
 void tm_stop(timer *);
-void tm_trigger(timer *);
+void tm_dump_all(void);
+
+extern clock_t now;
 
 #endif