ROHC compression/decompression library
|
ROHC decompression context for the UDP-Lite profile. More...
#include "d_udp_lite.h"
#include "rohc_bit_ops.h"
#include "rohc_traces.h"
#include "rohc_debug.h"
#include "rohc_packets.h"
#include "crc.h"
Functions | |
int | udp_lite_decode_uo_tail_udp (struct d_generic_context *context, const unsigned char *packet, unsigned int length, unsigned char *dest) |
Decode the UDP-Lite tail of the UO* ROHC packets. | |
void * | d_udp_lite_create (void) |
Create the UDP-Lite decompression context. | |
void | d_udp_lite_destroy (void *context) |
Destroy the context. | |
int | udp_lite_get_static_part (void) |
Get the size of the static part of an IR packet. | |
int | d_udp_lite_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 for the UDP-Lite profile. | |
unsigned int | udp_lite_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 | udp_lite_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. | |
int | d_udp_lite_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 | udp_lite_decode_dynamic_udp (struct d_generic_context *context, const unsigned char *packet, unsigned int length, unsigned char *dest) |
Decode the UDP-Lite dynamic part of the ROHC packet. | |
int | udp_lite_build_uncompressed_udp (struct d_generic_context *context, struct d_generic_changes *active, unsigned char *dest, int payload_size) |
Build an uncompressed UDP-Lite header. | |
Variables | |
struct d_profile | d_udplite_profile |
Define the decompression part of the UDP-Lite profile as described in the RFC 4019. |
ROHC decompression context for the UDP-Lite profile.
void* d_udp_lite_create | ( | void | ) |
Create the UDP-Lite 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, d_generic_context::build_next_header, d_udp_lite_context::cfi, d_udp_lite_context::cfp, d_generic_context::compute_crc_dynamic, d_generic_context::compute_crc_static, d_generic_create(), d_generic_destroy(), d_generic_context::decode_dynamic_next_header, d_generic_context::decode_static_next_header, d_generic_context::decode_uo_tail, IPPROTO_UDPLITE, d_generic_context::last1, d_generic_context::last2, d_generic_changes::next_header, d_generic_changes::next_header_len, d_generic_context::next_header_len, d_generic_context::next_header_proto, rohc_debugf, d_generic_context::specific, udp_compute_crc_dynamic(), udp_compute_crc_static(), udp_decode_static_udp(), udp_lite_build_uncompressed_udp(), udp_lite_decode_dynamic_udp(), udp_lite_decode_uo_tail_udp(), and zfree.
int d_udp_lite_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) |
dest | The decoded IP packet |
References d_udp_lite_context::cce_packet, d_udp_lite_context::cfi, d_udp_lite_context::cfp, d_generic_decode(), find_packet_type(), PACKET_CCE, PACKET_CCE_OFF, PACKET_IR_DYN, rohc_debugf, ROHC_ERROR, d_context::specific, and d_generic_context::specific.
int d_udp_lite_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 for the UDP-Lite profile.
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_udp_lite_context::cfi, d_udp_lite_context::cfp, d_generic_decode_ir(), d_context::specific, and d_generic_context::specific.
void d_udp_lite_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, d_generic_destroy(), d_generic_context::last1, d_generic_context::last2, d_generic_changes::next_header, and zfree.
int udp_lite_build_uncompressed_udp | ( | struct d_generic_context * | context, |
struct d_generic_changes * | active, | ||
unsigned char * | dest, | ||
int | payload_size | ||
) |
Build an uncompressed UDP-Lite header.
context | The generic decompression context |
active | The UDP-Lite header changes |
dest | The buffer to store the UDP-Lite header (MUST be at least of sizeof(struct udphdr) length) |
payload_size | The length of the UDP-Lite payload |
References d_udp_lite_context::cce_packet, d_udp_lite_context::cfi, d_udp_lite_context::cfp, d_generic_changes::next_header, rohc_debugf, and d_generic_context::specific.
Referenced by d_udp_lite_create().
int udp_lite_decode_dynamic_udp | ( | struct d_generic_context * | context, |
const unsigned char * | packet, | ||
unsigned int | length, | ||
unsigned char * | dest | ||
) |
Decode the UDP-Lite dynamic part of the ROHC packet.
context | The generic decompression context |
packet | The ROHC packet to decode |
length | The length of the ROHC packet |
dest | The decoded UDP header |
References d_udp_lite_context::cfi, d_udp_lite_context::cfp, GET_NEXT_16_BITS, ip_decode_dynamic_ip(), PACKET_IR, PACKET_IR_DYN, d_generic_context::packet_type, rohc_debugf, and d_generic_context::specific.
Referenced by d_udp_lite_create().
int udp_lite_decode_uo_tail_udp | ( | struct d_generic_context * | context, |
const unsigned char * | packet, | ||
unsigned int | length, | ||
unsigned char * | dest | ||
) |
Decode the UDP-Lite tail of the UO* ROHC packets.
context | The generic decompression context |
packet | The ROHC packet to decode |
length | The length of the ROHC packet |
dest | The decoded UDP-Lite header |
References d_udp_lite_context::cfi, d_udp_lite_context::cfp, GET_NEXT_16_BITS, rohc_debugf, and d_generic_context::specific.
Referenced by d_udp_lite_create().
unsigned int udp_lite_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-8, ie. the first byte, the Profile and CRC fields, the dynamic chains (outer and inner IP headers + UDP-Lite header) and the SN.
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 udp_detect_ir_dyn_size().
unsigned int udp_lite_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-8, ie. the first byte, the Profile and CRC fields, the static and dynamic chains (outer and inner IP headers + UDP-Lite header) and the SN.
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. field 3 in the figure) |
References GET_BIT_0, and udp_detect_ir_size().
int udp_lite_get_static_part | ( | void | ) |
Get the size of the static part of an IR packet.
struct d_profile d_udplite_profile |
{ ROHC_PROFILE_UDPLITE, "UDP-Lite / Decompressor", d_udp_lite_decode, d_udp_lite_decode_ir, d_udp_lite_create, d_udp_lite_destroy, udp_lite_detect_ir_size, udp_lite_detect_ir_dyn_size, udp_lite_get_static_part, d_generic_get_sn, }
Define the decompression part of the UDP-Lite profile as described in the RFC 4019.