Buffer abstraction. More...
Functions | |
imquic_buffer * | imquic_buffer_create (uint64_t stream_id) |
Helper method to create a new buffer. | |
void | imquic_buffer_destroy (imquic_buffer *buf) |
Helper method to destroy an existing buffer. | |
imquic_buffer_chunk * | imquic_buffer_chunk_create (uint8_t *data, uint64_t offset, uint64_t length) |
Helper to create a chunk out of existing data. | |
void | imquic_buffer_chunk_free (imquic_buffer_chunk *chunk) |
Helper to quickly free a buffer chunk. | |
uint64_t | imquic_buffer_put (imquic_buffer *buf, uint8_t *data, uint64_t offset, uint64_t length) |
Helper method to add new data to the buffer at a specific offset, as a new chunk. | |
uint64_t | imquic_buffer_append (imquic_buffer *buf, uint8_t *data, uint64_t length) |
Helper method to add new data at the end of the buffer, as a new chunk. | |
imquic_buffer_chunk * | imquic_buffer_peek (imquic_buffer *buf) |
Helper method to peek at a buffer and check if there's data to read. | |
imquic_buffer_chunk * | imquic_buffer_get (imquic_buffer *buf) |
Helper method to get a chunk of data from the buffer. | |
void | imquic_buffer_print (int level, imquic_buffer *buf) |
Helper method to print the contents of a buffer. | |
Buffer abstraction.
Abstraction of a chunked buffer, to be used either during CRYPTO exchanges in the Initial/Handshake phase, or with STREAM after a connection has been established. It provides a high level interface to adding chunks to the queue (in a gap-aware way), and to retrieving data in an ordered way (waiting in case gaps are encountered).
uint64_t imquic_buffer_append | ( | imquic_buffer * | buf, |
uint8_t * | data, | ||
uint64_t | length ) |
Helper method to add new data at the end of the buffer, as a new chunk.
buf | The imquic_buffer instance to add data to |
data | The data to add to the buffer |
length | Length of this new data |
imquic_buffer_chunk * imquic_buffer_chunk_create | ( | uint8_t * | data, |
uint64_t | offset, | ||
uint64_t | length ) |
Helper to create a chunk out of existing data.
data | The data to put in the chunk |
offset | The offset of the data in the parent buffer |
length | The size of the data |
void imquic_buffer_chunk_free | ( | imquic_buffer_chunk * | chunk | ) |
Helper to quickly free a buffer chunk.
chunk | The buffer chunk to free |
imquic_buffer * imquic_buffer_create | ( | uint64_t | stream_id | ) |
Helper method to create a new buffer.
stream_id | Stream ID this buffer belongs to (ignored when used with CRYPTO frames) |
void imquic_buffer_destroy | ( | imquic_buffer * | buf | ) |
Helper method to destroy an existing buffer.
buf | The imquic_buffer instance to destroy |
imquic_buffer_chunk * imquic_buffer_get | ( | imquic_buffer * | buf | ) |
Helper method to get a chunk of data from the buffer.
buf | The imquic_buffer instance to get the data from |
imquic_buffer_chunk * imquic_buffer_peek | ( | imquic_buffer * | buf | ) |
Helper method to peek at a buffer and check if there's data to read.
buf | The imquic_buffer instance to peek |
void imquic_buffer_print | ( | int | level, |
imquic_buffer * | buf ) |
Helper method to print the contents of a buffer.
level | Log level at which this should be printed |
buf | The imquic_buffer instance whose content should be printed |
uint64_t imquic_buffer_put | ( | imquic_buffer * | buf, |
uint8_t * | data, | ||
uint64_t | offset, | ||
uint64_t | length ) |
Helper method to add new data to the buffer at a specific offset, as a new chunk.
buf | The imquic_buffer instance to add data to |
data | The data to add to the buffer |
offset | Offset in the overall buffer where this new data should be placed |
length | Length of this new data |