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

void fr_bio_cb_set (fr_bio_t *bio, fr_bio_cb_funcs_t const *cb)
 
int fr_bio_destructor (fr_bio_t *bio)
 Free this bio. More...
 
void fr_bio_eof (fr_bio_t *bio)
 Internal BIO function to run EOF callbacks. 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)
 
int fr_bio_write_blocked (fr_bio_t *bio)
 Internal BIO function to tell all BIOs that it's blocked. More...
 

Detailed Description

Binary IO abstractions.

Id
7f2b086babc82fa38d572cb5648bd43c594737c8

Definition in file base.c.

Function Documentation

◆ fr_bio_cb_set()

void fr_bio_cb_set ( fr_bio_t bio,
fr_bio_cb_funcs_t const *  cb 
)

Definition at line 225 of file base.c.

+ Here is the caller graph for this function:

◆ 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()

void fr_bio_eof ( fr_bio_t bio)

Internal BIO function to run EOF callbacks.

When a BIO hits EOF, it MUST call this function. This function will take care of changing the read() function to return nothing. It will also take care of walking back up the hierarchy, and calling any BIO EOF callbacks.

Once all of the BIOs have been marked as blocked, it will call the application EOF callback.

Definition at line 244 of file base.c.

+ Here is the call graph for this function:
+ 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 105 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 51 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 74 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.

We shut down the BIOs from the top to the bottom. This gives the TLS BIO an opportunity to call the SSL_shutdown() routine, which should then write to the FD BIO.

Definition at line 141 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 185 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 196 of file base.c.

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

◆ fr_bio_write_blocked()

int fr_bio_write_blocked ( fr_bio_t bio)

Internal BIO function to tell all BIOs that it's blocked.

When a BIO blocks on write, it MUST call this function. This function will take care of walking back up the hierarchy, and calling any write_blocked callbacks.

Once all of the BIOs have been marked as blocked, it will call the application write_blocked callback.

Definition at line 293 of file base.c.

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