|
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/decomp_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 bool | d_rtp_create (const struct rohc_decomp_ctxt *const context, struct rohc_decomp_rfc3095_ctxt **const persist_ctxt, struct rohc_decomp_volat_ctxt *const volat_ctxt) |
| Create the RTP decompression context. More... | |
| static void | d_rtp_destroy (struct rohc_decomp_rfc3095_ctxt *const rfc3095_ctxt, const struct rohc_decomp_volat_ctxt *const volat_ctxt) |
| Destroy the given RTP context. More... | |
| 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. More... | |
| 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. More... | |
| 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. More... | |
| static int | rtp_parse_static_rtp (const struct rohc_decomp_ctxt *const context, const uint8_t *packet, size_t length, struct rohc_extr_bits *const bits) |
| Parse the UDP/RTP static part of the ROHC packet. More... | |
| 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. More... | |
| static int | rtp_parse_ext3 (const struct rohc_decomp_ctxt *const context, const uint8_t *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. More... | |
| 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? More... | |
| static int | rtp_parse_rtp_hdr_fields (const struct rohc_decomp_ctxt *const context, const uint8_t *const rohc_data, const size_t rohc_data_len, struct rohc_extr_bits *const bits) |
| Parse the RTP header flags and fields of extension 3. More... | |
| static int | rtp_parse_uo_remainder (const struct rohc_decomp_ctxt *const context, const uint8_t *packet, unsigned int length, struct rohc_extr_bits *const bits) |
| Parse the UDP/RTP tail of the UO* ROHC packets. More... | |
| static bool | rtp_decode_values_from_bits (const struct rohc_decomp_ctxt *context, const struct rohc_extr_bits *const bits, struct rohc_decoded_values *const decoded) |
| Decode UDP values from extracted bits. More... | |
| static int | rtp_build_uncomp_rtp (const struct rohc_decomp_ctxt *const context, const struct rohc_decoded_values *const decoded, uint8_t *const dest, const unsigned int payload_len) |
| Build an uncompressed UDP/RTP header. More... | |
| static void | rtp_update_context (struct rohc_decomp_ctxt *const context, const struct rohc_decoded_values *const decoded) |
| Update context with decoded UDP/RTP values. More... | |
| static bool | is_outer_ipv4_ctxt (const struct rohc_decomp_rfc3095_ctxt *const ctxt) |
| Is the outer IP header IPv4 wrt context? More... | |
| static bool | is_outer_ipv4_rnd_ctxt (const struct rohc_decomp_rfc3095_ctxt *const ctxt) |
| Is the outer IP header IPv4 and its IP-ID random wrt context? More... | |
| static bool | is_inner_ipv4_ctxt (const struct rohc_decomp_rfc3095_ctxt *const ctxt) |
| Is the inner IP header IPv4 wrt context? More... | |
| static bool | is_inner_ipv4_rnd_ctxt (const struct rohc_decomp_rfc3095_ctxt *const ctxt) |
| Is the inner IP header IPv4 and its IP-ID random wrt context? More... | |
Variables | |
| const struct rohc_decomp_profile | d_rtp_profile |
| Define the decompression part of the RTP profile as described in the RFC 3095. More... | |
ROHC decompression context for the RTP profile.
|
static |
Create the RTP decompression context.
This function is one of the functions that must exist in one profile for the framework to work.
| context | The decompression context | |
| [out] | persist_ctxt | The persistent part of the decompression context |
| [out] | volat_ctxt | The volatile part of the decompression 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.
| rfc3095_ctxt | The persistent decompression context for the RFC3095 profiles |
| volat_ctxt | The volatile decompression context |
|
inlinestatic |
Is the inner IP header IPv4 wrt context?
| ctxt | The generic decompression context |
|
inlinestatic |
Is the inner IP header IPv4 and its IP-ID random wrt context?
| ctxt | The generic decompression context |
|
inlinestatic |
Is the outer IP header IPv4 wrt context?
| ctxt | The generic decompression context |
|
inlinestatic |
Is the outer IP header IPv4 and its IP-ID random wrt context?
| ctxt | The generic decompression context |
|
inlinestatic |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
Parse the RTP header flags and fields of extension 3.
RTP header flags and fields
0 1 2 3 4 5 6 7
..... ..... ..... ..... ..... ..... ..... .....
1 | Mode |R-PT | M | R-X |CSRC | TSS | TIS | if rtp = 1
..... ..... ..... ..... ..... ..... ..... .....
2 | R-P | RTP PT | if R-PT = 1
..... ..... ..... ..... ..... ..... ..... .....
3 / Compressed CSRC list / if CSRC = 1
..... ..... ..... ..... ..... ..... ..... .....
4 / TS_STRIDE / 1-4 oct if TSS = 1
..... ..... ..... ..... ..... ..... ..... ....
5 / TIME_STRIDE (milliseconds) / 1-4 oct if TIS = 1
..... ..... ..... ..... ..... ..... ..... .....| context | The decompression context |
| rohc_data | The ROHC data to parse |
| rohc_data_len | The length of the ROHC data to parse |
| bits | IN: the bits already found in base header OUT: the bits found in the extension header 3 |
|
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 |
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 |
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 |
| const struct rohc_decomp_profile d_rtp_profile |
Define the decompression part of the RTP profile as described in the RFC 3095.
1.8.13