ROHC compression/decompression library
|
ROHC decompression context for the RTP profile. More...
#include "d_udp.h"
#include "d_ip.h"
#include "rohc_traces_internal.h"
#include "rohc_bit_ops.h"
#include "rohc_debug.h"
#include "rohc_utils.h"
#include "sdvl.h"
#include "crc.h"
#include "schemes/scaled_rtp_ts.h"
#include "rohc_decomp_detect_packet.h"
#include "protocols/udp.h"
#include "protocols/rtp.h"
#include <string.h>
#include <assert.h>
Data Structures | |
struct | d_rtp_context |
Define the RTP part of the decompression profile context. More... | |
Functions | |
static void | d_rtp_destroy (void *const context) |
Destroy the given RTP context. | |
static rohc_packet_t | rtp_detect_packet_type (const struct rohc_decomp_ctxt *const context, const uint8_t *const rohc_packet, const size_t rohc_length, const size_t large_cid_len) |
Detect the type of ROHC packet for RTP profile. | |
static rohc_packet_t | rtp_choose_uo1_variant (const struct rohc_decomp_ctxt *const context, const uint8_t *const packet, const size_t rohc_length) |
Choose between UO-1-RTP, UO-1-TS, and UO-1-ID variants. | |
static rohc_packet_t | rtp_choose_uor2_variant (const struct rohc_decomp_ctxt *const context, const uint8_t *const packet, const size_t rohc_length, const size_t large_cid_len) |
Choose between UOR-2-RTP, UOR-2-TS, and UOR-2-ID variants. | |
static int | rtp_parse_static_rtp (const struct rohc_decomp_ctxt *const context, const unsigned char *packet, size_t length, struct rohc_extr_bits *const bits) |
Parse the UDP/RTP static part of the ROHC packet. | |
static int | rtp_parse_dynamic_rtp (const struct rohc_decomp_ctxt *const context, const uint8_t *packet, const size_t length, struct rohc_extr_bits *const bits) |
Parse the UDP/RTP dynamic part of the ROHC packet. | |
static int | rtp_parse_ext3 (const struct rohc_decomp_ctxt *const context, const unsigned char *const rohc_data, const size_t rohc_data_len, const rohc_packet_t packet_type, struct rohc_extr_bits *const bits) |
Parse the extension 3 of the UO-1-ID or UOR-2* packet. | |
static bool | is_uor2_reparse_required (const rohc_packet_t packet_type, const int are_all_ipv4_rnd) |
Does the UOR-2* packet need to be parsed again? | |
static int | rtp_parse_uo_remainder (const struct rohc_decomp_ctxt *const context, const unsigned char *packet, unsigned int length, struct rohc_extr_bits *const bits) |
Parse the UDP/RTP tail of the UO* ROHC packets. | |
static bool | rtp_decode_values_from_bits (const struct rohc_decomp_ctxt *context, const struct rohc_extr_bits bits, struct rohc_decoded_values *const decoded) |
Decode UDP values from extracted bits. | |
static int | rtp_build_uncomp_rtp (const struct rohc_decomp_ctxt *const context, const struct rohc_decoded_values decoded, unsigned char *dest, const unsigned int payload_len) |
Build an uncompressed UDP/RTP header. | |
static void | rtp_update_context (const struct rohc_decomp_ctxt *context, const struct rohc_decoded_values decoded) |
Update context with decoded UDP/RTP values. | |
static bool | is_outer_ipv4_ctxt (const struct d_generic_context *const ctxt) |
Is the outer IP header IPv4 wrt context? | |
static bool | is_outer_ipv4_rnd_ctxt (const struct d_generic_context *const ctxt) |
Is the outer IP header IPv4 and its IP-ID random wrt context? | |
static bool | is_inner_ipv4_ctxt (const struct d_generic_context *const ctxt) |
Is the inner IP header IPv4 wrt context? | |
static bool | is_inner_ipv4_rnd_ctxt (const struct d_generic_context *const ctxt) |
Is the inner IP header IPv4 and its IP-ID random wrt context? | |
void * | d_rtp_create (const struct rohc_decomp_ctxt *const context) |
Create the RTP decompression context. | |
Variables | |
struct rohc_decomp_profile | d_rtp_profile |
Define the decompression part of the RTP profile as described in the RFC 3095. |
ROHC decompression context for the RTP profile.
void* d_rtp_create | ( | const struct rohc_decomp_ctxt *const | context | ) |
Create the RTP decompression context.
This function is one of the functions that must exist in one profile for the framework to work.
static void d_rtp_destroy | ( | void *const | context | ) | [static] |
Destroy the given RTP context.
This function is one of the functions that must exist in one profile for the framework to work.
context | The RTP compression context to destroy |
static bool is_inner_ipv4_ctxt | ( | const struct d_generic_context *const | ctxt | ) | [inline, static] |
Is the inner IP header IPv4 wrt context?
ctxt | The generic decompression context |
static bool is_inner_ipv4_rnd_ctxt | ( | const struct d_generic_context *const | ctxt | ) | [inline, static] |
Is the inner IP header IPv4 and its IP-ID random wrt context?
ctxt | The generic decompression context |
static bool is_outer_ipv4_ctxt | ( | const struct d_generic_context *const | ctxt | ) | [inline, static] |
Is the outer IP header IPv4 wrt context?
ctxt | The generic decompression context |
static bool is_outer_ipv4_rnd_ctxt | ( | const struct d_generic_context *const | ctxt | ) | [inline, static] |
Is the outer IP header IPv4 and its IP-ID random wrt context?
ctxt | The generic decompression context |
static bool is_uor2_reparse_required | ( | const rohc_packet_t | packet_type, |
const int | are_all_ipv4_rnd | ||
) | [inline, static] |
Does the UOR-2* packet need to be parsed again?
When parsing a UOR-2* packet, if RND changes, the packet might need to be parsed again with another UOR-2* packet type in mind:
packet_type | The packet type |
are_all_ipv4_rnd | Whether all RND values for outer and inner IP headers are set to 1 |
static int rtp_build_uncomp_rtp | ( | const struct rohc_decomp_ctxt *const | context, |
const struct rohc_decoded_values | decoded, | ||
unsigned char * | dest, | ||
const unsigned int | payload_len | ||
) | [static] |
Build an uncompressed UDP/RTP header.
context | The decompression context |
decoded | The values decoded from the ROHC header |
dest | The buffer to store the UDP/RTP header (MUST be at least of sizeof(struct udphdr) + sizeof(struct rtphdr) length) |
payload_len | The length of the UDP/RTP payload |
static rohc_packet_t rtp_choose_uo1_variant | ( | const struct rohc_decomp_ctxt *const | context, |
const uint8_t *const | packet, | ||
const size_t | rohc_length | ||
) | [static] |
Choose between UO-1-RTP, UO-1-TS, and UO-1-ID variants.
This function is useful to choose which packet type to try to parse in the UO-1* families.
context | The decompression context |
packet | The ROHC packet |
rohc_length | The length of the ROHC packet |
static rohc_packet_t rtp_choose_uor2_variant | ( | const struct rohc_decomp_ctxt *const | context, |
const uint8_t *const | packet, | ||
const size_t | rohc_length, | ||
const size_t | large_cid_len | ||
) | [static] |
Choose between UOR-2-RTP, UOR-2-TS, and UOR-2-ID variants.
This function is useful to choose which packet type to try to decode (may change later, causing a packet reparse) in the UOR-2* family.
context | The decompression context |
packet | The ROHC packet |
rohc_length | The length of the ROHC packet |
large_cid_len | The length of the optional large CID field |
static bool rtp_decode_values_from_bits | ( | const struct rohc_decomp_ctxt * | context, |
const struct rohc_extr_bits | bits, | ||
struct rohc_decoded_values *const | decoded | ||
) | [static] |
Decode UDP values from extracted bits.
The following values are decoded:
context | The decompression context |
bits | The extracted bits |
decoded | OUT: The corresponding decoded values |
static rohc_packet_t rtp_detect_packet_type | ( | const struct rohc_decomp_ctxt *const | context, |
const uint8_t *const | rohc_packet, | ||
const size_t | rohc_length, | ||
const size_t | large_cid_len | ||
) | [static] |
Detect the type of ROHC packet for RTP profile.
context | The decompression context |
rohc_packet | The ROHC packet |
rohc_length | The length of the ROHC packet |
large_cid_len | The length of the optional large CID field |
static int rtp_parse_dynamic_rtp | ( | const struct rohc_decomp_ctxt *const | context, |
const uint8_t * | packet, | ||
const size_t | length, | ||
struct rohc_extr_bits *const | bits | ||
) | [static] |
Parse the UDP/RTP dynamic part of the ROHC packet.
context | The decompression context |
packet | The ROHC packet to parse |
length | The length of the ROHC packet |
bits | OUT: The bits extracted from the ROHC header |
static int rtp_parse_ext3 | ( | const struct rohc_decomp_ctxt *const | context, |
const unsigned char *const | rohc_data, | ||
const size_t | rohc_data_len, | ||
const rohc_packet_t | packet_type, | ||
struct rohc_extr_bits *const | bits | ||
) | [static] |
Parse the extension 3 of the UO-1-ID or UOR-2* packet.
Extension 3 for RTP profile (5.7.5): 0 1 2 3 4 5 6 7 +-----+-----+-----+-----+-----+-----+-----+-----+ 1 | 1 1 | S |R-TS | Tsc | I | ip | rtp | +-----+-----+-----+-----+-----+-----+-----+-----+ 2 | Inner IP header flags | ip2 | if ip = 1 +-----+-----+-----+-----+-----+-----+-----+-----+ 3 | Outer IP header flags | if ip2 = 1 +-----+-----+-----+-----+-----+-----+-----+-----+ 4 | SN | if S = 1 +-----+-----+-----+-----+-----+-----+-----+-----+ | | 4.1 / TS / 1-4 octets, if R-TS = 1 | | +-----+-----+-----+-----+-----+-----+-----+-----+ | | 5 / Inner IP header fields / variable, | | if ip = 1 +-----+-----+-----+-----+-----+-----+-----+-----+ 6 | IP-ID | 2 octets, if I = 1 +-----+-----+-----+-----+-----+-----+-----+-----+ | | 7 / Outer IP header fields / variable, | | if ip2 = 1 +-----+-----+-----+-----+-----+-----+-----+-----+ | | variable, 8 / RTP Header flags and fields / if rtp = 1 | | +-----+-----+-----+-----+-----+-----+-----+-----+
context | The decompression context |
rohc_data | The ROHC data to parse |
rohc_data_len | The length of the ROHC data to parse |
packet_type | The type of ROHC packet to parse |
bits | IN: the bits already found in base header OUT: the bits found in the extension header 3 |
static int rtp_parse_static_rtp | ( | const struct rohc_decomp_ctxt *const | context, |
const unsigned char * | packet, | ||
size_t | length, | ||
struct rohc_extr_bits *const | bits | ||
) | [static] |
Parse the UDP/RTP static part of the ROHC packet.
context | The decompression context |
packet | The ROHC packet to parse |
length | The length of the ROHC packet |
bits | OUT: The bits extracted from the ROHC header |
static int rtp_parse_uo_remainder | ( | const struct rohc_decomp_ctxt *const | context, |
const unsigned char * | packet, | ||
unsigned int | length, | ||
struct rohc_extr_bits *const | bits | ||
) | [static] |
Parse the UDP/RTP tail of the UO* ROHC packets.
context | The decompression context |
packet | The ROHC packet to parse |
length | The length of the ROHC packet |
bits | OUT: The bits extracted from the ROHC header |
static void rtp_update_context | ( | const struct rohc_decomp_ctxt * | context, |
const struct rohc_decoded_values | decoded | ||
) | [static] |
Update context with decoded UDP/RTP values.
The following decoded values are updated in context:
context | The decompression context |
decoded | The decoded values to update in the context |
struct rohc_decomp_profile d_rtp_profile |
{ .id = ROHC_PROFILE_RTP, .new_context = d_rtp_create, .free_context = d_rtp_destroy, .decode = d_generic_decode, .detect_pkt_type = rtp_detect_packet_type, .get_sn = d_generic_get_sn, }
Define the decompression part of the RTP profile as described in the RFC 3095.