OpenVPN
Data Structures | Macros | Functions | Variables
otime.h File Reference
#include "common.h"
#include "integer.h"
#include "buffer.h"
Include dependency graph for otime.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  frequency_limit
 

Macros

#define TV_WITHIN_SIGMA_MAX_SEC   600
 
#define TV_WITHIN_SIGMA_MAX_USEC   (TV_WITHIN_SIGMA_MAX_SEC * 1000000)
 

Functions

struct frequency_limitfrequency_limit_init (int max, int per)
 
void frequency_limit_free (struct frequency_limit *f)
 
bool frequency_limit_event_allowed (struct frequency_limit *f)
 
const char * time_string (time_t t, int usec, bool show_usec, struct gc_arena *gc)
 
const char * tv_string (const struct timeval *tv, struct gc_arena *gc)
 
const char * tv_string_abs (const struct timeval *tv, struct gc_arena *gc)
 
void time_test (void)
 
void update_now (const time_t system_time)
 
void update_now_usec (struct timeval *tv)
 
static int openvpn_gettimeofday (struct timeval *tv, void *tz)
 
static void update_time (void)
 
static time_t openvpn_time (time_t *t)
 
static void tv_clear (struct timeval *tv)
 
static bool tv_defined (const struct timeval *tv)
 
static int tv_subtract (const struct timeval *tv1, const struct timeval *tv2, const unsigned int max_seconds)
 
static void tv_add (struct timeval *dest, const struct timeval *src)
 
static bool tv_lt (const struct timeval *t1, const struct timeval *t2)
 
static bool tv_le (const struct timeval *t1, const struct timeval *t2)
 
static bool tv_ge (const struct timeval *t1, const struct timeval *t2)
 
static bool tv_gt (const struct timeval *t1, const struct timeval *t2)
 
static bool tv_eq (const struct timeval *t1, const struct timeval *t2)
 
static void tv_delta (struct timeval *dest, const struct timeval *t1, const struct timeval *t2)
 
static bool tv_within_sigma (const struct timeval *t1, const struct timeval *t2, unsigned int sigma)
 
static void interval_earliest_wakeup (interval_t *wakeup, time_t at, time_t current)
 

Variables

time_t now
 
time_t now_usec
 

Macro Definition Documentation

◆ TV_WITHIN_SIGMA_MAX_SEC

#define TV_WITHIN_SIGMA_MAX_SEC   600

Definition at line 240 of file otime.h.

◆ TV_WITHIN_SIGMA_MAX_USEC

#define TV_WITHIN_SIGMA_MAX_USEC   (TV_WITHIN_SIGMA_MAX_SEC * 1000000)

Definition at line 241 of file otime.h.

Function Documentation

◆ frequency_limit_event_allowed()

bool frequency_limit_event_allowed ( struct frequency_limit f)

Definition at line 167 of file otime.c.

References http-client::f, and now.

Referenced by multi_get_create_instance_udp().

◆ frequency_limit_free()

void frequency_limit_free ( struct frequency_limit f)

Definition at line 161 of file otime.c.

References http-client::f.

Referenced by multi_uninit().

◆ frequency_limit_init()

struct frequency_limit* frequency_limit_init ( int  max,
int  per 
)

Definition at line 146 of file otime.c.

References ALLOC_OBJ, ASSERT, http-client::f, frequency_limit::max, and frequency_limit::per.

Referenced by multi_init().

◆ interval_earliest_wakeup()

static void interval_earliest_wakeup ( interval_t wakeup,
time_t  at,
time_t  current 
)
inlinestatic

Definition at line 258 of file otime.h.

Referenced by interval_schedule_wakeup().

◆ openvpn_gettimeofday()

static int openvpn_gettimeofday ( struct timeval *  tv,
void *  tz 
)
inlinestatic

◆ openvpn_time()

static time_t openvpn_time ( time_t *  t)
inlinestatic

Definition at line 90 of file otime.h.

References now, and update_time().

Referenced by gen_timestamp(), and process_incoming_push_request().

◆ time_string()

const char* time_string ( time_t  t,
int  usec,
bool  show_usec,
struct gc_arena gc 
)

◆ time_test()

void time_test ( void  )

Referenced by init_static().

◆ tv_add()

static void tv_add ( struct timeval *  dest,
const struct timeval *  src 
)
inlinestatic

◆ tv_clear()

static void tv_clear ( struct timeval *  tv)
inlinestatic

Definition at line 101 of file otime.h.

Referenced by check_send_occ_msg(), and multi_tcp_wait_lite().

◆ tv_defined()

static bool tv_defined ( const struct timeval *  tv)
inlinestatic

Definition at line 108 of file otime.h.

Referenced by shaper_delay().

◆ tv_delta()

static void tv_delta ( struct timeval *  dest,
const struct timeval *  t1,
const struct timeval *  t2 
)
inlinestatic

Definition at line 220 of file otime.h.

Referenced by multi_get_timeout().

◆ tv_eq()

static bool tv_eq ( const struct timeval *  t1,
const struct timeval *  t2 
)
inlinestatic

Definition at line 214 of file otime.h.

◆ tv_ge()

static bool tv_ge ( const struct timeval *  t1,
const struct timeval *  t2 
)
inlinestatic

Definition at line 180 of file otime.h.

◆ tv_gt()

static bool tv_gt ( const struct timeval *  t1,
const struct timeval *  t2 
)
inlinestatic

Definition at line 197 of file otime.h.

◆ tv_le()

static bool tv_le ( const struct timeval *  t1,
const struct timeval *  t2 
)
inlinestatic

Definition at line 163 of file otime.h.

◆ tv_lt()

static bool tv_lt ( const struct timeval *  t1,
const struct timeval *  t2 
)
inlinestatic

Definition at line 146 of file otime.h.

◆ tv_string()

const char* tv_string ( const struct timeval *  tv,
struct gc_arena gc 
)

Definition at line 82 of file otime.c.

References alloc_buf_gc(), BSTR, and buf_printf().

◆ tv_string_abs()

const char* tv_string_abs ( const struct timeval *  tv,
struct gc_arena gc 
)

Definition at line 97 of file otime.c.

References time_string().

◆ tv_subtract()

static int tv_subtract ( const struct timeval *  tv1,
const struct timeval *  tv2,
const unsigned int  max_seconds 
)
inlinestatic

Definition at line 115 of file otime.h.

References constrain_int().

Referenced by shaper_delay(), tv_within_sigma(), and usec_timer_interval().

◆ tv_within_sigma()

static bool tv_within_sigma ( const struct timeval *  t1,
const struct timeval *  t2,
unsigned int  sigma 
)
inlinestatic

Definition at line 247 of file otime.h.

References tv_subtract(), and TV_WITHIN_SIGMA_MAX_SEC.

Referenced by schedule_add_entry().

◆ update_now()

void update_now ( const time_t  system_time)

Definition at line 45 of file otime.c.

References now, and now_adj.

Referenced by update_now_usec(), and update_time().

◆ update_now_usec()

void update_now_usec ( struct timeval *  tv)

Definition at line 68 of file otime.c.

References now, now_usec, and update_now().

Referenced by openvpn_gettimeofday().

◆ update_time()

static void update_time ( void  )
inlinestatic

Variable Documentation

◆ now

time_t now

Definition at line 34 of file otime.c.

Referenced by auth_token_test_empty_user(), auth_token_test_known_keys(), auth_token_test_random_keys(), auth_token_test_timeout(), calculate_session_id_hmac(), check_add_routes(), check_coarse_timers(), check_connection_established(), check_stale_routes(), check_timeout_random_component(), check_timeout_random_component_dowork(), check_timestamp_delta(), check_tls(), do_init_server_poll_timeout(), do_init_timers(), do_up(), event_timeout_remaining(), event_timeout_reset(), event_timeout_trigger(), fragment_incoming(), fragment_init(), fragment_ttl_reap(), frequency_limit_event_allowed(), generate_auth_token(), ifconfig_pool_entry_free(), ifconfig_pool_set(), interval_action(), interval_future_trigger(), interval_schedule_wakeup(), interval_test(), key_state_soft_reset(), lame_duck_must_die(), man_block(), man_bytecount(), man_bytecount_output_server(), management_bytes_server(), management_echo(), management_event_loop_n_seconds(), management_set_state(), multi_client_disconnect_setenv(), multi_create_instance(), multi_get_instance_by_virtual_addr(), multi_learn_addr(), multi_print_status(), multi_process_per_second_timers(), multi_reap_new(), multi_reap_process(), multi_reap_process_dowork(), multi_route_defined(), openvpn_gettimeofday(), openvpn_time(), packet_id_add(), packet_id_reap(), packet_id_reap_test(), packet_id_send_update(), process_explicit_exit_notification_init(), process_explicit_exit_notification_timer_wakeup(), process_incoming_push_request(), reflect_filter_rate_limit_check(), reliable_can_send(), reliable_schedule_now(), reliable_send(), reliable_send_purge(), reliable_send_timeout(), schedule_exit(), send_auth_pending_messages(), send_push_request(), session_move_active(), session_move_pre_start(), setup(), test_calc_session_id_hmac_static(), test_generate_reset_packet_tls_auth(), test_packet_id_write_long(), test_packet_id_write_long_prepend(), test_packet_id_write_long_wrap(), test_packet_id_write_short(), test_packet_id_write_short_prepend(), tls_authentication_status(), tls_authentication_status_use_cache(), tls_crypt_v2_write_client_key_file(), tls_pre_decrypt(), tls_process(), tls_process_state(), tls_select_encryption_key(), tls_session_init(), update_key_auth_status(), update_now(), update_now_usec(), verify_auth_token(), virtual_output_callback_func(), and win32_sleep().

◆ now_usec

time_t now_usec

Definition at line 37 of file otime.c.

Referenced by openvpn_gettimeofday(), update_now_usec(), and update_time().