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 informations 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. | |
| static 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. | |
| 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. | |
| 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. | |
| static void | context_free (struct rohc_decomp_ctxt *const context) |
| Destroy one decompression context and the profile specific data associated with it. | |
| 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. | |
| 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. | |
| static void | rohc_decomp_parse_padding (const struct rohc_decomp *const decomp, struct rohc_buf *const packet) |
| Parse padding bits if some are present. | |
| 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. | |
| 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. | |
| 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. | |
| 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. | |
| 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. | |
| 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. | |
| 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. | |
| 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. | |
| 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. | |
| static void | rohc_decomp_reset_stats (struct rohc_decomp *const decomp) |
| Reset all the statistics of the given ROHC decompressor. | |
| static bool | rohc_decomp_packet_carry_static_info (const rohc_packet_t packet_type) |
| Does packet type carry static information? | |
| static bool | rohc_decomp_packet_carry_crc_7_or_8 (const rohc_packet_t packet_type) |
| Does packet type carry 7- or 8-bit CRC? | |
| 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. | |
| void | rohc_decomp_free (struct rohc_decomp *const decomp) |
| Destroy the given ROHC decompressor. | |
| 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. | |
| const char * | rohc_decomp_get_state_descr (const rohc_decomp_state_t state) |
| Give a description for the given ROHC decompression context state. | |
| 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. | |
| 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. | |
| 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. | |
| 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. | |
| 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. | |
| bool | rohc_decomp_set_mrru (struct rohc_decomp *const decomp, const size_t mrru) |
| Set the Maximum Reconstructed Reception Unit (MRRU). | |
| bool | rohc_decomp_get_mrru (const struct rohc_decomp *const decomp, size_t *const mrru) |
| Get the Maximum Reconstructed Reception Unit (MRRU). | |
| 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). | |
| 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). | |
| 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. | |
| 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. | |
| bool | rohc_decomp_set_features (struct rohc_decomp *const decomp, const rohc_decomp_features_t features) |
| Enable/disable features for ROHC decompressor. | |
| 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? | |
| bool | rohc_decomp_enable_profile (struct rohc_decomp *const decomp, const rohc_profile_t profile) |
| Enable a decompression profile for a decompressor. | |
| bool | rohc_decomp_disable_profile (struct rohc_decomp *const decomp, const rohc_profile_t profile) |
| Disable a decompression profile for a decompressor. | |
| bool | rohc_decomp_enable_profiles (struct rohc_decomp *const decomp,...) |
| Enable several decompression profiles for a decompressor. | |
| bool | rohc_decomp_disable_profiles (struct rohc_decomp *const decomp,...) |
| Disable several decompression profiles for a decompressor. | |
| 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. | |
Variables | |
| struct rohc_decomp_profile d_uncomp_profile d_udp_profile d_ip_profile d_udplite_profile d_esp_profile d_rtp_profile | d_tcp_profile |
| Define the decompression part of the TCP profile as described in the RFC 3095. | |
| static struct rohc_decomp_profile *const | rohc_decomp_profiles [D_NUM_PROFILES] |
| The decompression parts of the ROHC profiles. | |
ROHC decompression routines.
| 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 | |||
| ) | [static, read] |
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 void context_free | ( | struct rohc_decomp_ctxt *const | context | ) | [static] |
Destroy one decompression context and the profile specific data associated with it.
| context | The context to destroy |
| 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 | |||
| ) | [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 informations about the decompressed stream, required for sending feedback to compressor |
| static struct rohc_decomp_ctxt * find_context | ( | const struct rohc_decomp *const | decomp, | |
| const rohc_cid_t | cid | |||
| ) | [static, read] |
Find one decompression context thanks to its CID.
| decomp | The ROHC decompressor | |
| cid | The CID of the context to find out |
| static struct rohc_decomp_profile * find_profile | ( | const struct rohc_decomp *const | decomp, | |
| const rohc_profile_t | profile_id | |||
| ) | [static, read] |
Find the ROHC profile with the given profile ID.
| decomp | The ROHC decompressor | |
| profile_id | The profile ID to search for |
| 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 | |||
| ) | [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 bool rohc_decomp_create_contexts | ( | struct rohc_decomp *const | decomp, | |
| const rohc_cid_t | max_cid | |||
| ) | [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 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 | |||
| ) | [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 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 | |||
| ) | [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 bool rohc_decomp_feedback_ack | ( | struct rohc_decomp *const | decomp, | |
| const struct rohc_decomp_stream *const | infos, | |||
| struct rohc_buf *const | feedback | |||
| ) | [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 bool rohc_decomp_feedback_nack | ( | struct rohc_decomp *const | decomp, | |
| const struct rohc_decomp_stream *const | infos, | |||
| struct rohc_buf *const | feedback | |||
| ) | [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 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 | |||
| ) | [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 bool rohc_decomp_packet_carry_crc_7_or_8 | ( | const rohc_packet_t | packet_type | ) | [static] |
Does packet type carry 7- or 8-bit CRC?
| packet_type | The type of packet |
| static bool rohc_decomp_packet_carry_static_info | ( | const rohc_packet_t | packet_type | ) | [static] |
Does packet type carry static information?
| packet_type | The type of packet |
| 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 | |||
| ) | [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 bool rohc_decomp_parse_feedbacks | ( | struct rohc_decomp *const | decomp, | |
| struct rohc_buf *const | rohc_data, | |||
| struct rohc_buf *const | feedbacks | |||
| ) | [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 void rohc_decomp_parse_padding | ( | const struct rohc_decomp *const | decomp, | |
| struct rohc_buf *const | packet | |||
| ) | [static] |
Parse padding bits if some are present.
| decomp | The ROHC decompressor | |
| packet | The ROHC packet to parse |
| static void rohc_decomp_reset_stats | ( | struct rohc_decomp *const | decomp | ) | [static] |
Reset all the statistics of the given ROHC decompressor.
| decomp | The ROHC decompressor |
| 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 | |||
| ) | [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 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 | |||
| ) | [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 |
| struct rohc_decomp_profile d_uncomp_profile d_udp_profile d_ip_profile d_udplite_profile d_esp_profile d_rtp_profile d_tcp_profile |
Define the decompression part of the TCP profile as described in the RFC 3095.
struct rohc_decomp_profile* const rohc_decomp_profiles[D_NUM_PROFILES] [static] |
{
&d_uncomp_profile,
&d_rtp_profile,
&d_udp_profile,
&d_esp_profile,
&d_ip_profile,
&d_tcp_profile,
&d_udplite_profile,
}
The decompression parts of the ROHC profiles.
1.6.1