OpenVPN
|
#include "otime.h"
Go to the source code of this file.
Data Structures | |
struct | interval |
struct | event_timeout |
struct | usec_timer |
Macros | |
#define | INTERVAL_DEBUG 0 |
#define | ETT_DEFAULT (-1) |
#define | USEC_TIMER_MAX 60 /* maximum interval size in seconds */ |
#define | USEC_TIMER_MAX_USEC (USEC_TIMER_MAX * 1000000) |
Functions | |
void | interval_init (struct interval *top, int horizon, int refresh) |
static bool | interval_test (struct interval *top) |
static void | interval_schedule_wakeup (struct interval *top, interval_t *wakeup) |
static void | interval_future_trigger (struct interval *top, interval_t wakeup) |
static void | interval_action (struct interval *top) |
static bool | event_timeout_defined (const struct event_timeout *et) |
static void | event_timeout_clear (struct event_timeout *et) |
Clears the timeout and reset all values to 0. More... | |
static void | event_timeout_init (struct event_timeout *et, interval_t n, const time_t last) |
Initialises a timer struct. More... | |
static void | event_timeout_reset (struct event_timeout *et) |
Resets a timer. More... | |
static void | event_timeout_modify_wakeup (struct event_timeout *et, interval_t n) |
Sets the interval n of a timeout. More... | |
static interval_t | event_timeout_remaining (struct event_timeout *et) |
Returns the time until the timeout should triggered, from now . More... | |
bool | event_timeout_trigger (struct event_timeout *et, struct timeval *tv, int et_const_retry) |
This is the principal function for testing and triggering recurring timers. More... | |
static void | usec_timer_start (struct usec_timer *obj) |
static void | usec_timer_end (struct usec_timer *obj) |
static bool | usec_timer_interval_defined (struct usec_timer *obj) |
static int | usec_timer_interval (struct usec_timer *obj) |
#define ETT_DEFAULT (-1) |
Definition at line 224 of file interval.h.
#define INTERVAL_DEBUG 0 |
Definition at line 35 of file interval.h.
#define USEC_TIMER_MAX 60 /* maximum interval size in seconds */ |
Definition at line 266 of file interval.h.
#define USEC_TIMER_MAX_USEC (USEC_TIMER_MAX * 1000000) |
Definition at line 268 of file interval.h.
|
inlinestatic |
Clears the timeout and reset all values to 0.
Following timer checks will not trigger.
et | timer struct |
Definition at line 155 of file interval.h.
References event_timeout::defined, event_timeout::last, and event_timeout::n.
Referenced by check_add_routes_action(), check_connection_established(), check_send_occ_load_test_dowork(), check_send_occ_req_dowork(), do_init_timers(), incoming_push_message(), man_bytecount(), man_connection_close(), process_explicit_exit_notification_timer_wakeup(), process_received_occ_msg(), and status_open().
|
inlinestatic |
Definition at line 144 of file interval.h.
References event_timeout::defined.
Referenced by check_send_occ_load_test(), check_send_occ_req(), read_incoming_link(), remap_restart_signals(), and schedule_exit().
|
inlinestatic |
Initialises a timer struct.
The timer will become true/trigger after last + n seconds.
et | Timer struct |
n | Interval of the timer for periodic timer. A negative value for n will be interpreted as 0. |
last | Sets the base time of the timer. |
Definition at line 174 of file interval.h.
References event_timeout::defined, event_timeout::last, and event_timeout::n.
Referenced by check_add_routes(), check_connection_established(), check_tls(), do_init_server_poll_timeout(), do_init_timers(), do_up(), fragment_init(), man_bytecount(), multi_init(), process_explicit_exit_notification_init(), schedule_exit(), and status_open().
|
inlinestatic |
Sets the interval n of a timeout.
et | |
n | Interval value of the timer, negative values will be interpreted as 0 |
Definition at line 206 of file interval.h.
References event_timeout::defined, and event_timeout::n.
Referenced by check_push_request().
|
inlinestatic |
Returns the time until the timeout should triggered, from now
.
This function does not check if the timeout is actually valid.
Definition at line 219 of file interval.h.
References event_timeout::last, event_timeout::n, and now.
Referenced by event_timeout_trigger(), and get_server_poll_remaining_time().
|
inlinestatic |
Resets a timer.
Sets the last time the timer has been triggered for the calculation of the next event.
et |
Definition at line 189 of file interval.h.
References event_timeout::defined, event_timeout::last, and now.
Referenced by check_add_routes(), check_inactivity_timeout(), check_send_occ_req_dowork(), check_server_poll_timeout(), process_incoming_link_part1(), process_incoming_link_part2(), process_outgoing_link(), and register_activity().
bool event_timeout_trigger | ( | struct event_timeout * | et, |
struct timeval * | tv, | ||
int | et_const_retry | ||
) |
This is the principal function for testing and triggering recurring timers.
If *et is not triggered, *tv is set to remaining time until the timeout if not already lower:
*tv = minimum(*tv, event_timeout_remaining(*et))
If *et triggers and et_const_retry is negative (ETT_DEFAULT is -1):
If *et triggers and et_const_retry >= 0, *tv will be lowered to et_const_try if larger:
*tv = *minimum(*tv, et_const_retry)
This is mainly useful if the trigger cannot yet be triggered for other reasons and a backoff timeout should be returned if the timer is ready to trigger.
et | the timeout to check |
tv | will be set to timeout for next check for this timeout unless already smaller. |
et_const_retry | see above |
Definition at line 43 of file interval.c.
References D_INTERVAL, event_timeout::defined, dmsg, event_timeout_remaining(), event_timeout::last, event_timeout::n, and now.
Referenced by check_add_routes(), check_ping_restart(), check_ping_send(), check_send_occ_load_test(), check_send_occ_req(), check_session_timeout(), management_check_bytecount(), process_coarse_timers(), process_explicit_exit_notification_timer_wakeup(), stale_route_check_trigger(), and status_trigger().
|
inlinestatic |
Definition at line 124 of file interval.h.
References D_INTERVAL, dmsg, interval::last_action, and now.
Referenced by check_tls(), process_incoming_link_part1(), and reschedule_multi_process().
|
inlinestatic |
Definition at line 108 of file interval.h.
References D_INTERVAL, dmsg, interval::future_trigger, and now.
Referenced by check_tls().
void interval_init | ( | struct interval * | top, |
int | horizon, | ||
int | refresh | ||
) |
Definition at line 35 of file interval.c.
References CLEAR, interval::horizon, and interval::refresh.
Referenced by do_init_timers().
|
inlinestatic |
Definition at line 94 of file interval.h.
References D_INTERVAL, dmsg, interval::future_trigger, interval_earliest_wakeup(), interval::last_test_true, now, and interval::refresh.
Referenced by check_tls().
|
inlinestatic |
Definition at line 66 of file interval.h.
References D_INTERVAL, dmsg, interval::future_trigger, interval::horizon, interval::last_action, interval::last_test_true, now, and interval::refresh.
Referenced by check_tls().
|
inlinestatic |
Definition at line 285 of file interval.h.
References usec_timer::end, and openvpn_gettimeofday().
|
inlinestatic |
Definition at line 299 of file interval.h.
References usec_timer::end, usec_timer::start, tv_subtract(), and USEC_TIMER_MAX.
|
inlinestatic |
Definition at line 293 of file interval.h.
References usec_timer::end, and usec_timer::start.
|
inlinestatic |
Definition at line 278 of file interval.h.
References CLEAR, openvpn_gettimeofday(), and usec_timer::start.