ROHC compression/decompression library
Data Structures | Enumerations | Functions
ROHC decompression API
Collaboration diagram for ROHC decompression API:

Data Structures

struct  __attribute__
 Some information about the last compressed packet. More...

Enumerations

enum  rohc_d_state { NO_CONTEXT = 1, STATIC_CONTEXT = 2, FULL_CONTEXT = 3 }
 The ROHC decompressor states. More...

Functions

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 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 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).

Enumeration Type Documentation

The ROHC decompressor states.

See 4.3.2 in the RFC 3095.

Enumerator:
NO_CONTEXT 

The No Context state.

STATIC_CONTEXT 

The Static Context state.

FULL_CONTEXT 

The Full Context state.


Function Documentation

void clear_statistics ( struct rohc_decomp decomp)

Clear all the statistics.

Parameters:
decompThe ROHC decompressor

References d_statistics::failed_crc, d_statistics::failed_decomp, d_statistics::failed_no_context, d_statistics::feedbacks, d_statistics::received, and stats.

Referenced by rohc_alloc_decompressor().

struct rohc_decomp* rohc_alloc_decompressor ( struct rohc_comp compressor) [read]

Create one ROHC decompressor.

Parameters:
compressor
  • The ROHC compressor to associate the decompressor with
  • NULL to disable feedback and force undirectional mode
Returns:
The newly-created decompressor if successful, NULL otherwise

References medium::cid_type, clear_statistics(), compressor, contexts, crc_table_2, crc_table_3, crc_table_6, crc_table_7, crc_table_8, curval, errval, last_context, medium::max_cid, maxval, medium, mrru, okval, rohc_crc_init_table(), ROHC_CRC_TYPE_2, ROHC_CRC_TYPE_3, ROHC_CRC_TYPE_6, ROHC_CRC_TYPE_7, ROHC_CRC_TYPE_8, ROHC_SMALL_CID, ROHC_SMALL_CID_MAX, rru_len, and trace_callback.

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.

Parameters:
decompThe ROHC decompressor
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 D_NUM_PROFILES, d_profile::description, d_profile::id, and zfree.

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.

To use the function, call it with a pointer on a pre-allocated 'rohc_decomp_last_packet_info_t' structure with the 'version_major' and 'version_minor' fields set to one of the following supported versions:

  • Major 0, minor 0

See rohc_comp_last_packet_info2_t for details about fields that are supported in the above versions.

Parameters:
decompThe ROHC decompressor to get information from
infoIN/OUT: the structure where information will be stored
Returns:
true in case of success, false otherwise

References d_profile::id, d_context::is_duplicated, last_context, d_context::mode, d_context::nr_lost_packets, d_context::nr_misordered_packets, d_context::profile, rohc_error, ROHC_PROFILE_GENERAL, ROHC_TRACE_DECOMP, and d_context::state.

const char* rohc_decomp_get_state_descr ( const rohc_d_state  state)

Give a description for the given ROHC decompression context state.

The descriptions are not part of the API. They may change between releases without any warning. Do NOT use them for other means that providing to users a textual description of decompression context states used by the library. If unsure, ask on the mailing list.

Parameters:
stateThe decompression context state to get a description for
Returns:
A string that describes the given decompression context state

References FULL_CONTEXT, NO_CONTEXT, and STATIC_CONTEXT.

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.

Warning:
Changing the CID type while library is used may lead to destruction of decompression contexts
Parameters:
decompThe decompressor for which to set CID type
cid_typeThe new CID type among ROHC_SMALL_CID or ROHC_LARGE_CID
Returns:
true if the CID type was successfully set, false otherwise

References medium::cid_type, medium::max_cid, medium, rohc_debug, rohc_decomp_set_max_cid(), ROHC_LARGE_CID, ROHC_PROFILE_GENERAL, ROHC_SMALL_CID, ROHC_TRACE_DECOMP, and rohc_warning.

Referenced by rohc_decompress_both().

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.

Warning:
Changing the MAX_CID value while library is used may lead to destruction of decompression contexts
Parameters:
decompThe decompressor for which to set MAX_CID
max_cidThe new MAX_CID value:
Returns:
true if the MAX_CID was successfully set, false otherwise

References medium::cid_type, medium::max_cid, medium, rohc_debug, ROHC_LARGE_CID_MAX, ROHC_PROFILE_GENERAL, ROHC_SMALL_CID, ROHC_SMALL_CID_MAX, ROHC_TRACE_DECOMP, and rohc_warning.

Referenced by rohc_decomp_set_cid_type().

bool rohc_decomp_set_mrru ( struct rohc_decomp *const  decomp,
const size_t  mrru 
)

Set the Maximum Reconstructed Reception Unit (MRRU).

The MRRU value must be in range [0 ; ROHC_MAX_MRRU]. Remember that the MRRU includes the 32-bit CRC that protects it.

If set to 0, segmentation is disabled as no segment headers are allowed on the channel. Every received segment will be dropped.

Warning:
Changing the MRRU value while library is used may lead to destruction of the current RRU.
Parameters:
decompThe ROHC decompressor
mrruThe new MRRU value
Returns:
true if the MRRU was successfully set, false otherwise

References mrru, rohc_debug, ROHC_MAX_MRRU, ROHC_PROFILE_GENERAL, ROHC_TRACE_DECOMP, and rohc_warning.

int rohc_decompress ( struct rohc_decomp decomp,
unsigned char *  ibuf,
int  isize,
unsigned char *  obuf,
int  osize 
)

Decompress a ROHC packet.

Parameters:
decompThe ROHC decompressor
ibufThe ROHC packet to decompress
isizeThe size of the ROHC packet
obufOUT: The buffer where to store the decompressed packet Only valid if functions returns a positive or zero value
osizeThe size of the buffer for the decompressed packet
Returns:
  • A positive or zero value representing the length (in bytes) of the decompressed packet in case packet was successfully decompressed
  • A strictly negative value if no decompressed packet is returned:
    • ROHC_FEEDBACK_ONLY if the ROHC packet contains only feedback data
    • ROHC_NON_FINAL_SEGMENT if the given ROHC packet is a partial segment of a larger ROHC packet
    • ROHC_ERROR_NO_CONTEXT if no decompression context matches the CID stored in the given ROHC packet and the ROHC packet is not an IR packet
    • ROHC_ERROR_PACKET_FAILED if the decompression failed because the ROHC packet is unexpected and/or malformed
    • ROHC_ERROR_CRC if the CRC detected a transmission or decompression problem
    • ROHC_ERROR if another problem occurred

References d_decode_data::active, d_decode_data::addcidUsed, c_add_wlsb(), d_decode_data::cid, medium::cid_type, compressor, curval, d_context::curval, errval, d_statistics::failed_crc, d_statistics::failed_decomp, d_statistics::failed_no_context, d_statistics::feedbacks, d_profile::id, maxval, medium, d_context::mode, d_context::num_decomp_failures, d_context::num_recv_packets, O_MODE, okval, d_context::profile, d_statistics::received, rohc_debug, rohc_dump_packet(), ROHC_ERROR, ROHC_ERROR_CRC, ROHC_ERROR_NO_CONTEXT, ROHC_ERROR_PACKET_FAILED, ROHC_FEEDBACK_ONLY, rohc_min, ROHC_NON_FINAL_SEGMENT, ROHC_OK, ROHC_PROFILE_GENERAL, ROHC_TRACE_DEBUG, ROHC_TRACE_DECOMP, rohc_warning, d_context::state, stats, d_context::total_16_compressed, d_context::total_16_uncompressed, d_context::total_compressed_size, d_context::total_uncompressed_size, trace_callback, and U_MODE.

Referenced by rohc_decompress_both().

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.

Deprecated:
do not use this function anymore, use rohc_decomp_set_cid_type() and rohc_decomp_set_max_cid() instead
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
largeWhether the packet use large CID or not
Returns:
The size of the decompressed packet

References rohc_decomp_set_cid_type(), rohc_decompress(), ROHC_ERROR, ROHC_LARGE_CID, and ROHC_SMALL_CID.

void rohc_free_decompressor ( struct rohc_decomp decomp)

Destroy one ROHC decompressor.

Parameters:
decompThe decompressor to destroy

References contexts, medium::max_cid, medium, rohc_debug, ROHC_PROFILE_GENERAL, ROHC_TRACE_DECOMP, and zfree.

void user_interactions ( struct rohc_decomp decomp,
int  feedback_maxval 
)

Update feedback interval by the user.

Parameters:
decompThe ROHC decompressor
feedback_maxvalThe feedback interval given by user

References maxval.