#include <stdint.h>
#include <stddef.h>
#include <stdbool.h>
Go to the source code of this file.
|
bool | buffer_can_read (const buffer_t *buffer, size_t n) |
|
bool | buffer_seek_set (buffer_t *buffer, size_t offset) |
|
bool | buffer_seek_cur (buffer_t *buffer, size_t offset) |
|
bool | buffer_seek_end (buffer_t *buffer, size_t offset) |
|
bool | buffer_read_u8 (buffer_t *buffer, uint8_t *value) |
|
bool | buffer_read_u16 (buffer_t *buffer, uint16_t *value, endianness_t endianness) |
|
bool | buffer_read_u32 (buffer_t *buffer, uint32_t *value, endianness_t endianness) |
|
bool | buffer_read_u64 (buffer_t *buffer, uint64_t *value, endianness_t endianness) |
|
bool | buffer_read_varint (buffer_t *buffer, uint64_t *value) |
|
bool | buffer_read_bip32_path (buffer_t *buffer, uint32_t *out, size_t out_len) |
|
bool | buffer_copy (const buffer_t *buffer, uint8_t *out, size_t out_len) |
|
bool | buffer_move (buffer_t *buffer, uint8_t *out, size_t out_len) |
|
◆ endianness_t
Enumeration for endianness.
Enumerator |
---|
BE | |
LE | Big Endian.
Little Endian
|
Definition at line 10 of file buffer.h.
◆ buffer_can_read()
bool buffer_can_read |
( |
const buffer_t * |
buffer, |
|
|
size_t |
n |
|
) |
| |
Tell whether buffer can read bytes or not.
- Parameters
-
[in] | buffer | Pointer to input buffer struct. |
[in] | n | Number of bytes to read in buffer. |
- Returns
- true if success, false otherwise.
Definition at line 27 of file buffer.c.
◆ buffer_copy()
bool buffer_copy |
( |
const buffer_t * |
buffer, |
|
|
uint8_t * |
out, |
|
|
size_t |
out_len |
|
) |
| |
Copy bytes from buffer without moving offset.
- Parameters
-
[in] | buffer | Pointer to input buffer struct. |
[out] | out | Pointer to output byte buffer. |
[in] | out_len | Length of output byte buffer. |
- Returns
- true if success, false otherwise.
Definition at line 153 of file buffer.c.
◆ buffer_move()
Move bytes from buffer.
- Parameters
-
[in,out] | buffer | Pointer to input buffer struct. |
[out] | out | Pointer to output byte buffer. |
[in] | out_len | Length of output byte buffer. |
- Returns
- true if success, false otherwise.
Definition at line 164 of file buffer.c.
◆ buffer_read_bip32_path()
bool buffer_read_bip32_path |
( |
buffer_t * |
buffer, |
|
|
uint32_t * |
out, |
|
|
size_t |
out_len |
|
) |
| |
Read BIP32 path from buffer.
- Parameters
-
[in,out] | buffer | Pointer to input buffer struct. |
[out] | out | Pointer to output 32-bit integer buffer. |
[in] | out_len | Number of BIP32 paths read in the output buffer. |
- Returns
- true if success, false otherwise.
Definition at line 141 of file buffer.c.
◆ buffer_read_u16()
Read 2 bytes from buffer into uint16_t.
- Parameters
-
[in,out] | buffer | Pointer to input buffer struct. |
[out] | value | Pointer to 16-bit unsigned integer read from buffer. |
[in] | endianness | Either BE (Big Endian) or LE (Little Endian). |
- Returns
- true if success, false otherwise.
Definition at line 80 of file buffer.c.
◆ buffer_read_u32()
Read 4 bytes from buffer into uint32_t.
- Parameters
-
[in,out] | buffer | Pointer to input buffer struct. |
[out] | value | Pointer to 32-bit unsigned integer read from buffer. |
[in] | endianness | Either BE (Big Endian) or LE (Little Endian). |
- Returns
- true if success, false otherwise.
Definition at line 96 of file buffer.c.
◆ buffer_read_u64()
Read 8 bytes from buffer into uint64_t.
- Parameters
-
[in,out] | buffer | Pointer to input buffer struct. |
[out] | value | Pointer to 64-bit unsigned integer read from buffer. |
[in] | endianness | Either BE (Big Endian) or LE (Little Endian). |
- Returns
- true if success, false otherwise.
Definition at line 112 of file buffer.c.
◆ buffer_read_u8()
Read 1 byte from buffer into uint8_t.
- Parameters
-
[in,out] | buffer | Pointer to input buffer struct. |
[out] | value | Pointer to 8-bit unsigned integer read from buffer. |
- Returns
- true if success, false otherwise.
Definition at line 66 of file buffer.c.
◆ buffer_read_varint()
bool buffer_read_varint |
( |
buffer_t * |
buffer, |
|
|
uint64_t * |
value |
|
) |
| |
◆ buffer_seek_cur()
bool buffer_seek_cur |
( |
buffer_t * |
buffer, |
|
|
size_t |
offset |
|
) |
| |
Seek buffer relatively to current offset.
- Parameters
-
[in,out] | buffer | Pointer to input buffer struct. |
[in] | offset | Offset to seek relatively to buffer->offset . |
- Returns
- true if success, false otherwise.
Definition at line 43 of file buffer.c.
◆ buffer_seek_end()
bool buffer_seek_end |
( |
buffer_t * |
buffer, |
|
|
size_t |
offset |
|
) |
| |
Seek the buffer relatively to the end.
- Parameters
-
[in,out] | buffer | Pointer to input buffer struct. |
[in] | offset | Offset to seek relatively to buffer->size . |
- Returns
- true if success, false otherwise.
Definition at line 55 of file buffer.c.
◆ buffer_seek_set()
bool buffer_seek_set |
( |
buffer_t * |
buffer, |
|
|
size_t |
offset |
|
) |
| |
Seek the buffer to specific offset.
- Parameters
-
[in,out] | buffer | Pointer to input buffer struct. |
[in] | offset | Specific offset to seek. |
- Returns
- true if success, false otherwise.
Definition at line 32 of file buffer.c.