ROHC compression/decompression library
Data Structures | Functions | Variables
rohc_decomp.c File Reference

ROHC decompression routines. More...

#include "rohc_decomp.h"
#include "rohc_decomp_internals.h"
#include "rohc_traces_internal.h"
#include "rohc_time.h"
#include "rohc_utils.h"
#include "rohc_bit_ops.h"
#include "rohc_debug.h"
#include "feedback.h"
#include "wlsb.h"
#include "sdvl.h"
#include "decode.h"
#include "crc.h"
#include <string.h>
#include <stdio.h>
#include <stdarg.h>
#include <assert.h>
Include dependency graph for rohc_decomp.c:

Data Structures

struct  d_decode_data
 Decompression-related data. More...


static void nonnull (4)))
struct rohc_decomprohc_alloc_decompressor (struct rohc_comp *compressor)
 Create one ROHC decompressor.
void rohc_free_decompressor (struct rohc_decomp *decomp)
 Destroy one ROHC decompressor.
int rohc_decompress (struct rohc_decomp *decomp, unsigned char *ibuf, int isize, unsigned char *obuf, int osize)
 Decompress a ROHC 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 d_optimistic_feedback (struct rohc_decomp *decomp, int rohc_status, const uint16_t cid, int addcidUsed, const rohc_cid_type_t cid_type, struct d_context *context)
 Send feedback in Optimistic Mode.
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_d_state 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.
void d_change_mode_feedback (struct rohc_decomp *decomp, struct d_context *context)
 Create a feedback ACK packet telling the compressor to change state.
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_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_set_mrru (struct rohc_decomp *const decomp, const size_t mrru)
 Set the Maximum Reconstructed Reception Unit (MRRU).
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.


struct d_profile
d_uncomp_profile d_udp_profile
d_ip_profile d_udplite_profile
 Define the decompression part of the RTP profile as described in the RFC 3095.

Detailed Description

ROHC decompression routines.

Didier Barvaux <>
Didier Barvaux <>
The hackers from ROHC for Linux
David Moreau from TAS

Function Documentation

void d_change_mode_feedback ( struct rohc_decomp decomp,
struct d_context context 
void d_optimistic_feedback ( struct rohc_decomp decomp,
int  rohc_status,
const uint16_t  cid,
int  addcidUsed,
const rohc_cid_type_t  cid_type,
struct d_context context 

Send feedback in Optimistic Mode.

decompThe ROHC decompressor
rohc_statusThe type of feedback to send: 0 = OK (ack), -1 = ContextInvalid (S-nack), -2 = PackageFailed (Nack)
cidThe Context ID (CID) to which the feedback is related
addcidUsedWhether add-CID is used or not
cid_typeThe type of CID used for the feedback
contextThe context to which the feedback is related

References ACKTYPE_ACK, ACKTYPE_NACK, ACKTYPE_STATIC_NACK, medium::cid_type, rohc_decomp::compressor, rohc_decomp::crc_table_8, f_add_option(), f_feedback2(), f_wrap_feedback(), FULL_CONTEXT, d_profile::get_sn, d_profile::id, medium::max_cid, rohc_decomp::medium, d_context::mode, NO_CONTEXT, d_context::num_sent_feedbacks, O_MODE, OPT_TYPE_SN_NOT_VALID, d_context::profile, rohc_comp_piggyback_feedback(), rohc_debug, ROHC_ERROR_CRC, ROHC_ERROR_NO_CONTEXT, ROHC_ERROR_PACKET_FAILED, rohc_info, ROHC_LARGE_CID_MAX, ROHC_OK, ROHC_PROFILE_GENERAL, ROHC_SMALL_CID, ROHC_SMALL_CID_MAX, ROHC_TRACE_DECOMP, rohc_warning, d_context::state, STATIC_CONTEXT, WITH_CRC, and zfree.

static void nonnull ( )
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.

decompThe ROHC decompressor
  • The callback function used to manage traces
  • NULL to remove the previous callback
true on success, false otherwise

References d_statistics::received, rohc_error, ROHC_PROFILE_GENERAL, ROHC_TRACE_DECOMP, rohc_decomp::stats, and rohc_decomp::trace_callback.

Variable Documentation

Define the decompression part of the RTP profile as described in the RFC 3095.