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)
 
static void update_time (void)
 
static int openvpn_gettimeofday (struct timeval *tv, void *tz)
 
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
 

Macro Definition Documentation

◆ TV_WITHIN_SIGMA_MAX_SEC

#define TV_WITHIN_SIGMA_MAX_SEC   600

Definition at line 273 of file otime.h.

Referenced by tv_within_sigma().

◆ TV_WITHIN_SIGMA_MAX_USEC

#define TV_WITHIN_SIGMA_MAX_USEC   (TV_WITHIN_SIGMA_MAX_SEC * 1000000)

Definition at line 274 of file otime.h.

Function Documentation

◆ frequency_limit_event_allowed()

bool frequency_limit_event_allowed ( struct frequency_limit f)

◆ frequency_limit_free()

void frequency_limit_free ( struct frequency_limit f)

Definition at line 164 of file otime.c.

References free.

Referenced by multi_uninit().

◆ frequency_limit_init()

struct frequency_limit* frequency_limit_init ( int  max,
int  per 
)

◆ interval_earliest_wakeup()

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

Definition at line 291 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 123 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  )

◆ 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 134 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 141 of file otime.h.

◆ tv_delta()

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

Definition at line 253 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 247 of file otime.h.

Referenced by schedule_remove_entry().

◆ tv_ge()

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

Definition at line 213 of file otime.h.

◆ tv_gt()

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

Definition at line 230 of file otime.h.

◆ tv_le()

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

Definition at line 196 of file otime.h.

Referenced by schedule_remove_entry().

◆ tv_lt()

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

Definition at line 179 of file otime.h.

Referenced by schedule_remove_entry().

◆ tv_string()

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

Definition at line 88 of file otime.c.

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

Referenced by schedule_remove_entry().

◆ tv_string_abs()

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

Definition at line 103 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 148 of file otime.h.

References constrain_int().

Referenced by 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 280 of file otime.h.

References tv_subtract(), and TV_WITHIN_SIGMA_MAX_SEC.

Referenced by schedule_add_entry().

◆ update_time()

static void update_time ( void  )
inlinestatic

Variable Documentation

◆ now

time_t now

Definition at line 36 of file otime.c.

Referenced by check_add_routes_dowork(), check_coarse_timers(), check_coarse_timers_dowork(), check_connection_established_dowork(), check_stale_routes(), check_timeout_random_component(), check_timeout_random_component_dowork(), check_timestamp_delta(), 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(), 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_output_client(), man_bytecount_possible_output_client(), management_bytes_in(), 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_time(), packet_id_add(), packet_id_persist_print(), 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(), reliable_can_send(), reliable_mark_deleted(), reliable_schedule_now(), reliable_send(), reliable_send_purge(), reliable_send_timeout(), schedule_exit(), 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_crypt_v2_write_client_key_file(), tls_pre_encrypt(), tls_process(), tls_test_auth_deferred_interval(), update_now(), update_now_usec(), update_time(), verify_user_pass(), and virtual_output_callback_func().