24#include <freeradius-devel/bio/bio_priv.h>
25#include <freeradius-devel/bio/null.h>
26#include <freeradius-devel/bio/mem.h>
28#include <freeradius-devel/bio/pipe.h>
52 pthread_mutex_destroy(&
my->mutex);
68 pthread_mutex_lock(&
my->mutex);
69 rcode =
my->next->read(
my->next, packet_ctx,
buffer, size);
70 if ((rcode == 0) &&
my->eof) {
71 pthread_mutex_unlock(&
my->mutex);
76 my->priv_cb.eof = NULL;
80 }
else if (rcode > 0) {
86 my->signal.writeable(&
my->bio);
88 pthread_mutex_unlock(&
my->mutex);
105 pthread_mutex_lock(&
my->mutex);
107 rcode =
my->next->write(
my->next, packet_ctx,
buffer, size);
115 my->signal.readable(&
my->bio);
121 pthread_mutex_unlock(&
my->mutex);
136 pthread_mutex_lock(&
my->mutex);
138 pthread_mutex_unlock(&
my->mutex);
152 pthread_mutex_lock(&
my->mutex);
154 pthread_mutex_unlock(&
my->mutex);
183 if (buffer_size < 1024) buffer_size = 1024;
184 if (buffer_size > (1 << 20)) buffer_size = (1 << 20);
187 if (!
my)
return NULL;
197 pthread_mutex_init(&
my->mutex, NULL);
static int const char char buffer[256]
#define FR_BIO_DESTRUCTOR_COMMON
Define a common destructor pattern.
void fr_bio_shutdown & my
void fr_bio_eof(fr_bio_t *bio)
Internal BIO function to run EOF callbacks.
int fr_bio_shutdown(fr_bio_t *bio)
Shut down a set of BIOs.
fr_bio_t * fr_bio_mem_sink_alloc(TALLOC_CTX *ctx, size_t read_size)
Allocate a memory buffer which sinks data from a bio system into the callers application.
static int fr_bio_pipe_eof(fr_bio_t *bio)
Set EOF.
static ssize_t fr_bio_pipe_read(fr_bio_t *bio, void *packet_ctx, void *buffer, size_t size)
Read from the pipe.
fr_bio_t * fr_bio_pipe_alloc(TALLOC_CTX *ctx, fr_bio_pipe_cb_funcs_t *cb, size_t buffer_size)
Allocate a thread-safe pipe which can be used for both reads and writes.
static int fr_bio_pipe_shutdown(fr_bio_t *bio)
Shutdown callback.
fr_bio_pipe_cb_funcs_t signal
inform us that the pipe is readable
static ssize_t fr_bio_pipe_write(fr_bio_t *bio, void *packet_ctx, void const *buffer, size_t size)
Write to the pipe.
static int fr_bio_pipe_destructor(fr_bio_pipe_t *my)
fr_bio_callback_t writeable
fr_bio_callback_t readable