The FreeRADIUS server $Id: a4e7f8c94e8038b7627bcf52356b7ed15955c1d7 $
Loading...
Searching...
No Matches
Data Structures | Macros | Typedefs | Functions
bio_priv.h File Reference

Binary IO private functions. More...

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

Go to the source code of this file.

Data Structures

struct  fr_bio_common_s
 
struct  fr_bio_priv_callback_t
 

Macros

#define _BIO_PRIVATE   1
 
#define FR_BIO_COMMON
 Common elements at the start of each private fr_bio_t.
 
#define FR_BIO_DESTRUCTOR_COMMON
 Define a common destructor pattern.
 

Typedefs

typedef struct fr_bio_common_s fr_bio_common_t
 

Functions

static void fr_bio_chain (fr_bio_t *first, fr_bio_t *second)
 Chain one bio after another.
 
fr_bio_t * fr_bio_eof (fr_bio_t *bio)
 Tell the chain that a bio is at EOF, and let the application drain whatever is buffered.
 
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.
 
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.
 
static void fr_bio_unchain (fr_bio_t *bio)
 Remove a bio from a chain.
 
int fr_bio_write_blocked (fr_bio_t *bio)
 Internal BIO function to tell all BIOs that it's blocked.
 

Detailed Description

Binary IO private functions.

Id
13908e0885c18cd435e43b77016349a51813c1b7

Create abstract binary input / output buffers.

Definition in file bio_priv.h.


Data Structure Documentation

◆ fr_bio_common_s

struct fr_bio_common_s

Definition at line 56 of file bio_priv.h.

Data Fields
FR_BIO_COMMON

◆ fr_bio_priv_callback_t

struct fr_bio_priv_callback_t

Definition at line 34 of file bio_priv.h.

+ Collaboration diagram for fr_bio_priv_callback_t:
Data Fields
fr_bio_io_t connected
fr_bio_io_t eof
fr_bio_callback_t failed
fr_bio_io_t read_blocked
fr_bio_io_t read_resume "unblocked" is too similar to "blocked"
fr_bio_io_t shutdown
fr_bio_io_t write_blocked
fr_bio_io_t write_resume

Macro Definition Documentation

◆ _BIO_PRIVATE

#define _BIO_PRIVATE   1

Definition at line 29 of file bio_priv.h.

◆ FR_BIO_COMMON

#define FR_BIO_COMMON
Value:
fr_bio_t bio; \
bool shutdown_pending

Common elements at the start of each private fr_bio_t.

only meaningful on the head bio, see fr_bio_shutdown()

Definition at line 54 of file bio_priv.h.

◆ FR_BIO_DESTRUCTOR_COMMON

#define FR_BIO_DESTRUCTOR_COMMON
Value:
do { \
if (my->priv_cb.shutdown) { \
int rcode; \
/* \
* A free cannot wait for the application to drain any buffered data, so this \
* tears the chain down now even if a shutdown was deferred. \
*/ \
rcode = fr_bio_shutdown_discard(&my->bio); \
if (rcode < 0) return rcode; \
} \
if (fr_bio_prev(&my->bio) || fr_bio_next(&my->bio)) \
fr_bio_unchain(&my->bio); \
} while (0)
while(1)
Definition acutest.h:1009
static fr_bio_t * fr_bio_prev(fr_bio_t *bio)
Definition base.h:122
static fr_bio_t * fr_bio_next(fr_bio_t *bio)
Definition base.h:131
static void fr_bio_unchain(fr_bio_t *bio)
Remove a bio from a chain.
Definition bio_priv.h:103
int fr_bio_shutdown_discard(fr_bio_t *bio)
Shut down the chain now, discarding anything which is still buffered.
Definition base.c:207

Define a common destructor pattern.

Ensure that talloc_free() is safe no matter what. The caller can free any BIO at any time. If that happens, then the entire chain is shut down. On successful shutdown, this BIO is removed from the chain.

Definition at line 65 of file bio_priv.h.

Typedef Documentation

◆ fr_bio_common_t

Definition at line 32 of file bio_priv.h.

Function Documentation

◆ fr_bio_chain()

static void fr_bio_chain ( fr_bio_t *  first,
fr_bio_t *  second 
)
inlinestatic

Chain one bio after another.

Todo:
  • this likely needs to be public

Definition at line 86 of file bio_priv.h.

+ Here is the caller graph for this function:

◆ fr_bio_eof()

fr_bio_t * fr_bio_eof ( fr_bio_t *  bio)

Tell the chain that a bio is at EOF, and let the application drain whatever is buffered.

Returns
  • NULL if every bio in the chain is at EOF
  • the bio which still holds data, and which therefore stopped the walk

Tell the chain that a bio is at EOF, and let the application drain whatever is buffered.

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 279 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 49 of file base.c.

+ Here is the call graph for this function:
+ Here is the caller 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 64 of file base.c.

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

◆ fr_bio_unchain()

static void fr_bio_unchain ( fr_bio_t *  bio)
inlinestatic

Remove a bio from a chain.

And reset prev/next ptrs to NULL.

Todo:
  • this likely needs to be public

Definition at line 103 of file bio_priv.h.

+ Here is the call 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 346 of file base.c.

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