ROHC compression/decompression library
|
Generic framework for RFC3095-based compression profiles such as IP-only, UDP, UDP-Lite, ESP, and RTP profiles. More...
#include "rohc_comp_internals.h"
#include "rohc_packets.h"
#include "schemes/comp_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 | rohc_comp_rfc3095_ctxt |
The generic decompression context for RFC3095-based profiles. More... | |
Functions | |
bool | rohc_comp_rfc3095_create (struct rohc_comp_ctxt *const context, const size_t sn_bits_nr, 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. More... | |
void | rohc_comp_rfc3095_destroy (struct rohc_comp_ctxt *const context) |
Destroy the context. More... | |
bool | rohc_comp_rfc3095_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. More... | |
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. More... | |
int | rohc_comp_rfc3095_encode (struct rohc_comp_ctxt *const context, const struct net_pkt *const uncomp_pkt, uint8_t *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. More... | |
bool | rohc_comp_rfc3095_feedback (struct rohc_comp_ctxt *const context, const enum rohc_feedback_type feedback_type, const uint8_t *const packet, const size_t packet_len, const uint8_t *const feedback_data, const size_t feedback_data_len) |
Update the profile when feedback is received. More... | |
void | rohc_comp_rfc3095_decide_state (struct rohc_comp_ctxt *const context) |
Decide the state that should be used for the next packet. More... | |
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. More... | |
bool | rohc_comp_rfc3095_is_sn_possible (const struct rohc_comp_rfc3095_ctxt *const rfc3095_ctxt, const size_t bits_nr, const size_t add_bits_nr) |
Are the given SN field sizes possible? More... | |
static bool | no_outer_ip_id_bits_required (const struct rohc_comp_rfc3095_ctxt *const ctxt) |
Does the outer IP header require to transmit no non-random IP-ID bit? More... | |
static bool | is_outer_ip_id_bits_possible (const struct rohc_comp_rfc3095_ctxt *const ctxt, const size_t max_ip_id_bits_nr) |
May the outer IP header transmit the required non-random IP-ID bits? More... | |
static bool | no_inner_ip_id_bits_required (const struct rohc_comp_rfc3095_ctxt *const ctxt) |
Does the inner IP header require to transmit no non-random IP-ID bit? More... | |
static bool | is_inner_ip_id_bits_possible (const struct rohc_comp_rfc3095_ctxt *const ctxt, const size_t max_ip_id_bits_nr) |
May the inner IP header transmit the required non-random IP-ID bits? More... | |
static size_t | get_nr_ipv4_non_rnd (const struct rohc_comp_rfc3095_ctxt *const ctxt) |
How many IP headers are IPv4 headers with non-random IP-IDs ? More... | |
static size_t | get_nr_ipv4_non_rnd_with_bits (const struct rohc_comp_rfc3095_ctxt *const ctxt) |
How many IP headers are IPv4 headers with non-random IP-IDs and some bits to transmit ? More... | |
Generic framework for RFC3095-based compression profiles such as IP-only, UDP, UDP-Lite, ESP, and RTP profiles.
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 |
|
inlinestatic |
How many IP headers are IPv4 headers with non-random IP-IDs ?
ctxt | The generic decompression context |
|
inlinestatic |
How many IP headers are IPv4 headers with non-random IP-IDs and some bits to transmit ?
ctxt | The generic decompression context |
|
inlinestatic |
May the inner IP header transmit the required non-random IP-ID bits?
ctxt | The generic decompression context |
max_ip_id_bits_nr | The maximum number of IP-ID bits that may be transmitted |
|
inlinestatic |
May the outer IP header transmit the required non-random IP-ID bits?
ctxt | The generic decompression context |
max_ip_id_bits_nr | The maximum number of IP-ID bits that may be transmitted |
|
inlinestatic |
Does the inner IP header require to transmit no non-random IP-ID bit?
ctxt | The generic decompression context |
|
inlinestatic |
Does the outer IP header require to transmit no non-random IP-ID bit?
ctxt | The generic decompression context |
bool rohc_comp_rfc3095_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 rohc_comp_rfc3095_create | ( | struct rohc_comp_ctxt *const | context, |
const size_t | sn_bits_nr, | ||
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_bits_nr | The maximum number of bits used for SN |
sn_shift | The shift parameter (p) to use for encoding SN with W-LSB |
packet | The packet given to initialize the new context |
void rohc_comp_rfc3095_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_comp_rfc3095_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 rohc_comp_rfc3095_encode | ( | struct rohc_comp_ctxt *const | context, |
const struct net_pkt *const | uncomp_pkt, | ||
uint8_t *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.
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 rohc_comp_rfc3095_feedback | ( | struct rohc_comp_ctxt *const | context, |
const enum rohc_feedback_type | feedback_type, | ||
const uint8_t *const | packet, | ||
const size_t | packet_len, | ||
const uint8_t *const | feedback_data, | ||
const size_t | feedback_data_len | ||
) |
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_type | The feedback type |
packet | The whole feedback packet with CID bits |
packet_len | The length of the whole feedback packet with CID bits |
feedback_data | The feedback data without the CID bits |
feedback_data_len | The length of the feedback data without the CID bits |
bool rohc_comp_rfc3095_is_sn_possible | ( | const struct rohc_comp_rfc3095_ctxt *const | rfc3095_ctxt, |
const size_t | bits_nr, | ||
const size_t | add_bits_nr | ||
) |
Are the given SN field sizes possible?
rfc3095_ctxt | The compression context |
bits_nr | The base number of SN bits |
add_bits_nr | The additional number of SN bits |
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 |