Loading...
Searching...
No Matches
buffer.h
Go to the documentation of this file.
1
9
10#ifndef IMQUIC_BUFFER_H
11#define IMQUIC_BUFFER_H
12
13#include <stdint.h>
14
15#include <glib.h>
16
18typedef struct imquic_buffer {
20 uint8_t *bytes;
22 uint64_t length;
24 uint64_t size;
32imquic_buffer *imquic_buffer_create(uint8_t *bytes, uint64_t size);
38gboolean imquic_buffer_resize(imquic_buffer *buffer, uint64_t new_size);
46int imquic_buffer_append(imquic_buffer *buffer, uint8_t *bytes, uint64_t length);
51void imquic_buffer_shift(imquic_buffer *buffer, uint64_t length);
55
56#endif
void imquic_buffer_destroy(imquic_buffer *buffer)
Destroy an existing buffer.
Definition buffer.c:59
void imquic_buffer_shift(imquic_buffer *buffer, uint64_t length)
Move the data in the buffer back of a specific number of bytes.
Definition buffer.c:48
imquic_buffer * imquic_buffer_create(uint8_t *bytes, uint64_t size)
Create a new buffer.
Definition buffer.c:14
gboolean imquic_buffer_resize(imquic_buffer *buffer, uint64_t new_size)
Resize an existing buffer.
Definition buffer.c:23
int imquic_buffer_append(imquic_buffer *buffer, uint8_t *bytes, uint64_t length)
Append data at the end of the buffer.
Definition buffer.c:34
Internal buffer.
Definition buffer.h:18
uint64_t size
Overall size of the buffer.
Definition buffer.h:24
uint8_t * bytes
Buffer containing the data.
Definition buffer.h:20
uint64_t length
Size of the data currently in the buffer.
Definition buffer.h:22