tor

The Tor anonymity network
git clone https://git.dasho.dev/tor.git
Log | Files | Refs | README | LICENSE

timers.h (1031B)


      1 /* Copyright (c) 2016-2021, The Tor Project, Inc. */
      2 /* See LICENSE for licensing information */
      3 
      4 /**
      5 * \file timers.h
      6 * \brief Header for timers.c
      7 **/
      8 
      9 #ifndef TOR_TIMERS_H
     10 #define TOR_TIMERS_H
     11 
     12 #include "orconfig.h"
     13 #include "lib/testsupport/testsupport.h"
     14 
     15 struct monotime_t;
     16 struct timeval;
     17 typedef struct timeout tor_timer_t;
     18 typedef void (*timer_cb_fn_t)(tor_timer_t *, void *,
     19                              const struct monotime_t *);
     20 tor_timer_t *timer_new(timer_cb_fn_t cb, void *arg);
     21 void timer_set_cb(tor_timer_t *t, timer_cb_fn_t cb, void *arg);
     22 void timer_get_cb(const tor_timer_t *t,
     23                  timer_cb_fn_t *cb_out, void **arg_out);
     24 void timer_schedule(tor_timer_t *t, const struct timeval *delay);
     25 void timer_disable(tor_timer_t *t);
     26 void timer_free_(tor_timer_t *t);
     27 #define timer_free(t) FREE_AND_NULL(tor_timer_t, timer_free_, (t))
     28 
     29 void timers_initialize(void);
     30 void timers_shutdown(void);
     31 
     32 #ifdef TOR_TIMERS_PRIVATE
     33 STATIC void timers_run_pending(void);
     34 #endif
     35 
     36 #endif /* !defined(TOR_TIMERS_H) */