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