85 assert_true(data->
pis.
id == 1);
97 assert_int_equal(data->
pis.
id, 1);
111 assert_true(data->
pis.
id == 1);
124 assert_int_equal(data->
pis.
id, 1);
157 assert_int_equal(data->
pis.
id, 1);
235 data->pis.id = 0xfa079ab9d2e8;
243 data->pis.id = 0xfffffffffffe;
256 assert_int_equal(pin.
id, 1);
259 assert_int_equal(pin.
id, 0xfa079ab9d2e9);
262 assert_int_equal(pin.
id, 0xffffffffffff);
332 const struct CMUnitTest tests[] = {
360 return cmocka_run_group_tests_name(
"packet_id tests", tests, NULL, NULL);
struct buffer alloc_buf_gc(size_t size, struct gc_arena *gc)
static void gc_free(struct gc_arena *a)
static struct gc_arena gc_new(void)
void reliable_free(struct reliable *rel)
Free allocated memory associated with a reliable structure and the pointer itself.
void reliable_init(struct reliable *rel, int buf_size, int offset, int array_size, bool hold)
Initialize a reliable structure.
void copy_acks_to_mru(struct reliable_ack *ack, struct reliable_ack *ack_mru, int n)
Copies the first n acks from ack to ack_mru.
int reliable_get_num_output_sequenced_available(struct reliable *rel)
Counts the number of free buffers in output that can be potentially used for sending.
bool packet_id_write(struct packet_id_send *p, struct buffer *buf, bool long_form, bool prepend)
Write a packet ID to buf, and update the packet ID state.
bool packet_id_write_epoch(struct packet_id_send *p, uint16_t epoch, struct buffer *buf)
Writes the packet ID containing both the epoch and the packet id to the buffer specified by buf.
uint16_t packet_id_read_epoch(struct packet_id_net *p, struct buffer *buf)
Reads the packet ID containing both the epoch and the per-epoch counter from the buf.
Reliability Layer module header file.
Wrapper structure for dynamically allocated memory.
int capacity
Size in bytes of memory allocated by malloc().
uint8_t * data
Pointer to the allocated memory.
int len
Length in bytes of the actual content within the allocated memory.
int offset
Offset in bytes of the actual content within the allocated memory.
Garbage collection arena used to keep track of dynamically allocated memory.
Data structure for describing the packet id that is received/send to the network.
The acknowledgment structure in which packet IDs are stored for later acknowledgment.
The reliability layer storage structure for one VPN tunnel's control channel in one direction.
struct reliable_entry array[RELIABLE_CAPACITY]
struct test_packet_id_write_data::@26 test_buf_data
struct packet_id_send pis
static void openvpn_unit_test_setup(void)
Sets up the environment for unit tests like making both stderr and stdout non-buffered to avoid messa...
static int test_packet_id_write_setup(void **state)
static void test_packet_id_write_epoch(void **state)
static void test_packet_id_write_long_prepend(void **state)
static void test_packet_id_write_short_wrap(void **state)
static void test_packet_id_write_short_prepend(void **state)
static void test_packet_id_write_long(void **state)
static int test_packet_id_write_teardown(void **state)
static void test_get_num_output_sequenced_available(void **state)
static void test_copy_acks_to_lru(void **state)
static void test_packet_id_write_long_wrap(void **state)
static void test_packet_id_write_short(void **state)