FreeRDP
|
Data Structures | |
struct | RingBuffer |
ring buffer meta data More... | |
struct | DataChunk |
a piece of data in the ring buffer, exactly like a glibc iovec More... | |
Functions | |
FREERDP_API BOOL | ringbuffer_init (RingBuffer *rb, size_t initialSize) |
FREERDP_API void | ringbuffer_destroy (RingBuffer *ringbuffer) |
FREERDP_API size_t | ringbuffer_used (const RingBuffer *ringbuffer) |
FREERDP_API size_t | ringbuffer_capacity (const RingBuffer *ringbuffer) |
FREERDP_API BOOL | ringbuffer_write (RingBuffer *rb, const BYTE *ptr, size_t sz) |
FREERDP_API BYTE * | ringbuffer_ensure_linear_write (RingBuffer *rb, size_t sz) |
FREERDP_API BOOL | ringbuffer_commit_written_bytes (RingBuffer *rb, size_t sz) |
FREERDP_API int | ringbuffer_peek (const RingBuffer *rb, DataChunk chunks[2], size_t sz) |
FREERDP_API void | ringbuffer_commit_read_bytes (RingBuffer *rb, size_t sz) |
FREERDP_API size_t ringbuffer_capacity | ( | const RingBuffer * | ringbuffer | ) |
returns the capacity of the ring buffer
ringbuffer | A pointer to the ringbuffer |
FREERDP_API void ringbuffer_commit_read_bytes | ( | RingBuffer * | rb, |
size_t | sz | ||
) |
move ahead the read head in case some byte were read using ringbuffer_peek() This function is used to commit the bytes that were effectively consumed.
rb | the ring buffer |
sz | the number of bytes to read |
FREERDP_API BOOL ringbuffer_commit_written_bytes | ( | RingBuffer * | rb, |
size_t | sz | ||
) |
move ahead the write head in case some byte were written directly by using a pointer retrieved via ringbuffer_ensure_linear_write(). This function is used to commit the written bytes. The provided size should not exceed the size ensured by ringbuffer_ensure_linear_write()
rb | the ring buffer |
sz | the number of bytes that have been written |
FREERDP_API void ringbuffer_destroy | ( | RingBuffer * | ringbuffer | ) |
destroys internal data used by this ringbuffer
ringbuffer | A pointer to the ringbuffer |
FREERDP_API BYTE* ringbuffer_ensure_linear_write | ( | RingBuffer * | rb, |
size_t | sz | ||
) |
ensures that we have sz bytes available at the write head, and return a pointer on the write head
rb | the ring buffer |
sz | the size to ensure |
FREERDP_API BOOL ringbuffer_init | ( | RingBuffer * | rb, |
size_t | initialSize | ||
) |
initialise a ringbuffer
initialSize | the initial capacity of the ringBuffer |
FREERDP_API int ringbuffer_peek | ( | const RingBuffer * | rb, |
DataChunk | chunks[2], | ||
size_t | sz | ||
) |
peeks the buffer chunks for sz bytes and returns how many chunks are filled. Note that the sum of the resulting chunks may be smaller than sz.
rb | the ringbuffer |
chunks | an array of data chunks that will contain data / size of chunks |
sz | the requested size |
FREERDP_API size_t ringbuffer_used | ( | const RingBuffer * | ringbuffer | ) |
computes the space used in this ringbuffer
ringbuffer | A pointer to the ringbuffer |
FREERDP_API BOOL ringbuffer_write | ( | RingBuffer * | rb, |
const BYTE * | ptr, | ||
size_t | sz | ||
) |
writes some bytes in the ringbuffer, if the data doesn't fit, the ringbuffer is resized automatically
rb | the ringbuffer |
ptr | a pointer on the data to add |
sz | the size of the data to add |
Write to a ringbuffer
rb | A pointer to the ringbuffer |
ptr | A pointer to the data to write |
sz | The number of bytes to write |