ROHC compression/decompression library
|
A network buffer for the ROHC library. More...
#include <rohc_buf.h>
Data Fields | |
struct rohc_ts | time |
uint8_t * | data |
size_t | max_len |
size_t | offset |
size_t | len |
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 packet; ... packet.time.sec = 0; packet.time.nsec = 0; packet.max_len = 100; packet.data = malloc(packet.max_len); packet.offset = 2; packet.len = 2; packet[packet.offset] = 0x01; packet[packet.offset + 1] = 0x02; ...
or as below:
uint8_t* rohc_buf::data |
The buffer data
size_t rohc_buf::len |
The data length (in bytes)
size_t rohc_buf::max_len |
The maximum length of the buffer
size_t rohc_buf::offset |
The offset for the beginning of the data
struct rohc_ts rohc_buf::time |
The timestamp associated to the data