The FreeRADIUS server  $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
Data Structures | Typedefs | Functions
packet.h File Reference

Binary IO abstractions for fr_packet_t. More...

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

Go to the source code of this file.

Data Structures

struct  fr_bio_packet_cb_funcs_t
 
struct  fr_bio_packet_s
 

Typedefs

typedef void(* fr_bio_packet_callback_t) (fr_bio_packet_t *bio)
 
typedef int(* fr_bio_packet_io_t) (fr_bio_packet_t *bio)
 
typedef int(* fr_bio_packet_read_t) (fr_bio_packet_t *bio, void **request_ctx_p, fr_packet_t **packet_p, TALLOC_CTX *out_ctx, fr_pair_list_t *out)
 Read a packet and pairs from the network. More...
 
typedef void(* fr_bio_packet_signal_t) (fr_bio_packet_t *bio, fr_packet_t *packet)
 Signal an outgoing packet. More...
 
typedef struct fr_bio_packet_s fr_bio_packet_t
 
typedef int(* fr_bio_packet_write_t) (fr_bio_packet_t *bio, void *rctx, fr_packet_t *packet, fr_pair_list_t *list)
 Write a packet and pairs from the network. More...
 

Functions

int fr_bio_packet_connect (fr_bio_t *bio)
 
void fr_bio_packet_connected (fr_bio_t *bio)
 Called when a particular BIO is connected. More...
 
void fr_bio_packet_init (fr_bio_packet_t *my)
 
static int fr_bio_packet_read (fr_bio_packet_t *my, void **pctx_p, fr_packet_t **packet_p, TALLOC_CTX *out_ctx, fr_pair_list_t *out)
 Read a packet from a packet BIO. More...
 
static int fr_bio_packet_write (fr_bio_packet_t *my, void *pctx, fr_packet_t *packet, fr_pair_list_t *list)
 Write a packet to a packet BIO. More...
 
static int fr_bio_packet_write_flush (fr_bio_packet_t *my)
 Flush a bio which is blocked. More...
 

Detailed Description

Binary IO abstractions for fr_packet_t.

Id
67853fd048f654ca4e0d5094fcfdfb72b21164d7

Definition in file packet.h.


Data Structure Documentation

◆ fr_bio_packet_cb_funcs_t

struct fr_bio_packet_cb_funcs_t

Definition at line 70 of file packet.h.

+ Collaboration diagram for fr_bio_packet_cb_funcs_t:
Data Fields
fr_bio_packet_callback_t connected
fr_bio_packet_callback_t eof
fr_bio_packet_callback_t failed
fr_bio_packet_io_t read_blocked
fr_bio_packet_io_t read_resume
fr_bio_packet_signal_t release
fr_bio_packet_signal_t retry
fr_bio_packet_callback_t shutdown
fr_bio_packet_io_t write_blocked
fr_bio_packet_io_t write_resume

◆ fr_bio_packet_s

struct fr_bio_packet_s

Definition at line 86 of file packet.h.

+ Collaboration diagram for fr_bio_packet_s:
Data Fields
fr_bio_t * bio underlying BIO(s) for IO
fr_bio_packet_cb_funcs_t cb
bool connected
fr_event_timer_t const * ev connection timeout
fr_bio_packet_read_t read read from the underlying bio
bool read_blocked
void * uctx user ctx, caller can manually set it.
fr_bio_packet_write_t write write to the underlying bio
bool write_blocked

Typedef Documentation

◆ fr_bio_packet_callback_t

typedef void(* fr_bio_packet_callback_t) (fr_bio_packet_t *bio)

Definition at line 68 of file packet.h.

◆ fr_bio_packet_io_t

typedef int(* fr_bio_packet_io_t) (fr_bio_packet_t *bio)

Definition at line 66 of file packet.h.

◆ fr_bio_packet_read_t

typedef int(* fr_bio_packet_read_t) (fr_bio_packet_t *bio, void **request_ctx_p, fr_packet_t **packet_p, TALLOC_CTX *out_ctx, fr_pair_list_t *out)

Read a packet and pairs from the network.

Parameters
biothe packet-based bio
request_ctx_pthe request context associated with the response
packet_pthe response packet. Contains raw protocol data (IDs, counts, etc.)
out_ctxtalloc context for the list
outthe decoded pairs from the packet
Returns
  • <0 on error
  • 0 for success (*packet_p may still be NULL tho)

Definition at line 45 of file packet.h.

◆ fr_bio_packet_signal_t

typedef void(* fr_bio_packet_signal_t) (fr_bio_packet_t *bio, fr_packet_t *packet)

Signal an outgoing packet.

Parameters
biothe packet-based bio
packetthe output packet descriptor. Contains raw protocol data (IDs, counts, etc.)

Definition at line 64 of file packet.h.

◆ fr_bio_packet_t

Definition at line 1 of file packet.h.

◆ fr_bio_packet_write_t

typedef int(* fr_bio_packet_write_t) (fr_bio_packet_t *bio, void *rctx, fr_packet_t *packet, fr_pair_list_t *list)

Write a packet and pairs from the network.

Parameters
biothe packet-based bio
rctxthe request context
packetthe request packet. Contains raw protocol data (IDs, counts, etc.)
listthe pairs to encode in the packet
Returns
  • <0 on error (EOF, fail, etc,)
  • 0 for success

Definition at line 57 of file packet.h.

Function Documentation

◆ fr_bio_packet_connect()

int fr_bio_packet_connect ( fr_bio_t bio)

◆ fr_bio_packet_connected()

void fr_bio_packet_connected ( fr_bio_t bio)

Called when a particular BIO is connected.

We see if we can connect the previous BIOs.

Definition at line 116 of file packet.c.

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

◆ fr_bio_packet_init()

void fr_bio_packet_init ( fr_bio_packet_t my)

Definition at line 177 of file packet.c.

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

◆ fr_bio_packet_read()

static int fr_bio_packet_read ( fr_bio_packet_t my,
void **  pctx_p,
fr_packet_t **  packet_p,
TALLOC_CTX *  out_ctx,
fr_pair_list_t out 
)
inlinestatic

Read a packet from a packet BIO.

Note that the bio MAY return fr_bio_error(IO_WOULD_BLOCK), which is not a fatal error. The caller has to check for that case, and handle blocking errors. Typically by pushing the packet to a queue, and trying it again later.

Parameters
mythe packet-based bio
[out]pctx_pthe larger context for the original request packet
[out]packet_pWhere the allocated fr_packet_t will be stored
[out]out_ctxfor the output pairs
[out]outdecoded output pairs
Returns

Definition at line 119 of file packet.h.

+ Here is the caller graph for this function:

◆ fr_bio_packet_write()

static int fr_bio_packet_write ( fr_bio_packet_t my,
void *  pctx,
fr_packet_t packet,
fr_pair_list_t list 
)
inlinestatic

Write a packet to a packet BIO.

Note that the bio MAY return fr_bio_error(IO_WOULD_BLOCK), which is not a fatal error. The caller has to check for that case, and handle blocking errors. Typically by pushing the packet to a queue, and trying it again later.

Parameters
mythe packet-based bio
pctxthe larger context for the packet
packetthe output packet descriptor. Contains raw protocol data (IDs, counts, etc.)
listof pairs to write
Returns

Definition at line 138 of file packet.h.

+ Here is the caller graph for this function:

◆ fr_bio_packet_write_flush()

static int fr_bio_packet_write_flush ( fr_bio_packet_t my)
inlinestatic

Flush a bio which is blocked.

Note that the bio MAY return fr_bio_error(IO_WOULD_BLOCK), which is not a fatal error. The caller has to check for that case, and handle blocking errors. Typically by pushing the packet to a queue, and trying it again later.

Parameters
mythe packet-based bio
Returns

Definition at line 165 of file packet.h.