The FreeRADIUS server  $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
Functions
base.c File Reference

Binary IO abstractions. More...

#include <freeradius-devel/bio/bio_priv.h>
#include <freeradius-devel/bio/null.h>
#include <freeradius-devel/util/syserror.h>
+ Include dependency graph for base.c:

Go to the source code of this file.

Functions

int fr_bio_destructor (fr_bio_t *bio)
 Free this bio. More...
 
ssize_t fr_bio_eof_read (UNUSED fr_bio_t *bio, UNUSED void *packet_ctx, UNUSED void *buffer, UNUSED size_t size)
 Always returns EOF on fr_bio_read() More...
 
int fr_bio_free (fr_bio_t *bio)
 Free this bio, and everything it calls. More...
 
ssize_t fr_bio_next_read (fr_bio_t *bio, void *packet_ctx, void *buffer, size_t size)
 Internal bio function which just reads from the "next" bio. More...
 
ssize_t fr_bio_next_write (fr_bio_t *bio, void *packet_ctx, void const *buffer, size_t size)
 Internal bio function which just writes to the "next" bio. More...
 
int fr_bio_shutdown (fr_bio_t *bio)
 Shut down a set of BIOs. More...
 
int fr_bio_shutdown_intermediate (fr_bio_t *bio)
 Like fr_bio_shutdown(), but can be called by anyone in the chain. More...
 
char const * fr_bio_strerror (ssize_t error)
 

Detailed Description

Binary IO abstractions.

Id
5dd95f1053bc436ea55b867bf4acf2efa5958108

Definition in file base.c.

Function Documentation

◆ fr_bio_destructor()

int fr_bio_destructor ( fr_bio_t bio)

Free this bio.

The bio can only be freed if it is not in any chain.

Definition at line 34 of file base.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fr_bio_eof_read()

ssize_t fr_bio_eof_read ( UNUSED fr_bio_t bio,
UNUSED void *  packet_ctx,
UNUSED void *  buffer,
UNUSED size_t  size 
)

Always returns EOF on fr_bio_read()

Definition at line 49 of file base.c.

+ Here is the caller graph for this function:

◆ fr_bio_free()

int fr_bio_free ( fr_bio_t bio)

Free this bio, and everything it calls.

We unlink the bio chain, and then free it individually. If there's an error, the bio chain is relinked. That way the error can be addressed (somehow) and this function can be called again.

Note that we do not support talloc_free() for the bio chain. Each individual bio has to be unlinked from the chain before the destructor will allow it to be freed. This functionality is by design.

We want to have an API where bios are created "bottom up", so that it is impossible for an application to create an incorrect chain. However, creating the chain bottom up means that the lower bios not parented from the higher bios, and therefore talloc_free() won't free them. As a result, we need an explicit bio_free() function.

Definition at line 113 of file base.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fr_bio_next_read()

ssize_t fr_bio_next_read ( fr_bio_t bio,
void *  packet_ctx,
void *  buffer,
size_t  size 
)

Internal bio function which just reads from the "next" bio.

It is mainly used when the current bio needs to modify the write path, but does not need to do anything on the read path.

Definition at line 59 of file base.c.

+ Here is the call graph for this function:

◆ fr_bio_next_write()

ssize_t fr_bio_next_write ( fr_bio_t bio,
void *  packet_ctx,
void const *  buffer,
size_t  size 
)

Internal bio function which just writes to the "next" bio.

It is mainly used when the current bio needs to modify the read path, but does not need to do anything on the write path.

Definition at line 82 of file base.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fr_bio_shutdown()

int fr_bio_shutdown ( fr_bio_t bio)

Shut down a set of BIOs.

Must be called from the top-most bio.

Will shut down the bios from the bottom-up.

The shutdown function MUST be callable multiple times without breaking.

Definition at line 152 of file base.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fr_bio_shutdown_intermediate()

int fr_bio_shutdown_intermediate ( fr_bio_t bio)

Like fr_bio_shutdown(), but can be called by anyone in the chain.

Definition at line 186 of file base.c.

+ Here is the call graph for this function:

◆ fr_bio_strerror()

char const* fr_bio_strerror ( ssize_t  error)

Definition at line 197 of file base.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function: