rohc_decompress3 − Decompress the given ROHC packet into one uncompressed packet.
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 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.
The ROHC decompressor
The compressed packet to decompress
The resulting uncompressed packet
The 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
The 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
buffer for the ROHC library
May represent one uncompressed packet, one ROHC packet, or a ROHC feedback.
The network buffer does not contain the packet data itself. It only has a pointer on it. This is designed this way for performance reasons: no copy required to initialize a network buffer, the struct is small and may be passed as copy to function.
The network buffer is able to keep some free space at its beginning. The unused space at the beginning of the buffer may be used to prepend a network header at the very end of the packet handling.
The beginning of the network buffer may also be shifted forward with the rohc_buf_pull function or shifted backward with the rohc_buf_push function. This is useful when parsing a network packet (once bytes are read, shift them forward) for example.
The network buffer may be initialized manually (see below) or with the helper functions rohc_buf_init_empty or rohc_buf_init_full...
struct rohc_ts time; /* The timestamp associated to the data */
uint8_t *data; /* The buffer data */
size_t max_len; /* The maximum length of the buffer */
size_t offset; /* The offset for the beginning of the data */
size_t len; /* The data length (in bytes) */
Possible return values:
• ROHC_STATUS_OK if a decompressed packet is returned
• ROHC_STATUS_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_STATUS_OUTPUT_TOO_SMALL if the output buffer is too small for the compressed packet
• ROHC_STATUS_MALFORMED if the decompression failed because the ROHC packet is malformed
• ROHC_STATUS_BAD_CRC if the CRC detected a transmission or decompression problem
• ROHC_STATUS_ERROR if another problem occurred
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;
rohc_decompress3(decompressor, rohc_packet, &ip_packet,
if(status == ROHC_STATUS_OK)
/* decompression is successful */
/* 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:0);
/* 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");
/* failure: decompressor failed to decompress the ROHC packet */
fprintf(stderr, "decompression of fake ROHC packet failed0);
rohc_decomp.h(3), ROHC_STATUS_OK(3), ROHC_STATUS_NO_CONTEXT(3), ROHC_STATUS_OUTPUT_TOO_SMALL(3), ROHC_STATUS_MALFORMED(3), ROHC_STATUS_BAD_CRC(3), ROHC_STATUS_ERROR(3), rohc_decomp_set_mrru(3)