ROHC compression/decompression library
|
ROHC generic decompression context for IP-only, UDP and UDP Lite profiles. More...
#include "rohc_decomp.h"
#include "rohc_packets.h"
#include "comp_list.h"
#include "lsb.h"
#include "ip_id.h"
#include "ip.h"
#include <stddef.h>
#include <stdbool.h>
Go to the source code of this file.
Data Structures | |
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, const unsigned char *const rohc_packet, const unsigned int rohc_length, 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, const unsigned char *const rohc_packet, const unsigned int rohc_length, 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_generic_get_sn (struct d_context *context) |
Get the reference SN value of the context. | |
rohc_packet_t | find_packet_type (struct rohc_decomp *decomp, struct d_context *context, const unsigned char *packet, const size_t rohc_length, 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 d_generic_destroy().
#define MAX_ITEM 15 |
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(), list_decomp::create_item, list_decomp::encode_extension, d_generic_context::first_packet_processed, list_decomp::free_table, list_decomp::get_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, | ||
const unsigned char *const | rohc_packet, | ||
const unsigned int | rohc_length, | ||
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 |
rohc_packet | The ROHC packet to decode |
rohc_length | 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, may not exist in packet) |
dest | OUT: 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_get_packet_descr(), 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, | ||
const unsigned char *const | rohc_packet, | ||
const unsigned int | rohc_length, | ||
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 |
rohc_packet | The ROHC packet to decode |
rohc_length | 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::correction_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, 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_generic_changes::ip, ip_get_protocol(), ip_get_version(), IPV4, IPV4_DYN_PART_SIZE, d_generic_context::list_decomp1, d_generic_context::list_decomp2, rohc_debugf, 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 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.
rohc_packet_t find_packet_type | ( | struct rohc_decomp * | decomp, |
struct d_context * | context, | ||
const unsigned char * | packet, | ||
const size_t | rohc_length, | ||
int | second_byte | ||
) |
Find out of which type is the ROHC packet.
decomp | The ROHC decompressor |
context | The decompression context |
packet | The ROHC packet |
rohc_length | 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, may not exist in packet) |
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_debugf, ROHC_PROFILE_RTP, and d_context::specific.
Referenced by d_generic_decode(), and d_udp_lite_decode().