|
| static void | fd_body (fr_dbuff_t *dbuff, uint8_t const data[]) |
| |
| static void | max_body (fr_dbuff_t *dbuff, uint8_t const data[]) |
| |
| static void | test_dbuff_advance_extend (void) |
| | Test fr_dbuff_advance_extend against a talloc-backed (extensible) dbuff.
|
| |
| static void | test_dbuff_bind_end_abs_extend (void) |
| | FR_DBUFF_BIND_END_ABS hands the extend function to the producer.
|
| |
| static void | test_dbuff_child (void) |
| | Test the child-dbuff macros: FR_DBUFF, FR_DBUFF_ABS, FR_DBUFF_BIND_CURRENT, FR_DBUFF_BIND_CURRENT_ABS, FR_DBUFF_BIND_END_ABS and FR_DBUFF_MAX.
|
| |
| static void | test_dbuff_const_no_extend (void) |
| | A const dbuff must never extend.
|
| |
| static void | test_dbuff_drain (void) |
| | Draining a buffer without knowing in advance how much is in it.
|
| |
| static void | test_dbuff_extend (void) |
| | Test the extension-request API: fr_dbuff_extend, fr_dbuff_extend_lowat, fr_dbuff_is_extendable and fr_dbuff_was_extended.
|
| |
| static void | test_dbuff_fd (void) |
| |
| static void | test_dbuff_fd_max (void) |
| |
| static void | test_dbuff_fd_shell (fr_dbuff_fd_test_body body, uint8_t const data[], size_t datasize, uint8_t buff[], size_t buffsize, size_t max) |
| |
| static void | test_dbuff_in_memcpy (void) |
| | Test fr_dbuff_in_memcpy, fr_dbuff_in_memcpy_partial and fr_dbuff_in_bytes_partial.
|
| |
| static void | test_dbuff_init (void) |
| |
| static void | test_dbuff_init_no_parent (void) |
| |
| static void | test_dbuff_init_zero_length (void) |
| | A zero length output buffer accepts nothing, and nothing is written to the buffer.
|
| |
| static void | test_dbuff_marker_release (void) |
| | Test fr_dbuff_marker_release, fr_dbuff_marker_release_behind and _ahead.
|
| |
| static void | test_dbuff_max (void) |
| |
| static void | test_dbuff_measure (void) |
| | Test the measurement / accessor macros against both a dbuff and a marker.
|
| |
| static void | test_dbuff_memset (void) |
| | Test fr_dbuff_memset.
|
| |
| static void | test_dbuff_move (void) |
| |
| static void | test_dbuff_net_encode (void) |
| | Test the various dbuff_net_encode() functions and macros.
|
| |
| static void | test_dbuff_no_advance (void) |
| |
| static void | test_dbuff_out (void) |
| | Test functions that read from dbuffs.
|
| |
| static void | test_dbuff_out_int64v (void) |
| | Test fr_dbuff_out_int64v, which sign-extends based on the most significant bit.
|
| |
| static void | test_dbuff_producer_consumer (void) |
| | A producer and a consumer sharing one talloc buffer.
|
| |
| static void | test_dbuff_producer_consumer_rounds (void) |
| | A consumer which is drained, refilled, and drained again.
|
| |
| static void | test_dbuff_set (void) |
| | Test fr_dbuff_set (by size_t, pointer, marker) and fr_dbuff_set_end.
|
| |
| static void | test_dbuff_shift (void) |
| | Test fr_dbuff_shift moves unconsumed content to the front of the buffer.
|
| |
| static void | test_dbuff_talloc_extend (void) |
| | Test extensible dbuffs.
|
| |
| static void | test_dbuff_talloc_extend_multi_level (void) |
| |
| static void | test_dbuff_tmp (void) |
| | Test FR_DBUFF_TMP, the compound-literal dbuff.
|
| |
| static void | test_dbuff_trim_reset_talloc (void) |
| | Test fr_dbuff_trim_talloc, fr_dbuff_reset_talloc and fr_dbuff_free_talloc.
|
| |
| static void | test_dbuff_update (void) |
| | Test fr_dbuff_update repoints the dbuff and its markers after a buffer move.
|
| |
| static void test_dbuff_bind_end_abs_extend |
( |
void |
| ) |
|
|
static |
FR_DBUFF_BIND_END_ABS hands the extend function to the producer.
The bind is what creates the producer/consumer relationship, so the bind is where the rule belongs. Only the producer may extend, because fr_dbuff_update() repairs the dbuff which was extended and that dbuff's ancestors, and never its children. Extending through the consumer would leave the producer addressing the old buffer.
The producer's fields are copied out of the consumer while the consumer is still writable, because the compound literal is a function argument and so is evaluated before the bind runs. These checks pin that ordering, which the whole scheme rests on.
Definition at line 1132 of file dbuff_tests.c.
| static void test_dbuff_child |
( |
void |
| ) |
|
|
static |
Test the child-dbuff macros: FR_DBUFF, FR_DBUFF_ABS, FR_DBUFF_BIND_CURRENT, FR_DBUFF_BIND_CURRENT_ABS, FR_DBUFF_BIND_END_ABS and FR_DBUFF_MAX.
These differ only in where the child's 'start' pointer is set (parent 'current' vs parent 'start') and whether writing to the child advances the parent's 'current' pointer, 'end' pointer, or neither.
Definition at line 562 of file dbuff_tests.c.
| static void test_dbuff_const_no_extend |
( |
void |
| ) |
|
|
static |
A const dbuff must never extend.
A dbuff extends to make room to write. A const dbuff cannot be written to, so a request to extend one is always a caller asking to read more than the dbuff holds. _fr_dbuff_extend_lowat() answers with what is there, rather than reallocating the buffer.
Definition at line 993 of file dbuff_tests.c.
| static void test_dbuff_measure |
( |
void |
| ) |
|
|
static |
Test the measurement / accessor macros against both a dbuff and a marker.
Covers fr_dbuff_len, fr_dbuff_buff, fr_dbuff_end, fr_dbuff_ptr, fr_dbuff_behind and fr_dbuff_ahead, which the existing tests never touch.
Definition at line 635 of file dbuff_tests.c.
| static void test_dbuff_producer_consumer |
( |
void |
| ) |
|
|
static |
A producer and a consumer sharing one talloc buffer.
fr_tls_bio_dbuff_t in src/lib/tls/bio.c builds its two cursors this way, so that OpenSSL and the caller share one allocation per direction. The consumer is the parent and the producer is the child.
Only the producer may extend. fr_dbuff_update() repairs the dbuff which was extended and that dbuff's ancestors, and never its children, so extending through the consumer would leave the producer addressing the old buffer. Marking the consumer const is what stops that, which is what this test pins.
Definition at line 1036 of file dbuff_tests.c.
| static void test_dbuff_producer_consumer_rounds |
( |
void |
| ) |
|
|
static |
A consumer which is drained, refilled, and drained again.
fr_tls_bio_dbuff_t is used this way for a whole TLS handshake, so the cursors have to survive more than one round. A read leaves the consumer empty without any reset, which is what lets a caller loop on fr_dbuff_remaining() rather than tracking a fill and drain phase.
Definition at line 1193 of file dbuff_tests.c.
| static void test_dbuff_set |
( |
void |
| ) |
|
|
static |
Test fr_dbuff_set (by size_t, pointer, marker) and fr_dbuff_set_end.
The backing array is deliberately larger than the dbuff window so that we can form a pointer past the dbuff 'end' without forming a pointer outside the real allocation (which would be undefined behaviour).
Definition at line 677 of file dbuff_tests.c.