summaryrefslogtreecommitdiff
path: root/proto/bfd/io.h
diff options
context:
space:
mode:
authorOndrej Zajicek (work) <santiago@crfreenet.org>2017-05-30 19:12:35 +0200
committerOndrej Zajicek (work) <santiago@crfreenet.org>2017-12-07 13:46:53 +0100
commit534215a18fb3fb7ce5b26c9e6ec1fdb32bf22ae6 (patch)
treeb805e7f9dcf6e999dfad01117bc72f4bee6f2a6d /proto/bfd/io.h
parent7c454d918682c072a6ae6ad8e0cd8d35b9edd2aa (diff)
Timers: Split microsecond timers from BFD code to lib
Diffstat (limited to 'proto/bfd/io.h')
-rw-r--r--proto/bfd/io.h67
1 files changed, 1 insertions, 66 deletions
diff --git a/proto/bfd/io.h b/proto/bfd/io.h
index 45836f84..ec706e9a 100644
--- a/proto/bfd/io.h
+++ b/proto/bfd/io.h
@@ -11,80 +11,15 @@
#include "lib/lists.h"
#include "lib/resource.h"
#include "lib/event.h"
+#include "lib/timer.h"
#include "lib/socket.h"
-// #include "sysdep/unix/timer.h"
-typedef struct timer2
-{
- resource r;
- void (*hook)(struct timer2 *);
- void *data;
-
- btime expires; /* 0=inactive */
- uint randomize; /* Amount of randomization */
- uint recurrent; /* Timer recurrence */
-
- int index;
-} timer2;
-
-
-btime current_time(void);
-
void ev2_schedule(event *e);
-
-timer2 *tm2_new(pool *p);
-void tm2_set(timer2 *t, btime when);
-void tm2_start(timer2 *t, btime after);
-void tm2_stop(timer2 *t);
-
-static inline int
-tm2_active(timer2 *t)
-{
- return t->expires != 0;
-}
-
-static inline btime
-tm2_remains(timer2 *t)
-{
- btime now = current_time();
- return (t->expires > now) ? (t->expires - now) : 0;
-}
-
-static inline timer2 *
-tm2_new_init(pool *p, void (*hook)(struct timer2 *), void *data, uint rec, uint rand)
-{
- timer2 *t = tm2_new(p);
- t->hook = hook;
- t->data = data;
- t->recurrent = rec;
- t->randomize = rand;
- return t;
-}
-
-static inline void
-tm2_set_max(timer2 *t, btime when)
-{
- if (when > t->expires)
- tm2_set(t, when);
-}
-
-/*
-static inline void
-tm2_start_max(timer2 *t, btime after)
-{
- btime rem = tm2_remains(t);
- tm2_start(t, MAX_(rem, after));
-}
-*/
-
-
void sk_start(sock *s);
void sk_stop(sock *s);
-
-
struct birdloop *birdloop_new(void);
void birdloop_start(struct birdloop *loop);
void birdloop_stop(struct birdloop *loop);