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_s
 

Typedefs

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 int(* fr_bio_packet_release_t) (fr_bio_packet_t *bio, fr_packet_t *packet)
 Release 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 *request_ctx, fr_packet_t *packet, fr_pair_list_t *list)
 Write a packet and pairs from the network. More...
 

Functions

static int fr_bio_packet_read (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 from a packet BIO. More...
 
static int fr_bio_packet_write (fr_bio_packet_t *bio, void *request_ctx, fr_packet_t *packet, fr_pair_list_t *list)
 Write a packet to a packet BIO. More...
 

Detailed Description

Binary IO abstractions for fr_packet_t.

Id
6426d5d9f6f456d0d160edab6a2be4fac1b341ba

Definition in file packet.h.


Data Structure Documentation

◆ fr_bio_packet_s

struct fr_bio_packet_s

Definition at line 69 of file packet.h.

+ Collaboration diagram for fr_bio_packet_s:
Data Fields
fr_bio_t * bio underlying bio for IO
fr_bio_packet_read_t read read from the underlying bio
void * uctx user ctx, caller can manually set it.
fr_bio_packet_write_t write write to the underlying bio

Typedef Documentation

◆ 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_release_t

typedef int(* fr_bio_packet_release_t) (fr_bio_packet_t *bio, fr_packet_t *packet)

Release an outgoing packet.

Parameters
biothe packet-based bio
packetthe output packet descriptor. Contains raw protocol data (IDs, counts, etc.)
Returns
  • <0 on error
  • 0 for success

Definition at line 67 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 *request_ctx, fr_packet_t *packet, fr_pair_list_t *list)

Write a packet and pairs from the network.

Parameters
biothe packet-based bio
request_ctxthe 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_read()

static int fr_bio_packet_read ( fr_bio_packet_t bio,
void **  request_ctx_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
biothe packet-based bio
[out]request_ctx_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 94 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 bio,
void *  request_ctx,
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
biothe packet-based bio
request_ctxthe larger context for the packet
packetthe output packet descriptor. Contains raw protocol data (IDs, counts, etc.)
listof pairs to write
Returns

Definition at line 113 of file packet.h.

+ Here is the caller graph for this function: