rohc_comp_pad − Pad the given ROHC compressed packet.
#include <rohc/rohc_comp.h>
rohc_status_t
rohc_comp_pad(
struct rohc_comp *const comp,
struct rohc_buf *const rohc_pkt,
const size_t min_pkt_len
);
Add as many padding bytes as required to get a ROHC packet of the given length.
comp |
The ROHC compressor |
rohc_pkt [input, output]
The compressed ROHC packet to pad up to min_pkt_len
min_pkt_len
The minimum length of the ROHC packet
A network
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_buf {
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 padded ROHC packet is returned
• ROHC_STATUS_OUTPUT_TOO_SMALL if the buffer is too small for the padded ROHC packet
• ROHC_STATUS_ERROR if an error occurred
rohc_comp.h(3), ROHC_STATUS_OK(3), ROHC_STATUS_OUTPUT_TOO_SMALL(3), ROHC_STATUS_ERROR(3), rohc_compress4(3)