27 RCSIDH(lib_bio_base_h,
"$Id: b3549cfb06fa84d6e66f22e90b8686ded7c8c447 $")
29 #include <freeradius-devel/util/debug.h>
30 #include <freeradius-devel/util/dlist.h>
35 #define XDEBUG(fmt, ...) fprintf(stderr, fmt, ## __VA_ARGS__)
39 # error _CONST can only be defined in the local header
116 if (!prev)
return NULL;
125 if (!next)
return NULL;
143 if (size == 0)
return 0;
166 if (size == 0)
return 0;
181 #define fr_bio_destructor (NULL)
184 #define fr_bio_error(_x) (-(FR_BIO_ERROR_ ## _x))
static int const char char buffer[256]
fr_bio_write_t _CONST write
write to the underlying bio
int fr_bio_free(fr_bio_t *bio)
Free this bio, and everything it calls.
fr_bio_read_t _CONST read
read from the underlying bio
int(* fr_bio_accept_t)(fr_bio_t *bio, TALLOC_CTX *ctx, fr_bio_t **accepted)
Accept a new connection on a bio.
fr_dlist_t _CONST entry
in the linked list of multiple bios
static ssize_t fr_bio_write(fr_bio_t *bio, void *packet_ctx, void const *buffer, size_t size)
Write raw data to a bio.
ssize_t(* fr_bio_read_t)(fr_bio_t *bio, void *packet_ctx, void *buffer, size_t size)
Do a raw read from a socket, or other data source.
static ssize_t fr_bio_read(fr_bio_t *bio, void *packet_ctx, void *buffer, size_t size)
Read raw data from a bio.
@ FR_BIO_ERROR_BUFFER_FULL
the buffer is full
@ FR_BIO_ERROR_GENERIC
generic "failed" error - check fr_strerror()
@ FR_BIO_ERROR_IO
IO error - check errno.
@ FR_BIO_ERROR_VERIFY
some packet verification error
@ FR_BIO_ERROR_IO_WOULD_BLOCK
IO would block.
@ FR_BIO_ERROR_BUFFER_TOO_SMALL
the output buffer is too small for the data
int(* fr_bio_callback_t)(fr_bio_t *bio)
fr_bio_callback_t activate
ssize_t(* fr_bio_write_t)(fr_bio_t *bio, void *packet_ctx, const void *buffer, size_t size)
fr_bio_callback_t shutdown
int fr_bio_shutdown_intermediate(fr_bio_t *bio)
Like fr_bio_shutdown(), but can be called by anyone in the chain.
static fr_bio_t * fr_bio_prev(fr_bio_t *bio)
static fr_bio_t * fr_bio_next(fr_bio_t *bio)
void * uctx
user ctx, caller can manually set it.
char const * fr_bio_strerror(ssize_t error)
int fr_bio_destructor(fr_bio_t *bio)
Free this bio.
int fr_bio_shutdown(fr_bio_t *bio)
Shut down a set of BIOs.
static void * fr_dlist_entry_to_item(size_t offset, fr_dlist_t const *entry)
Get the item from a fr_dlist_t.
Entry in a doubly linked list.