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

ROHC decompression routines. More...

#include "rohc_decomp.h"
#include "rohc_traces.h"
#include "rohc_time.h"
#include "rohc_utils.h"
#include "rohc_debug.h"
#include "feedback.h"
#include "wlsb.h"
#include "decode.h"
#include "crc.h"
#include <assert.h>
Include dependency graph for rohc_decomp.c:

Data Structures

struct  d_decode_data
 Decompression-related data. More...

Functions

int d_decode_header (struct rohc_decomp *decomp, unsigned char *ibuf, int isize, unsigned char *obuf, int osize, struct d_decode_data *ddata)
 Decompress the compressed headers.
void d_operation_mode_feedback (struct rohc_decomp *decomp, int rohc_status, const uint16_t cid, int addcidUsed, const rohc_cid_type_t cid_type, int mode, struct d_context *context)
 Send feedback depending on the mode: Unidirectional, Optimistic or Reliable.
struct d_contextfind_context (struct rohc_decomp *decomp, int cid)
 Find one decompression context thanks to its CID.
struct d_contextcontext_create (struct rohc_decomp *decomp, int with_cid, struct d_profile *profile)
 Create one new decompression context with profile specific data.
void context_free (struct d_context *context)
 Destroy one decompression context and the profile specific data associated with it.
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.
int rohc_d_context (struct rohc_decomp *decomp, int index, unsigned int indent, char *buffer)
 Output the statistics of one decompression context to a buffer.
const char * rohc_decomp_get_state_descr (const rohc_d_state state)
 Give a description for the given ROHC decompression context state.
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.

Variables

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

Detailed Description

ROHC decompression routines.

Author:
Didier Barvaux <didier.barvaux@toulouse.viveris.com>
Didier Barvaux <didier@barvaux.org>
The hackers from ROHC for Linux
David Moreau from TAS

Function Documentation

struct d_context* context_create ( struct rohc_decomp decomp,
int  with_cid,
struct d_profile profile 
) [read]
void context_free ( struct d_context context)

Destroy one decompression context and the profile specific data associated with it.

Parameters:
contextThe context to destroy

References c_destroy_wlsb(), d_profile::free_decode_data, d_context::header_16_compressed, d_context::header_16_uncompressed, d_context::profile, d_context::specific, d_context::total_16_compressed, d_context::total_16_uncompressed, and zfree.

Referenced by d_decode_header(), and rohc_free_decompressor().

int d_decode_header ( struct rohc_decomp decomp,
unsigned char *  ibuf,
int  isize,
unsigned char *  obuf,
int  osize,
struct d_decode_data ddata 
)

Decompress the compressed headers.

Parameters:
decompThe ROHC decompressor
ibufThe ROHC packet to decompress
isizeThe size of the ROHC packet
obufThe buffer where to store the decompressed packet
osizeThe size of the buffer for the decompressed packet
ddataDecompression-related data (e.g. the context)
Returns:
The size of the decompressed packet

References d_decode_data::active, d_decode_data::addcidUsed, d_decode_data::cid, context_create(), context_free(), rohc_decomp::contexts, rohc_decomp::curval, d_is_ir(), d_is_irdyn(), d_profile::decode, find_context(), d_decode_data::large_cid_size, rohc_decomp::last_context, d_context::latest_used, medium::max_cid, rohc_decomp::maxval, rohc_decomp::medium, d_context::num_recv_ir, d_context::num_recv_ir_dyn, d_context::profile, rohc_debugf, ROHC_ERROR_NO_CONTEXT, ROHC_FEEDBACK_ONLY, and ROHC_OK.

Referenced by rohc_decompress().

void d_operation_mode_feedback ( struct rohc_decomp decomp,
int  rohc_status,
const uint16_t  cid,
int  addcidUsed,
const rohc_cid_type_t  cid_type,
int  mode,
struct d_context context 
)

Send feedback depending on the mode: Unidirectional, Optimistic or Reliable.

Parameters:
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
modeThe mode in which the ROHC decompressor operates: U_MODE, O_MODE or R_MODE
contextThe context to which the feedback is related

References d_optimistic_feedback(), O_MODE, R_MODE, and U_MODE.

Referenced by rohc_decompress().

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.

Parameters:
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, c_piggyback_feedback(), 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, medium::max_cid, rohc_decomp::medium, d_context::mode, NO_CONTEXT, NO_CRC, d_context::num_sent_feedbacks, O_MODE, OPT_TYPE_SN_NOT_VALID, d_context::profile, rohc_debugf, ROHC_ERROR_CRC, ROHC_ERROR_NO_CONTEXT, ROHC_ERROR_PACKET_FAILED, ROHC_LARGE_CID_MAX, ROHC_OK, ROHC_SMALL_CID, ROHC_SMALL_CID_MAX, d_context::state, STATIC_CONTEXT, WITH_CRC, and zfree.

Referenced by d_operation_mode_feedback().

struct d_context* find_context ( struct rohc_decomp decomp,
int  cid 
) [read]

Find one decompression context thanks to its CID.

Parameters:
decompThe ROHC decompressor
cidThe CID of the context to find out
Returns:
The context if found, NULL otherwise

References rohc_decomp::contexts, and medium::max_cid.

Referenced by d_decode_header().

int rohc_d_context ( struct rohc_decomp decomp,
int  index,
unsigned int  indent,
char *  buffer 
)

Output the statistics of one decompression context to a buffer.

The buffer must be large enough to store the statistics of one context.

Parameters:
decompThe ROHC decompressor
indexThe index of the decompression context in the contexts array
indentThe level of indentation to add during output
bufferThe buffer where to outputs the statistics
Returns:
The length of data written to the buffer

References c_mean_wlsb(), c_sum_wlsb(), rohc_decomp::contexts, d_profile::description, d_context::first_used, d_context::header_16_compressed, d_context::header_16_uncompressed, d_context::header_compressed_size, d_context::header_uncompressed_size, d_context::latest_used, medium::max_cid, rohc_decomp::medium, d_context::mode, d_context::num_decomp_failures, d_context::num_decomp_repairs, d_context::num_recv_ir, d_context::num_recv_ir_dyn, d_context::num_recv_packets, d_context::num_sent_feedbacks, d_context::profile, rohc_decomp_get_state_descr(), rohc_get_mode_descr(), d_context::state, d_context::total_16_compressed, d_context::total_16_uncompressed, d_context::total_compressed_size, and d_context::total_uncompressed_size.

Referenced by rohc_d_statistics().


Variable Documentation

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