2017-03-15 21:13:17 +01:00
|
|
|
/* Copyright (c) 2016-2017, The Tor Project, Inc. */
|
2016-04-13 17:11:35 +02:00
|
|
|
/* See LICENSE for licensing information */
|
|
|
|
|
|
|
|
#ifndef TOR_TIMERS_H
|
|
|
|
#define TOR_TIMERS_H
|
|
|
|
|
|
|
|
#include "orconfig.h"
|
|
|
|
#include "testsupport.h"
|
|
|
|
|
2016-07-08 20:38:02 +02:00
|
|
|
struct monotime_t;
|
2016-04-13 17:11:35 +02:00
|
|
|
typedef struct timeout tor_timer_t;
|
2016-07-29 07:05:12 +02:00
|
|
|
typedef void (*timer_cb_fn_t)(tor_timer_t *, void *,
|
|
|
|
const struct monotime_t *);
|
2016-04-13 17:11:35 +02:00
|
|
|
tor_timer_t *timer_new(timer_cb_fn_t cb, void *arg);
|
|
|
|
void timer_set_cb(tor_timer_t *t, timer_cb_fn_t cb, void *arg);
|
2016-12-02 18:15:07 +01:00
|
|
|
void timer_get_cb(const tor_timer_t *t,
|
|
|
|
timer_cb_fn_t *cb_out, void **arg_out);
|
2016-04-13 17:11:35 +02:00
|
|
|
void timer_schedule(tor_timer_t *t, const struct timeval *delay);
|
|
|
|
void timer_disable(tor_timer_t *t);
|
2017-11-17 18:27:25 +01:00
|
|
|
void timer_free_(tor_timer_t *t);
|
2017-12-07 16:44:04 +01:00
|
|
|
#define timer_free(t) FREE_AND_NULL(tor_timer_t, timer_free_, (t))
|
2016-04-13 17:11:35 +02:00
|
|
|
|
|
|
|
void timers_initialize(void);
|
|
|
|
void timers_shutdown(void);
|
|
|
|
|
2017-09-11 19:48:39 +02:00
|
|
|
#ifdef TOR_TIMERS_PRIVATE
|
|
|
|
STATIC void timers_run_pending(void);
|
|
|
|
#endif
|
|
|
|
|
2017-09-15 22:24:44 +02:00
|
|
|
#endif /* !defined(TOR_TIMERS_H) */
|
2016-04-13 17:11:35 +02:00
|
|
|
|