ROHC compression/decompression library
|
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_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. |
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.
enum rohc_d_state |
The ROHC decompressor states.
The different ROHC operation states at decompressor as defined in section 4.3.2 of RFC 3095.
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.
enum rohc_decomp_state_t |
The ROHC decompressor states.
The different ROHC operation states at decompressor as defined in section 4.3.2 of RFC 3095.
void clear_statistics | ( | struct rohc_decomp * | decomp | ) |
Clear all the statistics.
decomp | The ROHC decompressor |
struct rohc_decomp* rohc_alloc_decompressor | ( | struct rohc_comp * | compressor | ) | [read] |
Create one ROHC decompressor.
compressor | Two possible cases:
|
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.
decomp | The ROHC decompressor |
indent | The level of indentation to add during output |
buffer | The buffer where to outputs the statistics |
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.
decomp | The ROHC decompressor |
profile | The profile to disable |
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.
decomp | The ROHC decompressor |
... | The sequence of decompression profiles to disable, the sequence shall be terminated by -1 |
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.
decomp | The ROHC decompressor |
profile | The profile to enable |
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; }
...
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.
decomp | The ROHC decompressor |
... | The sequence of decompression profiles to enable, the sequence shall be terminated by -1 |
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; }
...
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
decomp | The decompressor to destroy |
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);
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.
decomp | The ROHC decompressor | |
[out] | cid_type | The current CID type among ROHC_SMALL_CID and ROHC_LARGE_CID |
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:
See the rohc_decomp_general_info_t structure for details about fields that are supported in the above versions.
decomp | The ROHC decompressor to get information from | |
[in,out] | info | The structure where information will be stored |
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:
See rohc_decomp_last_packet_info_t for details about fields that are supported in the above versions.
decomp | The ROHC decompressor to get information from | |
[in,out] | info | The structure where information will be stored |
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.
decomp | The ROHC decompressor | |
[out] | max_cid | The current maximal CID value |
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.
decomp | The ROHC decompressor | |
[out] | mrru | The current MRRU value (in bytes) |
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.
state | The decompression context state to get a description for |
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.
cid_type | The type of Context IDs (CID) that the ROHC decompressor shall operate with. Accepted values are:
|
max_cid | The 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:
|
mode | The operational mode that the ROHC decompressor shall transit to. Accepted values are:
|
comp | The associated ROHC compressor for the feedback channel. Accepted values:
|
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);
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.
cid_type | The type of Context IDs (CID) that the ROHC decompressor shall operate with. Accepted values are:
|
max_cid | The 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:
|
mode | The operational mode that the ROHC decompressor shall transit to. Accepted values are:
|
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);
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?
decomp | The ROHC decompressor |
profile | The profile to ask status for |
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.
decomp | The decompressor for which to set CID type |
cid_type | The new CID type among ROHC_SMALL_CID or ROHC_LARGE_CID |
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.
decomp | The ROHC decompressor |
features | The feature set to enable/disable |
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.
decomp | The decompressor for which to set MAX_CID |
max_cid | The new MAX_CID value:
|
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.
decomp | The ROHC decompressor |
mrru | The new MRRU value (in bytes) |
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; }
...
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...).
decomp | The ROHC decompressor |
callback | Two possible cases:
|
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...).
decomp | The ROHC decompressor |
callback | Two possible cases:
|
priv_ctxt | An optional private context, may be NULL |
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.
decomp | The ROHC decompressor |
ibuf | The ROHC packet to decompress |
isize | The size of the ROHC packet |
obuf | OUT: The buffer where to store the decompressed packet Only valid if functions returns a positive or zero value |
osize | The size of the buffer for the decompressed 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.
The function may succeed in three different ways:
decomp | The ROHC decompressor | |
arrival_time | The time at which packet was received (0 if unknown, or to disable time-related features in the ROHC protocol) | |
rohc_packet | The compressed packet to decompress | |
rohc_packet_len | The size of the compressed packet (in bytes) | |
uncomp_packet | The buffer where to store the decompressed packet | |
uncomp_packet_max_len | The maximum length (in bytes) of the buffer for the decompressed packet | |
[out] | uncomp_packet_len | The length (in bytes) of the decompressed packet |
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"); }
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:
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.
decomp | The ROHC decompressor | |
rohc_packet | The compressed packet to decompress | |
[out] | uncomp_packet | The resulting uncompressed packet |
[out] | rcvd_feedback | The feedback received from the remote peer for the same-side associated ROHC compressor through the feedback channel:
|
[out] | feedback_send | The feedback to be transmitted to the remote compressor through the feedback channel:
|
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");
}
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.
decomp | The ROHC decompressor |
ibuf | The ROHC packet to decompress |
isize | The size of the ROHC packet |
obuf | The buffer where to store the decompressed packet |
osize | The size of the buffer for the decompressed packet |
large | Whether the packet use large CID or not |
void rohc_free_decompressor | ( | struct rohc_decomp * | decomp | ) |
Destroy one ROHC decompressor.
decomp | The decompressor to destroy |
void user_interactions | ( | struct rohc_decomp * | decomp, |
int | feedback_maxval | ||
) |
Update feedback interval by the user.
decomp | The ROHC decompressor |
feedback_maxval | The feedback interval given by user |