OpenVPN
integer.h File Reference
#include "error.h"
Include dependency graph for integer.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define htonll(x)
#define ntohll(x)

Functions

static int clamp_size_to_int (size_t size)
static unsigned int max_uint (unsigned int x, unsigned int y)
static unsigned int min_uint (unsigned int x, unsigned int y)
static size_t min_size (size_t x, size_t y)
static int max_int (int x, int y)
static int min_int (int x, int y)
static int constrain_int (int x, int min, int max)
static unsigned int constrain_uint (unsigned int x, unsigned int min, unsigned int max)
static int modulo_subtract (int x, int y, int mod)
static int modulo_add (int x, int y, int mod)
static size_t adjust_power_of_2 (size_t u)
static int index_verify (int index, int size, const char *file, int line)
static size_t round_down_size (size_t num, size_t multiple)
 Rounds down num to the nearest multiple of multiple.

Macro Definition Documentation

◆ htonll

#define htonll ( x)
Value:
((1 == htonl(1)) \
? (x) \
: ((uint64_t)htonl((uint32_t)((x) & 0xFFFFFFFF)) << 32) | htonl((uint32_t)((x) >> 32)))

Definition at line 29 of file integer.h.

Referenced by buf_write_u64(), create_metadata_days_ago(), generate_auth_token(), packet_id_write_epoch(), and tls_crypt_v2_write_client_key_file().

◆ ntohll

#define ntohll ( x)
Value:
((1 == ntohl(1)) \
? (x) \
: ((uint64_t)ntohl((uint32_t)((x) & 0xFFFFFFFF)) << 32) | ntohl((uint32_t)((x) >> 32)))

Definition at line 36 of file integer.h.

Referenced by buf_read_u64(), packet_id_read_epoch(), tls_crypt_v2_check_client_key_age(), and verify_auth_token().

Function Documentation

◆ adjust_power_of_2()

size_t adjust_power_of_2 ( size_t u)
inlinestatic

Definition at line 205 of file integer.h.

References ASSERT.

Referenced by argv_grow(), hash_init(), and mbuf_init().

◆ clamp_size_to_int()

int clamp_size_to_int ( size_t size)
inlinestatic

Definition at line 43 of file integer.h.

References ASSERT.

Referenced by frame_calculate_fragment().

◆ constrain_int()

int constrain_int ( int x,
int min,
int max )
inlinestatic

◆ constrain_uint()

unsigned int constrain_uint ( unsigned int x,
unsigned int min,
unsigned int max )
inlinestatic

Definition at line 139 of file integer.h.

Referenced by reap_buckets_per_pass().

◆ index_verify()

int index_verify ( int index,
int size,
const char * file,
int line )
inlinestatic

Definition at line 219 of file integer.h.

References M_FATAL, and msg.

◆ max_int()

◆ max_uint()

unsigned int max_uint ( unsigned int x,
unsigned int y )
inlinestatic

◆ min_int()

◆ min_size()

size_t min_size ( size_t x,
size_t y )
inlinestatic

Definition at line 79 of file integer.h.

Referenced by man_check_password(), and ovpn_hkdf_expand().

◆ min_uint()

unsigned int min_uint ( unsigned int x,
unsigned int y )
inlinestatic

◆ modulo_add()

int modulo_add ( int x,
int y,
int mod )
inlinestatic

Definition at line 185 of file integer.h.

References ASSERT.

Referenced by fragment_list_get_buf(), fragment_outgoing(), and log_index().

◆ modulo_subtract()

int modulo_subtract ( int x,
int y,
int mod )
inlinestatic

Definition at line 170 of file integer.h.

References ASSERT.

Referenced by fragment_list_get_buf().

◆ round_down_size()

size_t round_down_size ( size_t num,
size_t multiple )
inlinestatic

Rounds down num to the nearest multiple of multiple.

Definition at line 233 of file integer.h.

Referenced by adjust_payload_max_cbc().