Go to the documentation of this file.
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
440 return f->outgoing.len > 0;
void fragment_frame_init(struct fragment_master *f, const struct frame *frame)
Allocate internal packet buffers for a fragment_master structure.
bool received_os_mtu_hint
Whether the operating system has explicitly recommended an MTU value.
struct fragment_master * fragment_init(struct frame *frame)
Allocate and initialize a fragment_master structure.
void fragment_free(struct fragment_master *f)
Free a fragment_master structure and its internal packet buffers.
Fragmentation and reassembly state for one VPN tunnel instance.
int outgoing_seq_id
Fragment sequence ID of the current fragmented packet waiting to be sent.
bool defined
Whether reassembly is currently taking place in this structure.
Structure for reassembling one incoming fragmented packet.
Packet geometry parameters.
struct fragment fragments[N_FRAG_BUF]
Array of reassembly structures, each can contain one whole packet.
struct buffer outgoing
Buffer containing the remaining parts of the fragmented packet being sent.
List of fragment structures for reassembling multiple incoming packets concurrently.
int seq_id
Highest fragmentation sequence ID of the packets currently being reassembled.
struct event_timeout wakeup
Timeout structure used by the main event loop to know when to do fragmentation housekeeping.
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.
static void fragment_housekeeping(struct fragment_master *f, struct frame *frame, struct timeval *tv)
Perform housekeeping of a fragment_master structure.
Wrapper structure for dynamically allocated memory.
void fragment_wakeup(struct fragment_master *f, struct frame *frame)
int max_frag_size
Maximum size of each fragment.
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.
uint32_t fragment_header_type
Fragmentation information is stored in a 32-bit packet header.
struct buffer buf
Buffer in which received datagrams are reassembled.
bool event_timeout_trigger(struct event_timeout *et, struct timeval *tv, const int et_const_retry)
This is the principal function for testing and triggering recurring timers.
struct buffer outgoing_return
Buffer used by fragment_ready_to_send() to return a part to send.
int index
Index of the packet being reassembled with the highest fragmentation sequence ID into the fragment_li...
int outgoing_frag_size
Size in bytes of each part to be sent, except for the last part which may be smaller.
#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.
struct fragment_list incoming
List of structures for reassembling incoming packets.
int outgoing_frag_id
The fragment ID of the next part to be sent.
time_t timestamp
Timestamp for time-to-live purposes.
static bool fragment_outgoing_defined(struct fragment_master *f)
Check whether a fragment_master structure contains fragments ready to be sent.