ROHC compression/decompression library
|
ROHC generic compression context for IP-only, UDP and UDP Lite profiles. More...
#include "rohc_comp_internals.h"
#include "rohc_packets.h"
#include "schemes/list.h"
#include "ip.h"
#include "crc.h"
#include <stdlib.h>
Go to the source code of this file.
Data Structures | |
struct | ipv4_header_info |
Store information about an IPv4 header between the different compressions of IP packets. More... | |
struct | ipv6_header_info |
Store information about an IPv6 header between the different compressions of IP packets. More... | |
struct | ip_header_info |
Store information about an IP (IPv4 or IPv6) header between the different compressions of IP packets. More... | |
struct | generic_tmp_vars |
Structure that contains variables that are used during one single compression of packet. More... | |
struct | c_generic_context |
The generic compression context. More... | |
Functions | |
bool | c_generic_create (struct rohc_comp_ctxt *const context, const rohc_lsb_shift_t sn_shift, const struct net_pkt *const packet) |
Create a new context and initialize it thanks to the given IP packet. | |
void | c_generic_destroy (struct rohc_comp_ctxt *const context) |
Destroy the context. | |
bool | c_generic_check_profile (const struct rohc_comp *const comp, const struct net_pkt *const packet) |
Check if the given packet corresponds to an IP-based profile. | |
void | change_state (struct rohc_comp_ctxt *const context, const rohc_comp_state_t new_state) |
Change the state of the context. | |
rohc_ext_t | decide_extension (const struct rohc_comp_ctxt *const context) |
Decide what extension shall be used in the UO-1-ID/UOR-2 packet. | |
int | c_generic_encode (struct rohc_comp_ctxt *const context, const struct net_pkt *const uncomp_pkt, unsigned char *const rohc_pkt, const size_t rohc_pkt_max_len, rohc_packet_t *const packet_type, size_t *const payload_offset) |
Encode an IP packet according to a pattern decided by several different factors. | |
bool | c_generic_reinit_context (struct rohc_comp_ctxt *const context) |
Re-initialize the given context. | |
bool | c_generic_feedback (struct rohc_comp_ctxt *const context, const struct c_feedback *const feedback) |
Update the profile when feedback is received. | |
bool | c_generic_use_udp_port (const struct rohc_comp_ctxt *const context, const unsigned int port) |
Whether the profile uses the given UDP port. | |
void | decide_state (struct rohc_comp_ctxt *const context) |
Decide the state that should be used for the next packet. | |
void | rohc_get_ipid_bits (const struct rohc_comp_ctxt *const context, size_t *const nr_innermost_bits, size_t *const nr_outermost_bits) |
Get the number of non-random outer/inner IP-ID bits. |
ROHC generic compression context for IP-only, UDP and UDP Lite profiles.
bool c_generic_check_profile | ( | const struct rohc_comp *const | comp, |
const struct net_pkt *const | packet | ||
) |
Check if the given packet corresponds to an IP-based profile.
Conditions are:
This function is one of the functions that must exist in one profile for the framework to work.
comp | The ROHC compressor |
packet | The packet to check |
bool c_generic_create | ( | struct rohc_comp_ctxt *const | context, |
const rohc_lsb_shift_t | sn_shift, | ||
const struct net_pkt *const | packet | ||
) |
Create a new context and initialize it thanks to the given IP packet.
context | The compression context |
sn_shift | The shift parameter (p) to use for encoding SN with W-LSB |
packet | The packet given to initialize the new context |
void c_generic_destroy | ( | struct rohc_comp_ctxt *const | context | ) |
Destroy the context.
This function is one of the functions that must exist in one profile for the framework to work.
context | The compression context |
int c_generic_encode | ( | struct rohc_comp_ctxt *const | context, |
const struct net_pkt *const | uncomp_pkt, | ||
unsigned char *const | rohc_pkt, | ||
const size_t | rohc_pkt_max_len, | ||
rohc_packet_t *const | packet_type, | ||
size_t *const | payload_offset | ||
) |
Encode an IP packet according to a pattern decided by several different factors.
1. parse uncompressed packet (done in rohc_compress3)
2. detect changes between the new uncompressed packet and the context
3. decide new compressor state
4. determine how many bytes are required for every field
5. decide which packet to send
6. code the ROHC header
7. copy the packet payload (done in rohc_compress3)
8. update the context with the new headers
This function is one of the functions that must exist in one profile for the framework to work.
context | The compression context |
uncomp_pkt | The uncompressed packet to encode |
rohc_pkt | OUT: The ROHC packet |
rohc_pkt_max_len | The maximum length of the ROHC packet |
packet_type | OUT: The type of ROHC packet that is created |
payload_offset | OUT: The offset for the payload in the IP packet |
bool c_generic_feedback | ( | struct rohc_comp_ctxt *const | context, |
const struct c_feedback *const | feedback | ||
) |
Update the profile when feedback is received.
This function is one of the functions that must exist in one profile for the framework to work.
context | The compression context |
feedback | The feedback information |
bool c_generic_reinit_context | ( | struct rohc_comp_ctxt *const | context | ) |
Re-initialize the given context.
Make the context restart its initialization with decompressor, ie. it goes in the lowest compression state.
context | The compression context to re-initialize |
bool c_generic_use_udp_port | ( | const struct rohc_comp_ctxt *const | context, |
const unsigned int | port | ||
) |
Whether the profile uses the given UDP port.
This function is one of the functions that must exist in one profile for the framework to work.
context | The compression context |
port | The UDP port number to check |
void change_state | ( | struct rohc_comp_ctxt *const | context, |
const rohc_comp_state_t | new_state | ||
) |
Change the state of the context.
context | The compression context |
new_state | The new state the context must enter in |
rohc_ext_t decide_extension | ( | const struct rohc_comp_ctxt *const | context | ) |
Decide what extension shall be used in the UO-1-ID/UOR-2 packet.
Extensions 0, 1 & 2 are IPv4 only because of the IP-ID.
context | The compression context |
void decide_state | ( | struct rohc_comp_ctxt *const | context | ) |
Decide the state that should be used for the next packet.
The three states are:
context | The compression context |
void rohc_get_ipid_bits | ( | const struct rohc_comp_ctxt *const | context, |
size_t *const | nr_innermost_bits, | ||
size_t *const | nr_outermost_bits | ||
) |
Get the number of non-random outer/inner IP-ID bits.
context | The compression context |
nr_innermost_bits | OUT: the maximum number of IP-ID bits for the innermost IPv4 header |
nr_outermost_bits | OUT: the maximum number of IP-ID bits for the outermost IP header |