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 "config.h"
#include <string.h>
#include <stdio.h>
#include <stdarg.h>
#include <assert.h>
Data Structures | |
struct | d_decode_data |
Decompression-related data. 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 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 d_decode_data *ddata, rohc_packet_t *const packet_type) |
Decompress the compressed headers. | |
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 bool | rohc_decomp_decode_cid (struct rohc_decomp *decomp, const unsigned char *packet, unsigned int len, struct d_decode_data *ddata) |
Decode the CID of a packet. | |
static void | rohc_decomp_print_trace_default (const rohc_trace_level_t level, const rohc_trace_entity_t entity, const int profile, const char *const format,...) |
The default callback for traces. | |
static bool | __rohc_decomp_set_cid_type (struct rohc_decomp *const decomp, const rohc_cid_type_t cid_type) |
Set the type of CID to use for the given decompressor. | |
static bool | __rohc_decomp_set_max_cid (struct rohc_decomp *const decomp, const size_t max_cid) |
Set the MAX_CID allowed for the given decompressor. | |
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 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) |
Parse a feedback item from the given ROHC data. | |
static void | d_operation_mode_feedback (struct rohc_decomp *decomp, const rohc_status_t rohc_status, const uint16_t cid, const rohc_cid_type_t cid_type, int mode, struct rohc_decomp_ctxt *context, struct rohc_buf *const feedback_send) |
Send feedback depending on the mode: Unidirectional, Optimistic or Reliable. | |
static void | d_optimistic_feedback (struct rohc_decomp *decomp, const rohc_status_t rohc_status, const rohc_cid_t cid, const rohc_cid_type_t cid_type, struct rohc_decomp_ctxt *context, struct rohc_buf *const feedback_send) |
Send feedback in Optimistic Mode. | |
static void | rohc_decomp_reset_stats (struct rohc_decomp *const decomp) |
Reset all the statistics of the given ROHC decompressor. | |
static int | rohc_d_context (struct rohc_decomp *decomp, const size_t pos, unsigned int indent, char *buffer) |
Output the statistics of one decompression context to a buffer. | |
struct rohc_decomp * | rohc_alloc_decompressor (struct rohc_comp *compressor) |
Create one ROHC decompressor. | |
void | rohc_free_decompressor (struct rohc_decomp *decomp) |
Destroy one ROHC decompressor. | |
struct rohc_decomp * | rohc_decomp_new (const rohc_cid_type_t cid_type, const rohc_cid_t max_cid, const rohc_mode_t mode, struct rohc_comp *const comp) |
Create a new ROHC decompressor. | |
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. | |
int | rohc_decompress (struct rohc_decomp *decomp, unsigned char *ibuf, int isize, unsigned char *obuf, int osize) |
Decompress the given ROHC packet into one uncompressed packet. | |
int | rohc_decompress2 (struct rohc_decomp *const decomp, const struct rohc_ts arrival_time, const unsigned char *const rohc_packet, const size_t rohc_packet_len, unsigned char *const uncomp_packet, const size_t uncomp_packet_max_len, size_t *const uncomp_packet_len) |
Decompress the given ROHC packet into one uncompressed packet. | |
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. | |
int | rohc_decompress_both (struct rohc_decomp *decomp, unsigned char *ibuf, int isize, unsigned char *obuf, int osize, int large) |
Decompress both large and small CID packets. | |
void | clear_statistics (struct rohc_decomp *decomp) |
Clear all the statistics. | |
int | rohc_d_statistics (struct rohc_decomp *decomp, unsigned int indent, char *buffer) |
Output the decompression statistics of one decompressor to a buffer. The buffer must be large enough to store all the statistics. | |
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_general_info (const struct rohc_decomp *const decomp, rohc_decomp_general_info_t *const info) |
Get some general information about the decompressor. | |
void | user_interactions (struct rohc_decomp *decomp, int feedback_maxval) |
Update feedback interval by the user. | |
bool | rohc_decomp_set_cid_type (struct rohc_decomp *const decomp, const rohc_cid_type_t cid_type) |
Set the type of CID to use for the given 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_set_max_cid (struct rohc_decomp *const decomp, const size_t max_cid) |
Set the MAX_CID allowed for the given decompressor. | |
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_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_cb (struct rohc_decomp *decomp, rohc_trace_callback_t callback) |
Set the callback function used to manage traces in 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 bool __rohc_decomp_set_cid_type | ( | struct rohc_decomp *const | decomp, |
const rohc_cid_type_t | cid_type | ||
) | [static] |
Set the type of CID to use for the given decompressor.
Set the type of CID to use for the given decompressor.
decomp | The decompressor for which to set CID type |
cid_type | The new CID type among ROHC_SMALL_CID or ROHC_LARGE_CID |
static bool __rohc_decomp_set_max_cid | ( | struct rohc_decomp *const | decomp, |
const size_t | max_cid | ||
) | [static] |
Set the MAX_CID allowed for the given decompressor.
Set the MAX_CID allowed for the given decompressor.
decomp | The decompressor for which to set MAX_CID |
max_cid | The new MAX_CID value:
|
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 d_decode_data * | ddata, | ||
rohc_packet_t *const | packet_type | ||
) | [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] | ddata | Decompression-related data (e.g. the context) |
[out] | packet_type | The type of the decompressed ROHC packet |
static void d_operation_mode_feedback | ( | struct rohc_decomp * | decomp, |
const rohc_status_t | rohc_status, | ||
const uint16_t | cid, | ||
const rohc_cid_type_t | cid_type, | ||
int | mode, | ||
struct rohc_decomp_ctxt * | context, | ||
struct rohc_buf *const | feedback_send | ||
) | [static] |
Send feedback depending on the mode: Unidirectional, Optimistic or Reliable.
decomp | The ROHC decompressor | |
rohc_status | The type of feedback to send:
| |
cid | The Context ID (CID) to which the feedback is related | |
cid_type | The type of CID used for the feedback | |
mode | The mode in which the ROHC decompressor operates: ROHC_U_MODE, ROHC_O_MODE or ROHC_R_MODE | |
context | The context to which the feedback is related | |
[out] | feedback_send | The feedback to be transmitted to the remote compressor through the feedback channel:
|
static void d_optimistic_feedback | ( | struct rohc_decomp * | decomp, |
const rohc_status_t | rohc_status, | ||
const rohc_cid_t | cid, | ||
const rohc_cid_type_t | cid_type, | ||
struct rohc_decomp_ctxt * | context, | ||
struct rohc_buf *const | feedback_send | ||
) | [static] |
Send feedback in Optimistic Mode.
decomp | The ROHC decompressor | |
rohc_status | The type of feedback to send:
| |
cid | The Context ID (CID) to which the feedback is related | |
cid_type | The type of CID used for the feedback | |
context | The context to which the feedback is related | |
[out] | feedback_send | The feedback to be transmitted to the remote compressor through the feedback channel:
|
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 int rohc_d_context | ( | struct rohc_decomp * | decomp, |
const size_t | pos, | ||
unsigned int | indent, | ||
char * | buffer | ||
) | [static] |
Output the statistics of one decompression context to a buffer.
The buffer must be large enough to store the statistics of one context.
decomp | The ROHC decompressor |
pos | The pos of the decompression context in the contexts array |
indent | The level of indentation to add during output |
buffer | The buffer where to outputs the statistics |
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 (may be different from the one in decompressor if the MAX_CID value is being changed) |
static bool rohc_decomp_decode_cid | ( | struct rohc_decomp * | decomp, |
const unsigned char * | packet, | ||
unsigned int | len, | ||
struct d_decode_data * | ddata | ||
) | [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 |
ddata | IN/OUT: decompression-related data (e.g. the context) |
static bool rohc_decomp_parse_feedback | ( | struct rohc_decomp *const | decomp, |
struct rohc_buf *const | rohc_data, | ||
struct rohc_buf *const | feedback | ||
) | [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 |
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_print_trace_default | ( | const rohc_trace_level_t | level, |
const rohc_trace_entity_t | entity, | ||
const int | profile, | ||
const char *const | format, | ||
... | |||
) | [static] |
The default callback for traces.
The default callback for traces always prints traces on stdout for compatibility with previous releases. That could be changed for the 2.0.0 release.
level | The level of the message |
entity | The entity concerned by the traces |
profile | The number of the profile concerned by the message |
format | The format string for the trace message |
... | The arguments related to the format string |
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 |
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.