OpenVPN
Macros | Functions
reliable.c File Reference
#include "syshead.h"
#include "buffer.h"
#include "error.h"
#include "common.h"
#include "reliable.h"
#include "memdbg.h"
Include dependency graph for reliable.c:

Go to the source code of this file.

Macros

#define ACK_SIZE(n)   (sizeof(uint8_t) + ((n) ? SID_SIZE : 0) + sizeof(packet_id_type) * (n))
 

Functions

static bool reliable_pid_in_range1 (const packet_id_type test, const packet_id_type base, const unsigned int extent)
 
static bool reliable_pid_in_range2 (const packet_id_type test, const packet_id_type base, const unsigned int extent)
 
static bool reliable_pid_min (const packet_id_type p1, const packet_id_type p2)
 
static bool reliable_ack_packet_id_present (struct reliable_ack *ack, packet_id_type pid)
 
bool reliable_ack_read_packet_id (struct buffer *buf, packet_id_type *pid)
 Read the packet ID of a received packet. More...
 
bool reliable_ack_acknowledge_packet_id (struct reliable_ack *ack, packet_id_type pid)
 Record a packet ID for later acknowledgment. More...
 
bool reliable_ack_read (struct reliable_ack *ack, struct buffer *buf, const struct session_id *sid)
 Read an acknowledgment record from a received packet. More...
 
bool reliable_ack_write (struct reliable_ack *ack, struct buffer *buf, const struct session_id *sid, int max, bool prepend)
 Write a packet ID acknowledgment record to a buffer. More...
 
void reliable_ack_adjust_frame_parameters (struct frame *frame, int max)
 
const char * reliable_ack_print (struct buffer *buf, bool verbose, struct gc_arena *gc)
 
void reliable_init (struct reliable *rel, int buf_size, int offset, int array_size, bool hold)
 Initialize a reliable structure. More...
 
void reliable_free (struct reliable *rel)
 Free allocated memory associated with a reliable structure. More...
 
bool reliable_empty (const struct reliable *rel)
 Check whether a reliable structure is empty. More...
 
void reliable_send_purge (struct reliable *rel, const struct reliable_ack *ack)
 Remove acknowledged packets from a reliable structure. More...
 
static const char * reliable_print_ids (const struct reliable *rel, struct gc_arena *gc)
 
bool reliable_can_get (const struct reliable *rel)
 Check whether a reliable structure has any free buffers available for use. More...
 
bool reliable_not_replay (const struct reliable *rel, packet_id_type id)
 Check that a received packet's ID is not a replay. More...
 
bool reliable_wont_break_sequentiality (const struct reliable *rel, packet_id_type id)
 Check that a received packet's ID can safely be stored in the reliable structure's processing window. More...
 
struct bufferreliable_get_buf (struct reliable *rel)
 Get the buffer of a free reliable entry in which to store a packet. More...
 
struct bufferreliable_get_buf_output_sequenced (struct reliable *rel)
 Get the buffer of free reliable entry and check whether the outgoing acknowledgment sequence is still okay. More...
 
struct bufferreliable_get_buf_sequenced (struct reliable *rel)
 Get the buffer of the next sequential and active entry. More...
 
bool reliable_can_send (const struct reliable *rel)
 Check whether a reliable structure has any active entries ready to be (re)sent. More...
 
struct bufferreliable_send (struct reliable *rel, int *opcode)
 Get the next packet to send to the remote peer. More...
 
void reliable_schedule_now (struct reliable *rel)
 Reschedule all entries of a reliable structure to be ready for (re)sending immediately. More...
 
interval_t reliable_send_timeout (const struct reliable *rel)
 Determined how many seconds until the earliest resend should be attempted. More...
 
void reliable_mark_active_incoming (struct reliable *rel, struct buffer *buf, packet_id_type pid, int opcode)
 Mark the reliable entry associated with the given buffer as active incoming. More...
 
void reliable_mark_active_outgoing (struct reliable *rel, struct buffer *buf, int opcode)
 Mark the reliable entry associated with the given buffer as active outgoing. More...
 
void reliable_mark_deleted (struct reliable *rel, struct buffer *buf, bool inc_pid)
 Remove an entry from a reliable structure. More...
 

Macro Definition Documentation

◆ ACK_SIZE

#define ACK_SIZE (   n)    (sizeof(uint8_t) + ((n) ? SID_SIZE : 0) + sizeof(packet_id_type) * (n))

Definition at line 208 of file reliable.c.

Referenced by reliable_ack_adjust_frame_parameters(), and reliable_ack_write().

Function Documentation

◆ reliable_ack_packet_id_present()

static bool reliable_ack_packet_id_present ( struct reliable_ack ack,
packet_id_type  pid 
)
inlinestatic

Definition at line 108 of file reliable.c.

References reliable_ack::len, and reliable_ack::packet_id.

Referenced by reliable_ack_acknowledge_packet_id().

◆ reliable_pid_in_range1()

static bool reliable_pid_in_range1 ( const packet_id_type  test,
const packet_id_type  base,
const unsigned int  extent 
)
inlinestatic

Definition at line 48 of file reliable.c.

Referenced by reliable_get_buf_output_sequenced(), and reliable_pid_min().

◆ reliable_pid_in_range2()

static bool reliable_pid_in_range2 ( const packet_id_type  test,
const packet_id_type  base,
const unsigned int  extent 
)
inlinestatic

Definition at line 74 of file reliable.c.

Referenced by reliable_wont_break_sequentiality().

◆ reliable_pid_min()

static bool reliable_pid_min ( const packet_id_type  p1,
const packet_id_type  p2 
)
inlinestatic

◆ reliable_print_ids()

static const char* reliable_print_ids ( const struct reliable rel,
struct gc_arena gc 
)
static