24 #include <freeradius-devel/bio/bio_priv.h>
25 #include <freeradius-devel/bio/mem.h>
27 #include <freeradius-devel/bio/pipe.h>
49 pthread_mutex_destroy(&my->
mutex);
65 pthread_mutex_lock(&my->
mutex);
67 if ((rcode == 0) && my->
eof) {
70 }
else if (rcode > 0) {
78 pthread_mutex_unlock(&my->
mutex);
95 pthread_mutex_lock(&my->
mutex);
111 pthread_mutex_unlock(&my->
mutex);
126 pthread_mutex_lock(&my->
mutex);
128 pthread_mutex_unlock(&my->
mutex);
153 if (buffer_size < 1024) buffer_size = 1024;
154 if (buffer_size > (1 << 20)) buffer_size = (1 << 20);
157 if (!my)
return NULL;
167 pthread_mutex_init(&my->
mutex, NULL);
186 pthread_mutex_lock(&my->
mutex);
188 pthread_mutex_unlock(&my->
mutex);
static int const char char buffer[256]
fr_bio_write_t _CONST write
write to the underlying bio
fr_bio_read_t _CONST read
read from the underlying bio
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 ssize_t fr_bio_pipe_read(fr_bio_t *bio, void *packet_ctx, void *buffer, size_t size)
Read from the pipe.
static int fr_bio_pipe_shutdown(fr_bio_t *bio)
Shutdown callback.
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.
void fr_bio_pipe_set_eof(fr_bio_t *bio)
Set EOF.
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