ROHC compression/decompression library
|
ROHC decompression routines. More...
#include "rohc_decomp.h"
#include "rohc_decomp_internals.h"
#include "rohc_traces_internal.h"
#include "rohc_time_internal.h"
#include "rohc_utils.h"
#include "rohc_bit_ops.h"
#include "rohc_debug.h"
#include "feedback_create.h"
#include "feedback_parse.h"
#include "sdvl.h"
#include "rohc_add_cid.h"
#include "rohc_decomp_detect_packet.h"
#include "crc.h"
#include <string.h>
#include <stdarg.h>
#include <assert.h>
Data Structures | |
struct | rohc_decomp_stream |
The stream information about a decompressed packet. More... | |
Functions | |
static bool | rohc_decomp_create_contexts (struct rohc_decomp *const decomp, const rohc_cid_t max_cid) |
Create the array of decompression contexts. More... | |
static const struct rohc_decomp_profile * | find_profile (const struct rohc_decomp *const decomp, const rohc_profile_t profile_id) |
Find the ROHC profile with the given profile ID. More... | |
static struct rohc_decomp_ctxt * | context_create (struct rohc_decomp *decomp, const rohc_cid_t cid, const struct rohc_decomp_profile *const profile, const struct rohc_ts arrival_time) |
Create one new decompression context with profile specific data. More... | |
static struct rohc_decomp_ctxt * | find_context (const struct rohc_decomp *const decomp, const rohc_cid_t cid) |
Find one decompression context thanks to its CID. More... | |
static void | context_free (struct rohc_decomp_ctxt *const context) |
Destroy one decompression context and the profile specific data associated with it. More... | |
static int | rohc_decomp_get_profile_index (const rohc_profile_t profile) |
Get profile index if profile exists. More... | |
static rohc_status_t | d_decode_header (struct rohc_decomp *decomp, const struct rohc_buf rohc_packet, struct rohc_buf *const uncomp_packet, struct rohc_buf *const rcvd_feedback, struct rohc_decomp_stream *const stream) |
Decompress the compressed headers. More... | |
static bool | rohc_decomp_decode_cid (struct rohc_decomp *decomp, const uint8_t *packet, unsigned int len, rohc_cid_t *const cid, size_t *const add_cid_len, size_t *const large_cid_len) |
Decode the CID of a packet. More... | |
static void | rohc_decomp_parse_padding (const struct rohc_decomp *const decomp, struct rohc_buf *const packet) |
Parse padding bits if some are present. More... | |
static rohc_status_t | rohc_decomp_find_context (struct rohc_decomp *const decomp, const uint8_t *const packet, const size_t packet_len, const rohc_cid_type_t cid, const size_t large_cid_len, const struct rohc_ts arrival_time, rohc_profile_t *const profile_id, struct rohc_decomp_ctxt **const context, bool *const context_created) |
Find the context for the given ROHC packet. More... | |
static rohc_status_t | rohc_decomp_decode_pkt (struct rohc_decomp *const decomp, struct rohc_decomp_ctxt *const context, const struct rohc_buf rohc_packet, const size_t add_cid_len, const size_t large_cid_len, struct rohc_buf *const uncomp_packet, rohc_packet_t *const packet_type, bool *const do_change_mode) |
Decode one ROHC packet. More... | |
static rohc_status_t | rohc_decomp_try_decode_pkt (const struct rohc_decomp *const decomp, const struct rohc_decomp_ctxt *const context, const rohc_packet_t packet_type, const struct rohc_decomp_crc *const extr_crc_bits, const void *const extr_bits, const size_t payload_len, void *const decoded_values, struct rohc_buf *const uncomp_packet) |
Try to decode one ROHC packet. More... | |
static bool | rohc_decomp_check_ir_crc (const struct rohc_decomp *const decomp, const struct rohc_decomp_ctxt *const context, const uint8_t *const rohc_hdr, const size_t rohc_hdr_len, const size_t add_cid_len, const size_t large_cid_len, const uint8_t crc_packet) |
Check whether the CRC on IR or IR-DYN header is correct or not. More... | |
static void | rohc_decomp_stats_add_success (struct rohc_decomp_ctxt *const context, const size_t comp_hdr_len, const size_t uncomp_hdr_len) |
Update statistics upon successful decompression. More... | |
static void | rohc_decomp_update_context (struct rohc_decomp_ctxt *const context, const void *const decoded, const size_t payload_len, const struct rohc_ts pkt_arrival_time, bool *const do_change_mode) |
Update context with decoded values. More... | |
static bool | rohc_decomp_parse_feedbacks (struct rohc_decomp *const decomp, struct rohc_buf *const rohc_data, struct rohc_buf *const feedbacks) |
Parse zero or more feedback items from the given ROHC data. More... | |
static bool | rohc_decomp_parse_feedback (struct rohc_decomp *const decomp, struct rohc_buf *const rohc_data, struct rohc_buf *const feedback, size_t *const feedback_len) |
Parse a feedback item from the given ROHC data. More... | |
static bool | rohc_decomp_feedback_ack (struct rohc_decomp *const decomp, const struct rohc_decomp_stream *const infos, struct rohc_buf *const feedback) |
Build a positive ACK feedback. More... | |
static bool | rohc_decomp_feedback_nack (struct rohc_decomp *const decomp, const struct rohc_decomp_stream *const infos, struct rohc_buf *const feedback) |
Build a negative ACK feedback. More... | |
static void | rohc_decomp_reset_stats (struct rohc_decomp *const decomp) |
Reset all the statistics of the given ROHC decompressor. More... | |
struct rohc_decomp * | rohc_decomp_new2 (const rohc_cid_type_t cid_type, const rohc_cid_t max_cid, const rohc_mode_t mode) |
Create a new ROHC decompressor. More... | |
void | rohc_decomp_free (struct rohc_decomp *const decomp) |
Destroy the given ROHC decompressor. More... | |
rohc_status_t | rohc_decompress3 (struct rohc_decomp *const decomp, const struct rohc_buf rohc_packet, struct rohc_buf *const uncomp_packet, struct rohc_buf *const rcvd_feedback, struct rohc_buf *const feedback_send) |
Decompress the given ROHC packet into one uncompressed packet. More... | |
const char * | rohc_decomp_get_state_descr (const rohc_decomp_state_t state) |
Give a description for the given ROHC decompression context state. More... | |
bool | rohc_decomp_get_last_packet_info (const struct rohc_decomp *const decomp, rohc_decomp_last_packet_info_t *const info) |
Get some information about the last decompressed packet. More... | |
bool | rohc_decomp_get_context_info (const struct rohc_decomp *const decomp, const rohc_cid_t cid, rohc_decomp_context_info_t *const info) |
Get some information about the given decompression context. More... | |
bool | rohc_decomp_get_general_info (const struct rohc_decomp *const decomp, rohc_decomp_general_info_t *const info) |
Get some general information about the decompressor. More... | |
bool | rohc_decomp_get_cid_type (const struct rohc_decomp *const decomp, rohc_cid_type_t *const cid_type) |
Get the CID type that the decompressor uses. More... | |
bool | rohc_decomp_get_max_cid (const struct rohc_decomp *const decomp, size_t *const max_cid) |
Get the maximal CID value the decompressor uses. More... | |
bool | rohc_decomp_set_mrru (struct rohc_decomp *const decomp, const size_t mrru) |
Set the Maximum Reconstructed Reception Unit (MRRU). More... | |
bool | rohc_decomp_get_mrru (const struct rohc_decomp *const decomp, size_t *const mrru) |
Get the Maximum Reconstructed Reception Unit (MRRU). More... | |
bool | rohc_decomp_set_prtt (struct rohc_decomp *const decomp, const size_t prtt) |
Set the number of packets sent during one Round-Trip Time (RTT). More... | |
bool | rohc_decomp_get_prtt (const struct rohc_decomp *const decomp, size_t *const prtt) |
Get the number of packets sent during one Round-Trip Time (RTT). More... | |
bool | rohc_decomp_set_rate_limits (struct rohc_decomp *const decomp, const size_t k, const size_t n, const size_t k_1, const size_t n_1, const size_t k_2, const size_t n_2) |
Set the rate limits for feedbacks. More... | |
bool | rohc_decomp_get_rate_limits (const struct rohc_decomp *const decomp, size_t *const k, size_t *const n, size_t *const k_1, size_t *const n_1, size_t *const k_2, size_t *const n_2) |
Get the rate limits for feedbacks currently configured. More... | |
bool | rohc_decomp_set_features (struct rohc_decomp *const decomp, const rohc_decomp_features_t features) |
Enable/disable features for ROHC decompressor. More... | |
bool | rohc_decomp_profile_enabled (const struct rohc_decomp *const decomp, const rohc_profile_t profile) |
Is the given decompression profile enabled for a decompressor? More... | |
bool | rohc_decomp_enable_profile (struct rohc_decomp *const decomp, const rohc_profile_t profile) |
Enable a decompression profile for a decompressor. More... | |
bool | rohc_decomp_disable_profile (struct rohc_decomp *const decomp, const rohc_profile_t profile) |
Disable a decompression profile for a decompressor. More... | |
bool | rohc_decomp_enable_profiles (struct rohc_decomp *const decomp,...) |
Enable several decompression profiles for a decompressor. More... | |
bool | rohc_decomp_disable_profiles (struct rohc_decomp *const decomp,...) |
Disable several decompression profiles for a decompressor. More... | |
bool | rohc_decomp_set_traces_cb2 (struct rohc_decomp *decomp, rohc_trace_callback2_t callback, void *const priv_ctxt) |
Set the callback function used to manage traces in decompressor. More... | |
Variables | |
const struct rohc_decomp_profile | d_uncomp_profile |
Define the decompression part of the Uncompressed profile as described in the RFC 3095. More... | |
const struct rohc_decomp_profile | d_udp_profile |
Define the decompression part of the UDP profile as described in the RFC 3095. More... | |
const struct rohc_decomp_profile | d_ip_profile |
Define the decompression part of the IP-only profile as described in the RFC 3843. More... | |
const struct rohc_decomp_profile | d_udplite_profile |
Define the decompression part of the UDP-Lite profile as described in the RFC 4019. More... | |
const struct rohc_decomp_profile | d_esp_profile |
Define the decompression part of the ESP profile as described in the RFC 3095. More... | |
const struct rohc_decomp_profile | d_rtp_profile |
Define the decompression part of the RTP profile as described in the RFC 3095. More... | |
const struct rohc_decomp_profile | d_tcp_profile |
Define the decompression part of the TCP profile as described in the RFC 3095. More... | |
const struct rohc_decomp_profile | rohc_decomp_rfc5225_ip_profile |
Define the decompression part of the ROHCv2 IP-only profile as described in the RFC 5225. More... | |
const struct rohc_decomp_profile | rohc_decomp_rfc5225_ip_udp_profile |
Define the decompression part of the ROHCv2 IP/UDP profile as described in the RFC 5225. More... | |
const struct rohc_decomp_profile | rohc_decomp_rfc5225_ip_esp_profile |
Define the decompression part of the ROHCv2 IP/ESP profile as described in the RFC 5225. More... | |
static const struct rohc_decomp_profile *const | rohc_decomp_profiles [D_NUM_PROFILES] |
The decompression parts of the ROHC profiles. More... | |
ROHC decompression routines.
|
static |
Create one new decompression context with profile specific data.
decomp | The ROHC decompressor |
cid | The CID of the new context |
profile | The profile to be assigned with the new context |
arrival_time | The time at which packet was received (0 if unknown, or to disable time-related features in ROHC protocol) |
|
static |
Destroy one decompression context and the profile specific data associated with it.
context | The context to destroy |
|
static |
Decompress the compressed headers.
decomp | The ROHC decompressor | |
rohc_packet | The ROHC packet to decode | |
[out] | uncomp_packet | The uncompressed packet |
[out] | rcvd_feedback | The feedback received from the remote peer for the same-side associated ROHC compressor through the feedback channel:
|
[out] | stream | The information about the decompressed stream, required for sending feedback to compressor |
|
static |
Find one decompression context thanks to its CID.
decomp | The ROHC decompressor |
cid | The CID of the context to find out |
|
static |
Find the ROHC profile with the given profile ID.
decomp | The ROHC decompressor |
profile_id | The profile ID to search for |
|
static |
Check whether the CRC on IR or IR-DYN header is correct or not.
The CRC for IR/IR-DYN headers is always CRC-8. It is computed on the whole compressed header (payload excluded, but any CID bits included).
decomp | The ROHC decompressor |
context | The decompression context |
rohc_hdr | The compressed IR or IR-DYN header |
rohc_hdr_len | The length (in bytes) of the compressed header |
add_cid_len | The length of the optional Add-CID field |
large_cid_len | The length of the optional large CID field |
crc_packet | The CRC extracted from the ROHC header |
|
static |
Create the array of decompression contexts.
The maximum size of the array is ROHC_LARGE_CID_MAX + 1.
decomp | The ROHC decompressor |
max_cid | The MAX_CID value to used |
|
static |
Decode the CID of a packet.
decomp | The ROHC decompressor | |
packet | The ROHC packet to extract CID from | |
len | The size of the ROHC packet | |
[out] | cid | The Context ID (CID) extracted from the ROHC packet |
[out] | add_cid_len | The length of add-CID in ROHC packet |
[out] | large_cid_len | The length of large CID in ROHC packet |
|
static |
Decode one ROHC packet.
Steps:
Steps C and D may be repeated if packet or context repair is attempted upon CRC failure.
decomp | The ROHC decompressor | |
context | The decompression context | |
rohc_packet | The ROHC packet to decode | |
add_cid_len | The length of the optional Add-CID field | |
large_cid_len | The length of the optional large CID field | |
[out] | uncomp_packet | The uncompressed packet |
[in,out] | packet_type | IN: The type of the ROHC packet to parse OUT: The type of the parsed ROHC packet |
[out] | do_change_mode | Whether the profile context wants to change its operational mode or not |
|
static |
Build a positive ACK feedback.
decomp | The ROHC decompressor | |
infos | The information collected on the successfully decompressed packet | |
[out] | feedback | The feedback to be transmitted to the remote compressor through the feedback channel |
|
static |
Build a negative ACK feedback.
There are two types of negative feedback: NACK and STATIC-NACK.
decomp | The ROHC decompressor | |
infos | The information collected on the failed decompressed packet | |
[out] | feedback | The feedback to be transmitted to the remote compressor through the feedback channel (may be NULL) |
|
static |
Find the context for the given ROHC packet.
If packet is an IR(-DYN) packet, parse it for the profile ID. Searche for the context with the given CID. Create a new context if needed.
decomp | The ROHC decompressor | |
packet | The ROHC packet to parse | |
packet_len | The length (in bytes) of the ROHC packet | |
cid | The CID that was parsed from ROHC packet | |
large_cid_len | The length (in bytes) of the Large CID that was parsed from ROHC packet | |
arrival_time | The time at which the ROHC packet was received | |
[out] | profile_id | The profile ID parsed from the ROHC packet |
[out] | context | The decompression context for the given ROHC packet |
[out] | context_created | Whether the packet has just been created or not |
|
static |
Get profile index if profile exists.
profile | The profile to enable |
|
static |
Parse a feedback item from the given ROHC data.
decomp | The ROHC decompressor | |
rohc_data | The ROHC data to parse for one feedback item | |
[out] | feedback | The retrieved feedback (header and data included), may be NULL if one don't want to retrieve the feedback item |
[out] | feedback_len | The length of the parsed feedback (maybe be different from feedback->len if feedback was NULL or full) |
|
static |
Parse zero or more feedback items from the given ROHC data.
decomp | The ROHC decompressor | |
rohc_data | The ROHC data to parse for feedback items | |
[out] | feedbacks | The parsed feedback items, may be NULL if one don't want to retrieve the feedback items |
|
static |
Parse padding bits if some are present.
decomp | The ROHC decompressor |
packet | The ROHC packet to parse |
|
static |
Reset all the statistics of the given ROHC decompressor.
decomp | The ROHC decompressor |
|
static |
Update statistics upon successful decompression.
context | The decompression context |
comp_hdr_len | The length (in bytes) of the compressed header |
uncomp_hdr_len | The length (in bytes) of the uncompressed header |
|
static |
Try to decode one ROHC packet.
Steps:
decomp | The ROHC decompressor | |
context | The decompression context | |
packet_type | The type of the ROHC packet to parse | |
extr_crc_bits | The CRC bits extracted from the ROHC header | |
extr_bits | The bits extracted from the ROHC header | |
payload_len | The length of the packet payload (in bytes) | |
[out] | decoded_values | The values decoded from extracted bits |
[out] | uncomp_packet | The uncompressed packet |
|
static |
Update context with decoded values.
context | The decompression context | |
decoded | The decoded values to update in the context | |
payload_len | The length of the packet payload | |
pkt_arrival_time | The arrival time of the decoded ROHC packet | |
[out] | do_change_mode | Whether the context wants to change its operational mode or not |
const struct rohc_decomp_profile d_esp_profile |
Define the decompression part of the ESP profile as described in the RFC 3095.
const struct rohc_decomp_profile d_ip_profile |
Define the decompression part of the IP-only profile as described in the RFC 3843.
const struct rohc_decomp_profile d_rtp_profile |
Define the decompression part of the RTP profile as described in the RFC 3095.
const struct rohc_decomp_profile d_tcp_profile |
Define the decompression part of the TCP profile as described in the RFC 3095.
const struct rohc_decomp_profile d_udp_profile |
Define the decompression part of the UDP profile as described in the RFC 3095.
const struct rohc_decomp_profile d_udplite_profile |
Define the decompression part of the UDP-Lite profile as described in the RFC 4019.
const struct rohc_decomp_profile d_uncomp_profile |
Define the decompression part of the Uncompressed profile as described in the RFC 3095.
|
static |
The decompression parts of the ROHC profiles.
const struct rohc_decomp_profile rohc_decomp_rfc5225_ip_esp_profile |
Define the decompression part of the ROHCv2 IP/ESP profile as described in the RFC 5225.
const struct rohc_decomp_profile rohc_decomp_rfc5225_ip_profile |
Define the decompression part of the ROHCv2 IP-only profile as described in the RFC 5225.
const struct rohc_decomp_profile rohc_decomp_rfc5225_ip_udp_profile |
Define the decompression part of the ROHCv2 IP/UDP profile as described in the RFC 5225.