ROHC compression/decompression library
|
ROHC generic decompression context for IP-only, UDP and UDP Lite profiles. More...
Go to the source code of this file.
Classes | |
struct | d_generic_changes |
Store information about an IP header between the different decompressions of IP packets. More... | |
struct | d_generic_context |
The generic decompression context. More... | |
struct | list_decomp |
The list decompressor. More... | |
Defines | |
#define | MAX_ITEM 15 |
#define | LIST_COMP_WINDOW 100 |
#define | L 5 |
Functions | |
void * | d_generic_create (void) |
Create the generic decompression context. | |
void | d_generic_destroy (void *context) |
Destroy the context. | |
int | d_generic_decode (struct rohc_decomp *decomp, struct d_context *context, unsigned char *packet, int size, int second_byte, unsigned char *dest) |
Decode one IR-DYN, UO-0, UO-1 or UOR-2 packet, but not IR packet. | |
int | d_generic_decode_ir (struct rohc_decomp *decomp, struct d_context *context, unsigned char *packet, int plen, int large_cid_len, int is_addcid_used, unsigned char *dest) |
Decode one IR packet. | |
unsigned int | d_generic_detect_ir_size (struct d_context *context, unsigned char *packet, unsigned int plen, unsigned int large_cid_len) |
Find the length of the IR header. | |
unsigned int | d_generic_detect_ir_dyn_size (struct d_context *context, unsigned char *first_byte, unsigned int plen, unsigned int large_cid_len) |
Find the length of the IR-DYN header. | |
int | d_algo_list_decompress (struct list_decomp *decomp, const unsigned char *packet) |
Algorithm of list decompression. | |
int | decode_type_0 (struct list_decomp *decomp, const unsigned char *packet, int gen_id, int ps, int m) |
Decode an extension list type 0. | |
int | decode_type_1 (struct list_decomp *decomp, const unsigned char *packet, int gen_id, int ps, int m, int ref_id) |
Decode an extension list type 1. | |
int | decode_type_2 (struct list_decomp *decomp, const unsigned char *packet, int gen_id, int ps, int ref_id) |
Decode an extension list type 2. | |
int | decode_type_3 (struct list_decomp *decomp, const unsigned char *packet, int gen_id, int ps, int m, int ref_id) |
Decode an extension list type 3. | |
int | d_generic_get_sn (struct d_context *context) |
Get the reference SN value of the context. | |
int | find_packet_type (struct rohc_decomp *decomp, struct d_context *context, const unsigned char *packet, int second_byte) |
Find out of which type is the ROHC packet. |
ROHC generic decompression context for IP-only, UDP and UDP Lite profiles.
#define L 5 |
#define LIST_COMP_WINDOW 100 |
Referenced by check_id(), d_generic_destroy(), decode_type_0(), decode_type_1(), decode_type_2(), and decode_type_3().
#define MAX_ITEM 15 |
int d_algo_list_decompress | ( | struct list_decomp * | decomp, |
const unsigned char * | packet | ||
) |
Algorithm of list decompression.
decomp | The list decompressor |
packet | The ROHC packet to decompress |
References decode_type_0(), decode_type_1(), decode_type_2(), decode_type_3(), GET_BIT_0_3, GET_BIT_4, GET_BIT_6_7, GET_REAL, list_decomp::list_decomp, m, and rohc_debugf.
Referenced by d_generic_detect_ir_dyn_size(), and d_generic_detect_ir_size().
void* d_generic_create | ( | void | ) |
Create the generic decompression context.
This function is one of the functions that must exist in one profile for the framework to work.
References d_generic_context::active1, d_generic_context::active2, list_decomp::check_index, check_ip6_index(), d_generic_context::compute_crc_dynamic, compute_crc_dynamic(), d_generic_context::compute_crc_static, compute_crc_static(), create_ip6_item(), list_decomp::create_item, list_decomp::encode_extension, encode_ip6_extension(), d_generic_context::first_packet_processed, list_decomp::free_table, list_decomp::get_ext_size, get_ip6_ext_size(), ip6_d_init_table(), d_generic_context::last1, d_generic_context::last2, d_generic_context::list_decomp1, d_generic_context::list_decomp2, d_generic_context::next_header_proto, rohc_debugf, and zfree.
Referenced by d_ip_create(), d_rtp_create(), d_udp_create(), and d_udp_lite_create().
int d_generic_decode | ( | struct rohc_decomp * | decomp, |
struct d_context * | context, | ||
unsigned char * | packet, | ||
int | size, | ||
int | second_byte, | ||
unsigned char * | dest | ||
) |
Decode one IR-DYN, UO-0, UO-1 or UOR-2 packet, but not IR packet.
This function is one of the functions that must exist in one profile for the framework to work.
decomp | The ROHC decompressor |
context | The decompression context |
packet | The ROHC packet to decode |
size | The length of the ROHC packet |
second_byte | The offset for the second byte of the ROHC packet (depends on the CID encoding and the packet type) |
dest | The decoded IP packet |
References d_generic_context::active1, d_generic_context::active2, cmp_generic_changes(), d_generic_context::current_packet_time, d_generic_decode(), decode_irdyn(), decode_uo0(), decode_uo1(), decode_uor2(), find_packet_type(), d_generic_changes::ip, ip_get_version(), IPV4, d_generic_context::last1, d_generic_context::last2, d_generic_context::multiple_ip, d_generic_changes::nbo, NO_CONTEXT, PACKET_IR_DYN, d_generic_context::packet_type, PACKET_UO_0, PACKET_UO_1, PACKET_UO_1_ID, PACKET_UO_1_RTP, PACKET_UO_1_TS, PACKET_UOR_2, PACKET_UOR_2_ID, PACKET_UOR_2_RTP, PACKET_UOR_2_TS, d_generic_changes::rnd, rohc_debugf, ROHC_ERROR, ROHC_NEED_REPARSE, d_context::specific, d_context::state, STATIC_CONTEXT, and synchronize().
Referenced by d_generic_decode(), and d_udp_lite_decode().
int d_generic_decode_ir | ( | struct rohc_decomp * | decomp, |
struct d_context * | context, | ||
unsigned char * | packet, | ||
int | plen, | ||
int | large_cid_len, | ||
int | is_addcid_used, | ||
unsigned char * | dest | ||
) |
Decode one IR packet.
This function is one of the functions that must exist in one profile for the framework to work.
decomp | The ROHC decompressor |
context | The decompression context |
packet | The ROHC packet to decode |
plen | The length of the ROHC packet to decode |
large_cid_len | The length of the large CID field |
is_addcid_used | Whether the add-CID field is present or not |
dest | The decoded IP packet |
References d_generic_context::active1, d_generic_context::active2, d_generic_context::build_next_header, build_uncompressed_ip(), c_add_wlsb(), d_generic_context::counter, d_generic_context::current_packet_time, d_decode_dynamic_ip(), d_decode_static_ip(), d_generic_context::decode_dynamic_next_header, d_generic_context::decode_static_next_header, d_generic_context::first_packet_processed, FULL_CONTEXT, GET_BIT_0, d_context::header_16_compressed, d_context::header_16_uncompressed, d_context::header_compressed_size, d_context::header_uncompressed_size, d_generic_changes::ip, ip_get_hdrlen(), ip_get_protocol(), ip_get_version(), d_generic_context::last1, d_generic_context::last2, d_generic_context::list_decomp1, d_generic_context::list_decomp2, d_generic_context::multiple_ip, d_generic_changes::next_header, d_generic_changes::next_header_len, d_generic_context::next_header_proto, PACKET_IR, d_generic_context::packet_type, rohc_debugf, ROHC_ERROR, d_generic_changes::size_list, d_context::specific, d_context::state, synchronize(), and update_inter_packet().
Referenced by d_udp_lite_decode_ir().
void d_generic_destroy | ( | void * | 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 |
References d_generic_context::active1, d_generic_context::active2, destroy_list(), list_decomp::free_table, d_generic_context::last1, d_generic_context::last2, LIST_COMP_WINDOW, d_generic_context::list_decomp1, d_generic_context::list_decomp2, list_decomp::list_table, d_generic_context::specific, list_decomp::temp_list, and zfree.
Referenced by d_rtp_create(), d_udp_create(), d_udp_destroy(), d_udp_lite_create(), and d_udp_lite_destroy().
unsigned int d_generic_detect_ir_dyn_size | ( | struct d_context * | context, |
unsigned char * | packet, | ||
unsigned int | plen, | ||
unsigned int | large_cid_len | ||
) |
Find the length of the IR-DYN header.
This function is one of the functions that must exist in one profile for the framework to work.
Basic structure of the IR-DYN packet (5.7.7.2): 0 1 2 3 4 5 6 7 --- --- --- --- --- --- --- --- 1 : Add-CID octet : if for small CIDs and CID != 0 +---+---+---+---+---+---+---+---+ 2 | 1 1 1 1 1 0 0 0 | IR-DYN packet type +---+---+---+---+---+---+---+---+ : : 3 / 0-2 octets of CID info / 1-2 octets if for large CIDs : : +---+---+---+---+---+---+---+---+ 4 | Profile | 1 octet +---+---+---+---+---+---+---+---+ 5 | CRC | 1 octet +---+---+---+---+---+---+---+---+ | | 6 / Dynamic chain / variable length | | +---+---+---+---+---+---+---+---+ 7 | SN | 2 octets if not RTP +---+---+---+---+---+---+---+---+ : : 8 / Payload / variable length : : - - - - - - - - - - - - - - - -
The function computes the length of the fields 2 + 4-7, ie. the first byte, the Profile and CRC fields and the dynamic chains (outer and inner IP headers).
context | The decompression context |
packet | The IR-DYN packet after the Add-CID byte if present (ie. field 2 in the figure) |
plen | The length of the IR-DYN packet minus the Add-CID byte |
large_cid_len | The size of the large CID field (ie. field 3 in the figure) |
References d_generic_context::active1, d_generic_context::active2, d_algo_list_decompress(), d_generic_changes::ip, ip_get_protocol(), ip_get_version(), IPV4, IPV4_DYN_PART_SIZE, d_generic_context::list_decomp1, d_generic_context::list_decomp2, list_decomp::size_ext, d_context::specific, and version.
Referenced by ip_detect_ir_dyn_size(), and rtp_detect_ir_dyn_size().
unsigned int d_generic_detect_ir_size | ( | struct d_context * | context, |
unsigned char * | packet, | ||
unsigned int | plen, | ||
unsigned int | large_cid_len | ||
) |
Find the length of the IR header.
This function is one of the functions that must exist in one profile for the framework to work.
Basic structure of the IR packet (5.7.7.1): 0 1 2 3 4 5 6 7 --- --- --- --- --- --- --- --- 1 | Add-CID octet | if for small CIDs and CID != 0 +---+---+---+---+---+---+---+---+ 2 | 1 1 1 1 1 1 0 | D | +---+---+---+---+---+---+---+---+ | | 3 / 0-2 octets of CID info / 1-2 octets if for large CIDs | | +---+---+---+---+---+---+---+---+ 4 | Profile | 1 octet +---+---+---+---+---+---+---+---+ 5 | CRC | 1 octet +---+---+---+---+---+---+---+---+ | | 6 | Static chain | variable length | | +---+---+---+---+---+---+---+---+ | | 7 | Dynamic chain | present if D = 1, variable length | | +---+---+---+---+---+---+---+---+ 8 | SN | 2 octets if not RTP +---+---+---+---+---+---+---+---+ | | 9 | Payload | variable length | | - - - - - - - - - - - - - - - -
The function computes the length of the fields 2 + 4-7, ie. the first byte, the Profile and CRC fields and the static and dynamic chains (outer and inner IP headers).
context | The decompression context |
packet | The pointer on the IR packet minus the Add-CID byte (ie. the field 2 in the figure) |
plen | The length of the IR packet minus the Add-CID byte |
large_cid_len | The size of the large CID field (ie. the field 3 in the figure) |
References d_algo_list_decompress(), GET_BIT_0, GET_REAL, d_profile::get_static_part, IPV4, IPV4_DYN_PART_SIZE, IPV6, d_generic_context::list_decomp1, d_generic_context::list_decomp2, d_context::profile, rohc_debugf, list_decomp::size_ext, and d_context::specific.
Referenced by ip_detect_ir_size(), and rtp_detect_ir_size().
int d_generic_get_sn | ( | struct d_context * | context | ) |
Get the reference SN value of the context.
This function is one of the functions that must exist in one profile for the framework to work.
context | The decompression context |
References d_get_lsb_ref(), d_generic_context::sn, and d_context::specific.
int decode_type_0 | ( | struct list_decomp * | decomp, |
const unsigned char * | packet, | ||
int | gen_id, | ||
int | ps, | ||
int | m | ||
) |
Decode an extension list type 0.
decomp | The list decompressor |
packet | The ROHC packet to decompress |
gen_id | The id of the current list |
ps | The ps field |
m | The m fiel |
References list_decomp::based_table, check_id(), list_decomp::counter, list_decomp::counter_list, list_decomp::create_item, empty_list(), c_list::first_elt, c_list::gen_id, GET_BIT_0_2, GET_BIT_0_6, GET_BIT_3, GET_BIT_4_6, GET_BIT_7, list_decomp::get_ext_size, insert_elt(), d_translation::known, L, LIST_COMP_WINDOW, list_decomp::list_table, m, list_decomp::ref_list, list_decomp::ref_ok, rohc_debugf, and list_decomp::trans_table.
Referenced by d_algo_list_decompress().
int decode_type_1 | ( | struct list_decomp * | decomp, |
const unsigned char * | packet, | ||
int | gen_id, | ||
int | ps, | ||
int | m, | ||
int | ref_id | ||
) |
Decode an extension list type 1.
decomp | The list decompressor |
packet | The ROHC packet to decompress |
gen_id | The id of the current list |
ps | The ps field |
m | The m fiel |
ref_id | The id of the reference list |
References list_decomp::based_table, check_id(), list_decomp::check_index, list_decomp::counter, list_decomp::counter_list, list_decomp::create_item, empty_list(), c_list::first_elt, c_list::gen_id, GET_BIT_0_2, GET_BIT_0_6, GET_BIT_3, GET_BIT_4_6, GET_BIT_7, get_bit_index(), get_elt(), list_decomp::get_ext_size, list_elt::index_table, insert_elt(), list_elt::item, d_translation::known, L, LIST_COMP_WINDOW, list_decomp::list_table, list_decomp::ref_list, list_decomp::ref_ok, rohc_debugf, size_list(), and list_decomp::trans_table.
Referenced by d_algo_list_decompress().
int decode_type_2 | ( | struct list_decomp * | decomp, |
const unsigned char * | packet, | ||
int | gen_id, | ||
int | ps, | ||
int | ref_id | ||
) |
Decode an extension list type 2.
decomp | The list decompressor |
packet | The ROHC packet to decompress |
gen_id | The id of the current list |
ps | The ps field |
ref_id | The id of the reference list |
References check_id(), list_decomp::counter, list_decomp::counter_list, empty_list(), c_list::first_elt, c_list::gen_id, get_bit_index(), get_elt(), list_elt::index_table, insert_elt(), list_elt::item, L, LIST_COMP_WINDOW, list_decomp::list_table, MIN, list_decomp::ref_list, list_decomp::ref_ok, rohc_debugf, and size_list().
Referenced by d_algo_list_decompress().
int decode_type_3 | ( | struct list_decomp * | decomp, |
const unsigned char * | packet, | ||
int | gen_id, | ||
int | ps, | ||
int | m, | ||
int | ref_id | ||
) |
Decode an extension list type 3.
decomp | The list decompressor |
packet | The ROHC packet to decompress |
gen_id | The id of the current list |
ps | The ps field |
m | The m fiel |
ref_id | The id of the reference list |
References list_decomp::based_table, check_id(), list_decomp::check_index, list_decomp::counter, list_decomp::counter_list, list_decomp::create_item, empty_list(), c_list::first_elt, c_list::gen_id, GET_BIT_0_2, GET_BIT_0_6, GET_BIT_3, GET_BIT_4_6, GET_BIT_7, get_bit_index(), get_elt(), list_decomp::get_ext_size, GET_REAL, list_elt::index_table, insert_elt(), list_elt::item, d_translation::known, L, LIST_COMP_WINDOW, list_decomp::list_table, MIN, list_decomp::ref_list, list_decomp::ref_ok, rohc_debugf, size_list(), list_decomp::temp_list, and list_decomp::trans_table.
Referenced by d_algo_list_decompress().
int find_packet_type | ( | struct rohc_decomp * | decomp, |
struct d_context * | context, | ||
const unsigned char * | packet, | ||
int | second_byte | ||
) |
Find out of which type is the ROHC packet.
decomp | The ROHC decompressor |
context | The decompression context |
packet | The ROHC packet |
second_byte | The offset for the second byte of the ROHC packet (depends on the CID encoding and the packet type) |
References GET_BIT_5, GET_BIT_5_7, GET_BIT_6, GET_BIT_6_7, GET_BIT_7, d_profile::id, d_generic_changes::ip, ip_get_version(), IPV4, d_generic_context::last1, d_generic_context::last2, d_generic_context::multiple_ip, PACKET_IR, PACKET_IR_DYN, PACKET_UNKNOWN, PACKET_UO_0, PACKET_UO_1, PACKET_UO_1_ID, PACKET_UO_1_RTP, PACKET_UO_1_TS, PACKET_UOR_2, PACKET_UOR_2_ID, PACKET_UOR_2_RTP, PACKET_UOR_2_TS, d_context::profile, d_generic_changes::rnd, ROHC_PROFILE_RTP, and d_context::specific.
Referenced by d_generic_decode(), and d_udp_lite_decode().