ROHC compression/decompression library
Data Structures | Enumerations | Functions
The ROHC decompression API

Data Structures

struct  rohc_decomp_last_packet_info_t
 Some information about the last decompressed packet. More...
struct  rohc_decomp_general_info_t
 Some general information about the decompressor. More...

Enumerations

enum  rohc_d_state { NO_CONTEXT = 1, STATIC_CONTEXT = 2, FULL_CONTEXT = 3 }
 The ROHC decompressor states. More...
enum  rohc_decomp_state_t { ROHC_DECOMP_STATE_NC = 1, ROHC_DECOMP_STATE_SC = 2, ROHC_DECOMP_STATE_FC = 3 }
 The ROHC decompressor states. More...
enum  rohc_decomp_features_t { ROHC_DECOMP_FEATURE_NONE = 0, ROHC_DECOMP_FEATURE_CRC_REPAIR = (1 << 0), ROHC_DECOMP_FEATURE_COMPAT_1_6_x = (1 << 1) }
 The different features of the ROHC decompressor. 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.
struct rohc_decomprohc_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_decomprohc_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.

Detailed Description

The decompression API of the ROHC library allows a program to decompress some ROHC packets into uncompressed packets.

The program shall first create a decompressor context and configure it. It then may decompress as many packets as needed. When done, the ROHC decompressor context shall be destroyed.


Enumeration Type Documentation

The ROHC decompressor states.

The different ROHC operation states at decompressor as defined in section 4.3.2 of RFC 3095.

Deprecated:
do not use this type anymore, use rohc_decomp_state_t instead
See also:
rohc_decomp_get_state_descr
Enumerator:
NO_CONTEXT 

The No Context state.

STATIC_CONTEXT 

The Static Context state.

FULL_CONTEXT 

The Full Context state.

The different features of the ROHC decompressor.

Features for the ROHC decompressor control whether mechanisms defined as optional by RFCs are enabled or not. They can be set or unset with the function rohc_decomp_set_features.

See also:
rohc_decomp_set_features
Enumerator:
ROHC_DECOMP_FEATURE_NONE 

No feature at all

ROHC_DECOMP_FEATURE_CRC_REPAIR 

Attempt packet repair in case of CRC failure

ROHC_DECOMP_FEATURE_COMPAT_1_6_x 

Be compatible with 1.6.x versions

The ROHC decompressor states.

The different ROHC operation states at decompressor as defined in section 4.3.2 of RFC 3095.

See also:
rohc_decomp_get_state_descr
Enumerator:
ROHC_DECOMP_STATE_NC 

The No Context state

ROHC_DECOMP_STATE_SC 

The Static Context state

ROHC_DECOMP_STATE_FC 

The Full Context state


Function Documentation

void clear_statistics ( struct rohc_decomp decomp)

Clear all the statistics.

Parameters:
decompThe ROHC decompressor
Deprecated:
please do not use this function anymore
struct rohc_decomp* rohc_alloc_decompressor ( struct rohc_comp compressor) [read]

Create one ROHC decompressor.

Deprecated:
do not use this function anymore, use rohc_decomp_new2() instead
Parameters:
compressorTwo possible cases:
  • You want to run the ROHC decompressor in bidirectional mode. Decompressor will transmit feedback to the compressor at the other end of the channel through the given compressor.
  • NULL to disable feedback and force undirectional mode
Returns:
The newly-created decompressor if successful, NULL otherwise
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.

Deprecated:
please do not use this function anymore, use rohc_decomp_get_general_info() and rohc_decomp_get_last_packet_info() instead
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
bool rohc_decomp_disable_profile ( struct rohc_decomp *const  decomp,
const rohc_profile_t  profile 
)

Disable a decompression profile for a decompressor.

Disable a decompression profiles for a decompressor.

The ROHC decompressor does not use the decompression profiles that were disabled. Thus disabling a profile might cause the decompressor to reject streams. Decompression will always fail if no profile at all is enabled.

If the profile is already disabled, nothing is performed and success is reported.

Parameters:
decompThe ROHC decompressor
profileThe profile to disable
Returns:
true if the profile exists, false if the profile does not exist
See also:
rohc_decomp_enable_profile
rohc_decomp_enable_profiles
rohc_decomp_disable_profiles
bool rohc_decomp_disable_profiles ( struct rohc_decomp *const  decomp,
  ... 
)

Disable several decompression profiles for a decompressor.

Disable several decompression profiles for a decompressor. The list of profiles to disable shall stop with -1.

The ROHC decompressor does not use the decompression profiles that were disabled. Thus disabling a profile might cause the decompressor to reject streams. Decompression will always fail if no profile at all is enabled.

If one or more of the profiles are already disabled, nothing is performed and success is reported.

Parameters:
decompThe ROHC decompressor
...The sequence of decompression profiles to disable, the sequence shall be terminated by -1
Returns:
true if all of the profiles exist, false if at least one of the profiles does not exist
See also:
rohc_decomp_enable_profile
rohc_decomp_enable_profiles
rohc_decomp_disable_profile
bool rohc_decomp_enable_profile ( struct rohc_decomp *const  decomp,
const rohc_profile_t  profile 
)

Enable a decompression profile for a decompressor.

Enable a decompression profiles for a decompressor.

The ROHC decompressor does not use the decompression profiles that are not enabled. Thus not enabling a profile might cause the decompressor to reject streams. Decompression will always fail if no profile at all is enabled.

If the profile is already enabled, nothing is performed and success is reported.

Parameters:
decompThe ROHC decompressor
profileThe profile to enable
Returns:
true if the profile exists, false if the profile does not exist
Example:
        struct rohc_decomp *decompressor;       /* the ROHC decompressor */
        ...
        if(!rohc_decomp_enable_profile(decompressor, ROHC_PROFILE_UNCOMPRESSED))
        {
                fprintf(stderr, "failed to enable the Uncompressed profile\n");
                goto release_decompressor;
        }
        if(!rohc_decomp_enable_profile(decompressor, ROHC_PROFILE_IP))
        {
                fprintf(stderr, "failed to enable the IP-only profile\n");
                goto release_decompressor;
        }
        ...
See also:
rohc_decomp_enable_profiles
rohc_decomp_disable_profile
rohc_decomp_disable_profiles
bool rohc_decomp_enable_profiles ( struct rohc_decomp *const  decomp,
  ... 
)

Enable several decompression profiles for a decompressor.

Enable several decompression profiles for a decompressor. The list of profiles to enable shall stop with -1.

The ROHC decompressor does not use the decompression profiles that are not enabled. Thus not enabling a profile might cause the decompressor to reject streams. Decompression will always fail if no profile at all is enabled.

If one or more of the profiles are already enabled, nothing is performed and success is reported.

Parameters:
decompThe ROHC decompressor
...The sequence of decompression profiles to enable, the sequence shall be terminated by -1
Returns:
true if all of the profiles exist, false if at least one of the profiles does not exist
Example:
        struct rohc_decomp *decompressor;       /* the ROHC decompressor */
        ...
        if(!rohc_decomp_enable_profiles(decompressor, ROHC_PROFILE_UDP,
                                        ROHC_PROFILE_UDPLITE, -1))
        {
                fprintf(stderr, "failed to enable the IP/UDP and IP/UDP-Lite "
                        "profiles\n");
                goto release_decompressor;
        }
        ...
See also:
rohc_decomp_enable_profile
rohc_decomp_disable_profile
rohc_decomp_disable_profiles
void rohc_decomp_free ( struct rohc_decomp *const  decomp)

Destroy the given ROHC decompressor.

Destroy a ROHC decompressor that was successfully created with rohc_decomp_new2

Parameters:
decompThe decompressor to destroy
Example:
        struct rohc_decomp *decompressor;       /* the ROHC decompressor */
        ...
        /* Create a ROHC decompressor to operate:
         *  - with large CIDs,
         *  - with the maximum of 5 streams (MAX_CID = 4),
         *  - in Unidirectional mode (U-mode).
         */
        decompressor = rohc_decomp_new2(ROHC_LARGE_CID, 4, ROHC_U_MODE);
        if(decompressor == NULL)
        {
                fprintf(stderr, "failed create the ROHC decompressor\n");
                goto error;
        }
        ...
        rohc_decomp_free(decompressor);
See also:
rohc_decomp_new2
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.

Get the CID type that the decompressor currently uses.

Parameters:
decompThe ROHC decompressor
[out]cid_typeThe current CID type among ROHC_SMALL_CID and ROHC_LARGE_CID
Returns:
true if the CID type was successfully retrieved, false otherwise
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.

Get some general information about the decompressor.

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

  • Major 0, minor 0

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

Parameters:
decompThe ROHC decompressor to get information from
[in,out]infoThe structure where information will be stored
Returns:
true in case of success, false otherwise
See also:
rohc_decomp_general_info_t
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.

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
  • Major 0, minor 1

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

Parameters:
decompThe ROHC decompressor to get information from
[in,out]infoThe structure where information will be stored
Returns:
true in case of success, false otherwise
See also:
rohc_decomp_last_packet_info_t
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.

Get the maximal CID value the decompressor uses, ie. the MAX_CID parameter defined in RFC 3095.

Parameters:
decompThe ROHC decompressor
[out]max_cidThe current maximal CID value
Returns:
true if MAX_CID was successfully retrieved, false otherwise
bool rohc_decomp_get_mrru ( const struct rohc_decomp *const  decomp,
size_t *const  mrru 
)

Get the Maximum Reconstructed Reception Unit (MRRU).

Get the current Maximum Reconstructed Reception Unit (MRRU).

The MRRU is the largest cumulative length (in bytes) of the ROHC segments that are parts of the same ROHC packet. In short, the ROHC decompressor does not expect to reassemble ROHC segments whose total length is larger than MRRU. So, the ROHC compressor shall not segment ROHC packets greater than the 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 MRRU value is 0, segmentation is disabled.

If segmentation is enabled and used by the compressor, the function rohc_decompress3 will return ROHC_OK and one empty uncompressed packet upon decompression until the last segment is received (or a non-segment is received). Decompressed data will be returned at that time.

Parameters:
decompThe ROHC decompressor
[out]mrruThe current MRRU value (in bytes)
Returns:
true if MRRU was successfully retrieved, false otherwise
See also:
rohc_decomp_set_mrru
rohc_decompress3
rohc_comp_set_mrru
rohc_comp_get_mrru
const char* rohc_decomp_get_state_descr ( const rohc_decomp_state_t  state)

Give a description for the given ROHC decompression context 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
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 
) [read]

Create a new ROHC decompressor.

Create a new ROHC decompressor with the given type of CIDs, MAX_CID, operational mode, and (optionally) related compressor for the feedback channel.

Deprecated:
please do not use this function anymore use rohc_decomp_new2() and rohc_decompress3() instead
Parameters:
cid_typeThe type of Context IDs (CID) that the ROHC decompressor shall operate with.
Accepted values are:
max_cidThe maximum value that the ROHC decompressor should use for context IDs (CID). As CIDs starts with value 0, the number of contexts is max_cid + 1.
Accepted values are:
modeThe operational mode that the ROHC decompressor shall transit to.
Accepted values are:
compThe associated ROHC compressor for the feedback channel.
Accepted values:
  • a valid ROHC compressor created with rohc_comp_new to enable the feedback channel,
  • NULL to disable the feedback channel.
The feedback channel is optional in Unidirectional mode:
  • if NULL, no feedback is emitted at all,
  • if not NULL, positive acknowlegments may be transmitted on feedback channel to increase timeouts of IR and FO refreshes.
The feedback channel is mandatory in both Bidirectional modes: specifying NULL is an error.
Returns:
The created decompressor if successful, NULL if creation failed
Warning:
Don't forget to free decompressor memory with rohc_decomp_free if rohc_decomp_new succeeded
Example:
        struct rohc_decomp *decompressor;       /* the ROHC decompressor */
        ...
        /* Create a ROHC decompressor to operate:
         *  - with large CIDs,
         *  - with the maximum of 5 streams (MAX_CID = 4),
         *  - in Unidirectional mode (U-mode).
         */
        decompressor = rohc_decomp_new(ROHC_LARGE_CID, 4, ROHC_U_MODE, NULL);
        if(decompressor == NULL)
        {
                fprintf(stderr, "failed create the ROHC decompressor\n");
                goto error;
        }
        ...
        rohc_decomp_free(decompressor);
See also:
rohc_decomp_free
rohc_decompress3
rohc_decomp_set_traces_cb
rohc_decomp_enable_profiles
rohc_decomp_enable_profile
rohc_decomp_disable_profiles
rohc_decomp_disable_profile
rohc_decomp_set_mrru
rohc_decomp_set_features
struct rohc_decomp* rohc_decomp_new2 ( const rohc_cid_type_t  cid_type,
const rohc_cid_t  max_cid,
const rohc_mode_t  mode 
) [read]

Create a new ROHC decompressor.

Create a new ROHC decompressor with the given type of CIDs, MAX_CID, and operational mode.

Parameters:
cid_typeThe type of Context IDs (CID) that the ROHC decompressor shall operate with.
Accepted values are:
max_cidThe maximum value that the ROHC decompressor should use for context IDs (CID). As CIDs starts with value 0, the number of contexts is max_cid + 1.
Accepted values are:
modeThe operational mode that the ROHC decompressor shall transit to.
Accepted values are:
Returns:
The created decompressor if successful, NULL if creation failed
Warning:
Don't forget to free decompressor memory with rohc_decomp_free if rohc_decomp_new2 succeeded
Example:
        struct rohc_decomp *decompressor;       /* the ROHC decompressor */
        ...
        /* Create a ROHC decompressor to operate:
         *  - with large CIDs,
         *  - with the maximum of 5 streams (MAX_CID = 4),
         *  - in Unidirectional mode (U-mode).
         */
        decompressor = rohc_decomp_new2(ROHC_LARGE_CID, 4, ROHC_U_MODE);
        if(decompressor == NULL)
        {
                fprintf(stderr, "failed create the ROHC decompressor\n");
                goto error;
        }
        ...
        rohc_decomp_free(decompressor);
See also:
rohc_decomp_free
rohc_decompress3
rohc_decomp_set_traces_cb
rohc_decomp_enable_profiles
rohc_decomp_enable_profile
rohc_decomp_disable_profiles
rohc_decomp_disable_profile
rohc_decomp_set_mrru
rohc_decomp_set_features
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?

Is the given decompression profile enabled or disabled for a decompressor?

Parameters:
decompThe ROHC decompressor
profileThe profile to ask status for
Returns:
Possible return values:
  • true if the profile exists and is enabled,
  • false if the decompressor is not valid, the profile does not exist, or the profile is disabled
See also:
rohc_decomp_enable_profile
rohc_decomp_enable_profiles
rohc_decomp_disable_profile
rohc_decomp_disable_profiles
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.

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
Deprecated:
please do not use this function anymore, use the parameter cid_type of rohc_decomp_new2() instead
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
bool rohc_decomp_set_features ( struct rohc_decomp *const  decomp,
const rohc_decomp_features_t  features 
)

Enable/disable features for ROHC decompressor.

Enable/disable features for ROHC decompressor. Features control whether mechanisms defined as optional by RFCs are enabled or not.

Available features are listed by rohc_decomp_features_t. They may be combined by XOR'ing them together.

Warning:
Changing the feature set while library is used is not supported
Parameters:
decompThe ROHC decompressor
featuresThe feature set to enable/disable
Returns:
true if the feature set was successfully enabled/disabled, false if a problem occurred
See also:
rohc_decomp_features_t
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.

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
Deprecated:
please do not use this function anymore, use the parameter max_cid of rohc_decomp_new2() instead
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
bool rohc_decomp_set_mrru ( struct rohc_decomp *const  decomp,
const size_t  mrru 
)

Set the Maximum Reconstructed Reception Unit (MRRU).

Set the Maximum Reconstructed Reception Unit (MRRU).

The MRRU is the largest cumulative length (in bytes) of the ROHC segments that are parts of the same ROHC packet. In short, the ROHC decompressor does not expect to reassemble ROHC segments whose total length is larger than MRRU. So, the ROHC compressor shall not segment ROHC packets greater than the 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.

If segmentation is enabled and used by the compressor, the function rohc_decompress3 will return ROHC_OK and one empty uncompressed packet upon decompression until the last segment is received (or a non-segment is received). Decompressed data will be returned at that time.

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 (in bytes)
Returns:
true if the MRRU was successfully set, false otherwise
Example:
        struct rohc_decomp *decomp;
        size_t mrru = 500;
        ...
        /* set the MRRU at decompressor */
        if(!rohc_decomp_set_mrru(decomp, mrru))
        {
                fprintf(stderr, "failed to set the MRRU at decompressor\n");
                goto destroy_decomp;
        }
        ...
See also:
rohc_decomp_get_mrru
rohc_decompress3
rohc_comp_set_mrru
rohc_comp_get_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.

Set the user-defined callback function used to manage traces in the decompressor.

The function will be called by the ROHC library every time it wants to print something related to decompression, from errors to debug. User may thus decide what traces are interesting (filter on level, source entity, or profile) and what to do with them (print on console, storage in file, syslog...).

Warning:
The callback can not be modified after library initialization
The callback set by this function is ignored if another callback is set with rohc_decomp_set_traces_cb2
Deprecated:
do not use this function anymore, use rohc_decomp_set_traces_cb2() instead
Parameters:
decompThe ROHC decompressor
callbackTwo possible cases:
  • The callback function used to manage traces
  • NULL to remove the previous callback
Returns:
true on success, false otherwise
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.

Set the user-defined callback function used to manage traces in the decompressor.

The function will be called by the ROHC library every time it wants to print something related to decompression, from errors to debug. User may thus decide what traces are interesting (filter on level, source entity, or profile) and what to do with them (print on console, storage in file, syslog...).

Warning:
The callback can not be modified after library initialization
The callback set by this function will remove any callback set set with rohc_decomp_set_traces_cb
Parameters:
decompThe ROHC decompressor
callbackTwo possible cases:
  • The callback function used to manage traces
  • NULL to remove the previous callback
priv_ctxtAn optional private context, may be NULL
Returns:
true on success, false otherwise
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.

Deprecated:
do not use this function anymore, use rohc_decompress4() instead
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
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.

The function may succeed in three different ways:

  • return ROHC_OK and a decompressed IP packet,
  • return ROHC_FEEDBACK_ONLY and no decompressed IP packet if the ROHC packet contains only feedback information,
  • return ROHC_NON_FINAL_SEGMENT and no decompressed IP packet if the ROHC packet is a non-final ROHC segment, ie. the ROHC packet is not the last segment of a larger, segmented ROHC packet.
Deprecated:
do not use this function anymore, use rohc_decompress3() instead
Parameters:
decompThe ROHC decompressor
arrival_timeThe time at which packet was received (0 if unknown, or to disable time-related features in the ROHC protocol)
rohc_packetThe compressed packet to decompress
rohc_packet_lenThe size of the compressed packet (in bytes)
uncomp_packetThe buffer where to store the decompressed packet
uncomp_packet_max_lenThe maximum length (in bytes) of the buffer for the decompressed packet
[out]uncomp_packet_lenThe length (in bytes) of the decompressed packet
Returns:
Possible return values:
Example #1:
        struct rohc_decomp *decompressor;       /* the ROHC decompressor */
        const struct rohc_ts arrival_time = { .sec = 0, .nsec = 0 };
        unsigned char rohc_packet[BUFFER_SIZE]; // the buffer that will contain
                                                // the ROHC packet to decompress
        size_t rohc_packet_len;                 // the length (in bytes) of the
                                                // ROHC packet
        unsigned char ip_packet[BUFFER_SIZE];   // the buffer that will contain
                                                // the decompressed IPv4 packet
        size_t ip_packet_len;                   // the length (in bytes) of the
                                                // decompressed IPv4 packet
        ...
        ret = rohc_decompress2(decompressor, arrival_time,
                               rohc_packet, rohc_packet_len,
                               ip_packet, BUFFER_SIZE, &ip_packet_len);
        if(ret == ROHC_FEEDBACK_ONLY)
        {
                // success: no decompressed IP data available in ip_packet because
                // the ROHC packet contained only feedback data
        }
        else if(ret == ROHC_NON_FINAL_SEGMENT)
        {
                // success: no decompressed IP data available in ip_packet because the
                // ROHC packet was a non-final segment (at least another segment is
                // required to be able to decompress the full ROHC packet)
        }
        else if(ret == ROHC_OK)
        {
                // success: ip_packet_len bytes of decompressed IP data available in
                // ip_packet
        }
        else
        {
                // failure: decompressor failed to decompress the ROHC packet
                fprintf(stderr, "decompression of fake ROHC packet failed\n");
        }
See also:
rohc_decomp_set_mrru
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.

Decompress the given ROHC packet into an uncompressed packet. The decompression always returns ROHC_OK in case of success. The caller shall however be ready to handle several cases:

  • the uncompressed packet uncomp_packet might be empty if the ROHC packet contained only feedback data or if the ROHC packet was not a final segment
  • the received feedback rcvd_feedback might be empty if the ROHC packet doesn't contain at least one feedback item

If feedback_send is not NULL, the decompression may return some feedback information on it. In such a case, the caller is responsible to send it to the compressor through any feedback channel.

Time-related features in the ROHC protocol:
Set the rohc_packet.time parameter to 0 if arrival time of the ROHC packet is unknown or to disable the time-related features in the ROHC protocol.
Parameters:
decompThe ROHC decompressor
rohc_packetThe compressed packet to decompress
[out]uncomp_packetThe resulting uncompressed packet
[out]rcvd_feedbackThe feedback received from the remote peer for the same-side associated ROHC compressor through the feedback channel:
  • If NULL, ignore the received feedback data
  • If not NULL, store the received feedback in at the given address
[out]feedback_sendThe feedback to be transmitted to the remote compressor through the feedback channel:
  • If NULL, the decompression won't generate feedback information for its compressor
  • If not NULL, may store the generated feedback at the given address
Returns:
Possible return values:
Example #1:
        struct rohc_decomp *decompressor;       /* the ROHC decompressor */
        /* the buffer that will contain the ROHC packet to decompress */
        unsigned char rohc_buffer[BUFFER_SIZE];
        struct rohc_buf rohc_packet = rohc_buf_init_empty(rohc_buffer, BUFFER_SIZE);
        /* the buffer that will contain the resulting IP packet */
        unsigned char ip_buffer[BUFFER_SIZE];
        struct rohc_buf ip_packet = rohc_buf_init_empty(ip_buffer, BUFFER_SIZE);
        /* we do not want to handle feedback in this simple example */
        struct rohc_buf *rcvd_feedback = NULL;
        struct rohc_buf *feedback_send = NULL;
        ...
        status = rohc_decompress3(decompressor, rohc_packet, &ip_packet,
                                  rcvd_feedback, feedback_send);
        if(status == ROHC_STATUS_OK)
        {
                /* decompression is successful */
                if(!rohc_buf_is_empty(ip_packet))
                {
                        /* ip_packet.len bytes of decompressed IP data available in
                         * ip_packet: dump the IP packet on the standard output */
                        printf("IP packet resulting from the ROHC decompression:\n");
                        dump_packet(ip_packet);
                }
                else
                {
                        /* no IP packet was decompressed because of ROHC segmentation or
                         * feedback-only packet:
                         *  - the ROHC packet was a non-final segment, so at least another
                         *    ROHC segment is required to be able to decompress the full
                         *    ROHC packet
                         *  - the ROHC packet was a feedback-only packet, it contained only
                         *    feedback information, so there was nothing to decompress */
                        printf("no IP packet decompressed");
                }
        }
        else
        {
                /* failure: decompressor failed to decompress the ROHC packet */
                fprintf(stderr, "decompression of fake ROHC packet failed\n");
        }
See also:
rohc_decomp_set_mrru
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_new2() and rohc_decompress3() 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
void rohc_free_decompressor ( struct rohc_decomp decomp)

Destroy one ROHC decompressor.

Deprecated:
do not use this function anymore, use rohc_decomp_free() instead
Parameters:
decompThe decompressor to destroy
void user_interactions ( struct rohc_decomp decomp,
int  feedback_maxval 
)

Update feedback interval by the user.

Deprecated:
please do not use this function anymore
Parameters:
decompThe ROHC decompressor
feedback_maxvalThe feedback interval given by user