33 #ifdef ENABLE_FRAGMENT 54 #define FRAG_TTL_SEC 10 57 #define FRAG_WAKEUP_INTERVAL 5 71 #define FRAG_MAP_MASK 0xFFFFFFFF 154 #define MAX_FRAG_PKT_SIZE 65536 194 #define hton_fragment_header_type(x) htonl(x) 198 #define ntoh_fragment_header_type(x) ntohl(x) 202 #define FRAG_TYPE_MASK 0x00000003 204 #define FRAG_TYPE_SHIFT 0 208 #define FRAG_YES_NOTLAST 1 211 #define FRAG_YES_LAST 2 219 #define FRAG_SEQ_ID_MASK 0x000000ff 221 #define FRAG_SEQ_ID_SHIFT 2 223 #define FRAG_ID_MASK 0x0000001f 225 #define FRAG_ID_SHIFT 10 237 #define FRAG_SIZE_MASK 0x00003fff 239 #define FRAG_SIZE_SHIFT 15 241 #define FRAG_SIZE_ROUND_SHIFT 2 242 #define FRAG_SIZE_ROUND_MASK ((1 << FRAG_SIZE_ROUND_SHIFT) - 1) 250 #define FRAG_EXTRA_MASK 0x0000ffff 252 #define FRAG_EXTRA_SHIFT 15
bool received_os_mtu_hint
Whether the operating system has explicitly recommended an MTU value.
int outgoing_seq_id
Fragment sequence ID of the current fragmented packet waiting to be sent.
int outgoing_frag_size
Size in bytes of each part to be sent, except for the last part which may be smaller.
Fragmentation and reassembly state for one VPN tunnel instance.
Packet geometry parameters.
int outgoing_frag_id
The fragment ID of the next part to be sent.
Structure for reassembling one incoming fragmented packet.
bool defined
Whether reassembly is currently taking place in this structure.
static bool fragment_outgoing_defined(struct fragment_master *f)
Check whether a fragment_master structure contains fragments ready to be sent.
bool fragment_ready_to_send(struct fragment_master *f, struct buffer *buf, const struct frame *frame)
Check whether outgoing fragments are ready to be send, and if so make one available.
int max_frag_size
Maximum size of each fragment.
void fragment_outgoing(struct fragment_master *f, struct buffer *buf, const struct frame *frame)
Process an outgoing packet, which may or may not need to be fragmented.
int seq_id
Highest fragmentation sequence ID of the packets currently being reassembled.
int len
Length in bytes of the actual content within the allocated memory.
struct event_timeout wakeup
Timeout structure used by the main event loop to know when to do fragmentation housekeeping.
static void fragment_housekeeping(struct fragment_master *f, struct frame *frame, struct timeval *tv)
Perform housekeeping of a fragment_master structure.
void fragment_wakeup(struct fragment_master *f, struct frame *frame)
bool event_timeout_trigger(struct event_timeout *et, struct timeval *tv, const int et_const_retry)
List of fragment structures for reassembling multiple incoming packets concurrently.
struct buffer outgoing
Buffer containing the remaining parts of the fragmented packet being sent.
int index
Index of the packet being reassembled with the highest fragmentation sequence ID into the fragment_li...
uint32_t fragment_header_type
Fragmentation information is stored in a 32-bit packet header.
Wrapper structure for dynamically allocated memory.
struct buffer buf
Buffer in which received datagrams are reassembled.
void fragment_frame_init(struct fragment_master *f, const struct frame *frame)
Allocate internal packet buffers for a fragment_master structure.
void fragment_free(struct fragment_master *f)
Free a fragment_master structure and its internal packet buffers.
struct fragment_master * fragment_init(struct frame *frame)
Allocate and initialize a fragment_master structure.
#define N_FRAG_BUF
Number of packet buffers for reassembling incoming fragmented packets.
void fragment_incoming(struct fragment_master *f, struct buffer *buf, const struct frame *frame)
Process an incoming packet, which may or may not be fragmented.
time_t timestamp
Timestamp for time-to-live purposes.