Data Structures | |
struct | __ac_buffer |
struct | __ac_buffer_builder |
Buffer | |
typedef struct __ac_buffer | ac_buffer_t |
void | ac_buffer_init (ac_buffer_t *pBuf, const uint8_t *data, size_t size) |
Initialize ac_buffer using underlying byte array, set ac_buffer's length to 0 (empty) More... | |
void | ac_buffer_dup (ac_buffer_t *pBuf, const ac_buffer_t *pBufIn) |
Copy pBufIn to pBuf. More... | |
static const uint8_t * | ac_buffer_data (const ac_buffer_t *pBuf) |
Get buffer's underlying byte array. More... | |
static size_t | ac_buffer_size (const ac_buffer_t *pBuf) |
Get buffer's size. More... | |
static ac_buffer_t * | ac_buffer_next (const ac_buffer_t *pBuf) |
Get next buffer in chain. More... | |
static void | ac_buffer_set_next (ac_buffer_t *pBuf, ac_buffer_t *pNextBuf) |
Set next buffer in chain. More... | |
void | ac_buffer_append (ac_buffer_t *pBuf, ac_buffer_t *pAppBuf) |
Append buffer to end of chain. More... | |
void | ac_buffer_split (ac_buffer_t *pStartBuf, ac_buffer_t *pEndBuf, ac_buffer_t *pBuf, size_t length) |
Truncate pBuf to length bytes and save the remaining bytes in pEndBuf. More... | |
void | ac_buffer_dump (ac_buffer_t *pBuf) |
Buffer Builder | |
typedef struct __ac_buffer_builder | ac_buffer_builder_t |
void | ac_buffer_builder_write_be (ac_buffer_builder_t *pBuilder, const uint8_t *buf, size_t size) |
Write data to big endian ac_buffer (on a LE architecture, byte order will be swapped) More... | |
void | ac_buffer_builder_write_le (ac_buffer_builder_t *pBuilder, const uint8_t *buf, size_t size) |
Write data to little endian ac_buffer (on a LE architecture, byte order will be preserved) More... | |
void | ac_buffer_builder_write_be_at (ac_buffer_builder_t *pBuilder, size_t pos, const uint8_t *buf, size_t size) |
Write data to big endian ac_buffer at specific position (on a LE architecture, byte order will be swapped) More... | |
void | ac_buffer_builder_write_le_at (ac_buffer_builder_t *pBuilder, size_t pos, const uint8_t *buf, size_t size) |
Write data to little endian ac_buffer at specific position (on a LE architecture, byte order will be preserved) More... | |
void | ac_buffer_builder_init (ac_buffer_builder_t *pBuilder, uint8_t *data, size_t size) |
Initialize ac_buffer builder. More... | |
void | ac_buffer_builder_from_buffer (ac_buffer_builder_t *pBuilder) |
Initialize ac_buffer builder from underlying ac_buffer. More... | |
void | ac_buffer_builder_reset (ac_buffer_builder_t *pBuilder) |
Reset ac_buffer builder. More... | |
void | ac_buffer_builder_set_full (ac_buffer_builder_t *pBuilder) |
Set ac_buffer builder's ac_buffer to full size. More... | |
static size_t | ac_buffer_builder_length (ac_buffer_builder_t *pBuilder) |
Get ac_buffer builder's length. More... | |
static void | ac_buffer_builder_set_length (ac_buffer_builder_t *pBuilder, size_t length) |
Set ac_buffer builder's length. More... | |
static uint8_t * | ac_buffer_builder_write_position (ac_buffer_builder_t *pBuilder) |
Get ac_buffer builder's pointer to write position. More... | |
static size_t | ac_buffer_builder_write_offset (ac_buffer_builder_t *pBuilder) |
Get ac_buffer builder's write offset. More... | |
static void | ac_buffer_builder_set_write_offset (ac_buffer_builder_t *pBuilder, size_t off) |
Set ac_buffer builder's write offset. More... | |
static size_t | ac_buffer_builder_read_offset (ac_buffer_builder_t *pBuilder) |
Get ac_buffer builder's read offset. More... | |
static void | ac_buffer_builder_set_read_offset (ac_buffer_builder_t *pBuilder, size_t off) |
Set ac_buffer builder's read offset. More... | |
static ac_buffer_t * | ac_buffer_builder_buffer (ac_buffer_builder_t *pBuilder) |
Get ac_buffer builder's underlying ac_buffer. More... | |
static size_t | ac_buffer_builder_space (ac_buffer_builder_t *pBuilder) |
Get space in ac_buffer builder. More... | |
static bool | ac_buffer_builder_empty (ac_buffer_builder_t *pBuilder) |
Is ac_buffer builder empty. More... | |
static bool | ac_buffer_full (ac_buffer_builder_t *pBuilder) |
Is ac_buffer builder full. More... | |
static void | ac_buffer_builder_write_nu8 (ac_buffer_builder_t *pBuilder, uint8_t hu8) |
Write 8-bit value in ac_buffer builder. More... | |
static void | ac_buffer_builder_write_nu16 (ac_buffer_builder_t *pBuilder, uint16_t hu16) |
Write 16-bit value in ac_buffer builder. More... | |
static void | ac_buffer_builder_write_nu24 (ac_buffer_builder_t *pBuilder, uint32_t hu24) |
Write 24-bit value in ac_buffer builder. More... | |
static void | ac_buffer_builder_write_nu32 (ac_buffer_builder_t *pBuilder, uint32_t hu32) |
Write 32-bit value in ac_buffer builder. More... | |
static void | ac_buffer_builder_write_nu64 (ac_buffer_builder_t *pBuilder, uint64_t hu64) |
Write 64-bit value in ac_buffer builder. More... | |
static void | ac_buffer_builder_write_n_bytes (ac_buffer_builder_t *pBuilder, const uint8_t *data, size_t size) |
Write n-bytes value in ac_buffer builder. More... | |
static void | ac_buffer_builder_write_nu8_at (ac_buffer_builder_t *pBuilder, size_t off, uint8_t hu8) |
Write 8-bit value in ac_buffer builder at specified position. More... | |
static void | ac_buffer_builder_write_nu16_at (ac_buffer_builder_t *pBuilder, size_t off, uint16_t hu16) |
Write 16-bit value in ac_buffer builder at specified position. More... | |
static void | ac_buffer_builder_write_nu24_at (ac_buffer_builder_t *pBuilder, size_t off, uint32_t hu24) |
Write 24-bit value in ac_buffer builder at specified position. More... | |
static void | ac_buffer_builder_write_nu32_at (ac_buffer_builder_t *pBuilder, size_t off, uint32_t hu32) |
Write 32-bit value in ac_buffer builder at specified position. More... | |
static void | ac_buffer_builder_write_nu64_at (ac_buffer_builder_t *pBuilder, size_t off, uint64_t hu64) |
Write 64-bit value in ac_buffer builder at specified position. More... | |
static void | ac_buffer_builder_write_n_bytes_at (ac_buffer_builder_t *pBuilder, size_t off, const uint8_t *data, size_t size) |
Write n-bytes value in ac_buffer builder at specified position. More... | |
void | ac_buffer_builder_write_n_skip (ac_buffer_builder_t *pBuilder, size_t size) |
Skip n-bytes in ac_buffer builder. More... | |
void | ac_buffer_builder_copy_n_bytes (ac_buffer_builder_t *pBuilderOut, ac_buffer_t *pBufIn, size_t size) |
Copy n bytes from buffer to builder. More... | |
void | ac_buffer_builder_compact (ac_buffer_builder_t *pBuilder) |
Compact builder Will move underlying buffer's byte to start of allocated buffer. More... | |
static size_t | ac_buffer_builder_writable (ac_buffer_builder_t *pBuilder) |
Get number of writable bytes in ac_buffer builder. More... | |
Buffer Reader | |
void | ac_buffer_read_be (ac_buffer_t *pBuf, uint8_t *buf, size_t size) |
Read n-bytes in big-endian format from buffer reader and advance read posiion. More... | |
void | ac_buffer_read_le (ac_buffer_t *pBuf, uint8_t *buf, size_t size) |
Read n-bytes in little-endian format from buffer reader and advance read posiion. More... | |
static uint8_t | ac_buffer_read_nu8 (ac_buffer_t *pBuf) |
Read 8-bit value from buffer reader and advance read posiion. More... | |
static uint16_t | ac_buffer_read_nu16 (ac_buffer_t *pBuf) |
Read BE 16-bit value from buffer reader and advance read posiion. More... | |
static uint32_t | ac_buffer_read_nu24 (ac_buffer_t *pBuf) |
Read BE 24-bit value from buffer reader and advance read posiion. More... | |
static uint32_t | ac_buffer_read_nu32 (ac_buffer_t *pBuf) |
Read BE 32-bit value from buffer reader and advance read posiion. More... | |
static uint64_t | ac_buffer_read_nu64 (ac_buffer_t *pBuf) |
Read BE 64-bit value from buffer reader and advance read posiion. More... | |
static void | ac_buffer_read_n_bytes (ac_buffer_t *pBuf, uint8_t *data, size_t size) |
Read n bytes from buffer reader and advance read posiion. More... | |
void | ac_buffer_read_n_skip (ac_buffer_t *pBuf, size_t size) |
Skip n bytes from buffer reader and advance read posiion. More... | |
size_t | ac_buffer_reader_readable (const ac_buffer_t *pBuf) |
Get number of bytes readable from buffer. More... | |
const uint8_t * | ac_buffer_reader_current_buffer_pointer (ac_buffer_t *pBuf) |
Get a pointer to the current position within this buffer's current backing array. More... | |
size_t | ac_buffer_reader_current_buffer_length (ac_buffer_t *pBuf) |
Get the number of bytes readable within the current backing array. More... | |
bool | ac_buffer_reader_cmp_bytes (const ac_buffer_t *pBuf, const uint8_t *bytes, size_t length) |
Compare buffer with array (does not advance read position) More... | |
bool | ac_buffer_reader_cmp (const ac_buffer_t *pBuf1, const ac_buffer_t *pBuf2) |
Compare buffer with array (does not advance read position) More... | |
void ac_buffer_append | ( | ac_buffer_t * | pBuf, |
ac_buffer_t * | pAppBuf | ||
) |
Append buffer to end of chain.
pBuf | pointer to ac_buffer_t structure |
pAppBuf | pointer to buffer to append to chain |
|
static |
Get ac_buffer builder's underlying ac_buffer.
pBuilder | ac_buffer builder |
Definition at line 185 of file ac_buffer_builder.h.
void ac_buffer_builder_compact | ( | ac_buffer_builder_t * | pBuilder | ) |
Compact builder Will move underlying buffer's byte to start of allocated buffer.
pBuilder | ac_buffer builder |
void ac_buffer_builder_copy_n_bytes | ( | ac_buffer_builder_t * | pBuilderOut, |
ac_buffer_t * | pBufIn, | ||
size_t | size | ||
) |
Copy n bytes from buffer to builder.
pBuilderOut | ac_buffer builder |
pBufIn | the input buffer |
size | number of bytes to copy |
|
static |
Is ac_buffer builder empty.
pBuilder | ac_buffer builder |
Definition at line 203 of file ac_buffer_builder.h.
void ac_buffer_builder_from_buffer | ( | ac_buffer_builder_t * | pBuilder | ) |
Initialize ac_buffer builder from underlying ac_buffer.
pBuilder | ac_buffer builder to init |
void ac_buffer_builder_init | ( | ac_buffer_builder_t * | pBuilder, |
uint8_t * | data, | ||
size_t | size | ||
) |
Initialize ac_buffer builder.
pBuilder | ac_buffer builder to init |
data | pointer to byte array to use |
size | of byte array |
|
static |
Get ac_buffer builder's length.
pBuilder | ac_buffer builder to get length of |
Definition at line 104 of file ac_buffer_builder.h.
|
static |
Get ac_buffer builder's read offset.
pBuilder | ac_buffer builder |
Definition at line 159 of file ac_buffer_builder.h.
void ac_buffer_builder_reset | ( | ac_buffer_builder_t * | pBuilder | ) |
Reset ac_buffer builder.
pBuilder | ac_buffer builder to reset |
void ac_buffer_builder_set_full | ( | ac_buffer_builder_t * | pBuilder | ) |
Set ac_buffer builder's ac_buffer to full size.
pBuilder | ac_buffer builder to set to full size |
|
static |
Set ac_buffer builder's length.
pBuilder | ac_buffer builder to set length of |
length | number of valid bytes in ac_buffer |
Definition at line 113 of file ac_buffer_builder.h.
|
static |
Set ac_buffer builder's read offset.
pBuilder | ac_buffer builder |
off | new read offset |
Definition at line 168 of file ac_buffer_builder.h.
|
static |
Set ac_buffer builder's write offset.
pBuilder | ac_buffer builder |
off | new write offset |
Definition at line 143 of file ac_buffer_builder.h.
|
static |
Get space in ac_buffer builder.
pBuilder | ac_buffer builder |
Definition at line 194 of file ac_buffer_builder.h.
|
static |
Get number of writable bytes in ac_buffer builder.
pBuilder | ac_buffer builder |
Definition at line 356 of file ac_buffer_builder.h.
void ac_buffer_builder_write_be | ( | ac_buffer_builder_t * | pBuilder, |
const uint8_t * | buf, | ||
size_t | size | ||
) |
Write data to big endian ac_buffer (on a LE architecture, byte order will be swapped)
pBuilder | ac_buffer builder to use |
buf | pointer to data |
size | the data size |
void ac_buffer_builder_write_be_at | ( | ac_buffer_builder_t * | pBuilder, |
size_t | pos, | ||
const uint8_t * | buf, | ||
size_t | size | ||
) |
Write data to big endian ac_buffer at specific position (on a LE architecture, byte order will be swapped)
pBuilder | ac_buffer builder to use |
pos | position in ac_buffer to write from |
buf | pointer to data |
size | the data size |
void ac_buffer_builder_write_le | ( | ac_buffer_builder_t * | pBuilder, |
const uint8_t * | buf, | ||
size_t | size | ||
) |
Write data to little endian ac_buffer (on a LE architecture, byte order will be preserved)
pBuilder | ac_buffer builder to use |
buf | pointer to data |
size | the data size |
void ac_buffer_builder_write_le_at | ( | ac_buffer_builder_t * | pBuilder, |
size_t | pos, | ||
const uint8_t * | buf, | ||
size_t | size | ||
) |
Write data to little endian ac_buffer at specific position (on a LE architecture, byte order will be preserved)
pBuilder | ac_buffer builder to use |
pos | position in ac_buffer to write from |
buf | pointer to data |
size | the data size |
|
static |
Write n-bytes value in ac_buffer builder.
pBuilder | ac_buffer builder |
data | data to write |
size | data length |
Definition at line 267 of file ac_buffer_builder.h.
|
static |
Write n-bytes value in ac_buffer builder at specified position.
pBuilder | ac_buffer builder |
off | offset at which to write |
data | data to write |
size | data length |
Definition at line 328 of file ac_buffer_builder.h.
void ac_buffer_builder_write_n_skip | ( | ac_buffer_builder_t * | pBuilder, |
size_t | size | ||
) |
Skip n-bytes in ac_buffer builder.
pBuilder | ac_buffer builder |
size | number of bytes to skip |
|
static |
Write 16-bit value in ac_buffer builder.
pBuilder | ac_buffer builder |
hu16 | 16-bit value to write in big-endian format |
Definition at line 230 of file ac_buffer_builder.h.
|
static |
Write 16-bit value in ac_buffer builder at specified position.
pBuilder | ac_buffer builder |
off | offset at which to write |
hu16 | 16-bit value to write |
Definition at line 287 of file ac_buffer_builder.h.
|
static |
Write 24-bit value in ac_buffer builder.
pBuilder | ac_buffer builder |
hu24 | 24-bit value to write in big-endian format |
Definition at line 239 of file ac_buffer_builder.h.
|
static |
Write 24-bit value in ac_buffer builder at specified position.
pBuilder | ac_buffer builder |
off | offset at which to write |
hu24 | 24-bit value to write |
Definition at line 297 of file ac_buffer_builder.h.
|
static |
Write 32-bit value in ac_buffer builder.
pBuilder | ac_buffer builder |
hu32 | 32-bit value to write in big-endian format |
Definition at line 248 of file ac_buffer_builder.h.
|
static |
Write 32-bit value in ac_buffer builder at specified position.
pBuilder | ac_buffer builder |
off | offset at which to write |
hu32 | 32-bit value to write |
Definition at line 307 of file ac_buffer_builder.h.
|
static |
Write 64-bit value in ac_buffer builder.
pBuilder | ac_buffer builder |
hu64 | 64-bit value to write in big-endian format |
Definition at line 257 of file ac_buffer_builder.h.
|
static |
Write 64-bit value in ac_buffer builder at specified position.
pBuilder | ac_buffer builder |
off | offset at which to write |
hu64 | 64-bit value to write |
Definition at line 317 of file ac_buffer_builder.h.
|
static |
Write 8-bit value in ac_buffer builder.
pBuilder | ac_buffer builder |
hu8 | 8-bit value to write |
Definition at line 221 of file ac_buffer_builder.h.
|
static |
Write 8-bit value in ac_buffer builder at specified position.
pBuilder | ac_buffer builder |
off | offset at which to write |
hu8 | 8-bit value to write |
Definition at line 277 of file ac_buffer_builder.h.
|
static |
Get ac_buffer builder's write offset.
pBuilder | ac_buffer builder |
Definition at line 134 of file ac_buffer_builder.h.
|
static |
Get ac_buffer builder's pointer to write position.
pBuilder | ac_buffer builder |
Definition at line 125 of file ac_buffer_builder.h.
|
static |
Get buffer's underlying byte array.
pBuf | pointer to ac_buffer_t structure |
Definition at line 63 of file ac_buffer.h.
void ac_buffer_dup | ( | ac_buffer_t * | pBuf, |
const ac_buffer_t * | pBufIn | ||
) |
Copy pBufIn to pBuf.
pBuf | pointer to ac_buffer_t structure to initialize |
pBufIn | the source buffer |
|
static |
Is ac_buffer builder full.
pBuilder | ac_buffer builder |
Definition at line 212 of file ac_buffer_builder.h.
void ac_buffer_init | ( | ac_buffer_t * | pBuf, |
const uint8_t * | data, | ||
size_t | size | ||
) |
Initialize ac_buffer using underlying byte array, set ac_buffer's length to 0 (empty)
pBuf | pointer to ac_buffer_t structure to initialize |
data | byte array to use |
size | size of byte array |
|
static |
Get next buffer in chain.
pBuf | pointer to ac_buffer_t structure |
Definition at line 81 of file ac_buffer.h.
void ac_buffer_read_be | ( | ac_buffer_t * | pBuf, |
uint8_t * | buf, | ||
size_t | size | ||
) |
Read n-bytes in big-endian format from buffer reader and advance read posiion.
pBuf | the buffer to read from |
buf | the array to write to |
size | the number of bytes to read |
void ac_buffer_read_le | ( | ac_buffer_t * | pBuf, |
uint8_t * | buf, | ||
size_t | size | ||
) |
Read n-bytes in little-endian format from buffer reader and advance read posiion.
pBuf | the buffer to read from |
buf | the array to write to |
size | the number of bytes to read |
|
static |
Read n bytes from buffer reader and advance read posiion.
pBuf | the buffer to read from |
data | the array to write bytes to |
size | the number of bytes to read |
Definition at line 116 of file ac_buffer_reader.h.
void ac_buffer_read_n_skip | ( | ac_buffer_t * | pBuf, |
size_t | size | ||
) |
Skip n bytes from buffer reader and advance read posiion.
pBuf | the buffer to read from |
size | the number of bytes to skip |
|
static |
Read BE 16-bit value from buffer reader and advance read posiion.
pBuf | the buffer to read from |
Definition at line 71 of file ac_buffer_reader.h.
|
static |
Read BE 24-bit value from buffer reader and advance read posiion.
pBuf | the buffer to read from |
Definition at line 82 of file ac_buffer_reader.h.
|
static |
Read BE 32-bit value from buffer reader and advance read posiion.
pBuf | the buffer to read from |
Definition at line 93 of file ac_buffer_reader.h.
|
static |
Read BE 64-bit value from buffer reader and advance read posiion.
pBuf | the buffer to read from |
Definition at line 104 of file ac_buffer_reader.h.
|
static |
Read 8-bit value from buffer reader and advance read posiion.
pBuf | the buffer to read from |
Definition at line 60 of file ac_buffer_reader.h.
bool ac_buffer_reader_cmp | ( | const ac_buffer_t * | pBuf1, |
const ac_buffer_t * | pBuf2 | ||
) |
Compare buffer with array (does not advance read position)
pBuf1 | the buffer to compare from |
pBuf2 | the buffer to compare with |
bool ac_buffer_reader_cmp_bytes | ( | const ac_buffer_t * | pBuf, |
const uint8_t * | bytes, | ||
size_t | length | ||
) |
Compare buffer with array (does not advance read position)
pBuf | the buffer to compare from |
bytes | the array to compare with |
length | the array length |
size_t ac_buffer_reader_current_buffer_length | ( | ac_buffer_t * | pBuf | ) |
Get the number of bytes readable within the current backing array.
pBuf | the buffer to read from |
const uint8_t* ac_buffer_reader_current_buffer_pointer | ( | ac_buffer_t * | pBuf | ) |
Get a pointer to the current position within this buffer's current backing array.
pBuf | the buffer to read from |
size_t ac_buffer_reader_readable | ( | const ac_buffer_t * | pBuf | ) |
Get number of bytes readable from buffer.
pBuf | the buffer to read from |
|
static |
Set next buffer in chain.
pBuf | pointer to ac_buffer_t structure |
pNextBuf | pointer to next buffer (or NULL to break chain) |
Definition at line 90 of file ac_buffer.h.
|
static |
Get buffer's size.
pBuf | pointer to ac_buffer_t structure |
Definition at line 72 of file ac_buffer.h.
void ac_buffer_split | ( | ac_buffer_t * | pStartBuf, |
ac_buffer_t * | pEndBuf, | ||
ac_buffer_t * | pBuf, | ||
size_t | length | ||
) |
Truncate pBuf to length bytes and save the remaining bytes in pEndBuf.
pBuf | The buffer to split (will be set to invalid state) |
pStartBuf | A new buffer at the head of the split |
pEndBuf | A new buffer at the tail of the split |
length | How long pStartBuf should be (if longer than pBuf, then pStartBuf will be pBuf) |