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

Protocol-specific callbacks for the bios. More...

#include <freeradius-devel/util/talloc.h>
#include <freeradius-devel/util/time.h>
#include <freeradius-devel/util/misc.h>
#include <freeradius-devel/util/pair.h>
+ Include dependency graph for protocol.h:

Go to the source code of this file.

Data Structures

struct  fr_bio_protocol_t
 The settings and functions which define transport for a protocol. More...
 
struct  fr_bio_protocol_t.cleanup_delay
 
struct  fr_bio_protocol_t.track_duplicates
 

Typedefs

typedef ssize_t(* fr_bio_protocol_decode_t) (TALLOC_CTX *ctx, fr_pair_list_t *out, uint8_t const *packet, size_t packet_len, uint8_t const *original, size_t original_len, void *uctx)
 Decode a packet into pairs.
 
typedef ssize_t(* fr_bio_protocol_encode_t) (uint8_t *out, size_t outlen, fr_pair_list_t *list, uint8_t const *original, size_t original_len, void *uctx)
 Encode pairs into a packet.
 
typedef int(* fr_bio_protocol_validate_t) (void *uctx, size_t *want, uint8_t const *data, size_t data_len)
 Check whether a packet is well-formed.
 
typedef void *(* fr_protocol_dedup_ctx_t) (TALLOC_CTX *ctx, uint8_t const *packet, size_t packet_len, void *uctx)
 Create the dedup context of a packet.
 

Detailed Description

Protocol-specific callbacks for the bios.

Id
58cd02456522ff3b1f9b465afc43e133df91565e

This header declares the callback types which each protocol library implements, so that a bio such as the dedup bio can handle packets without knowing the protocol. This header depends only on lib/util, so that every protocol library can include this header. This header MUST NOT include any other bio header.

Definition in file protocol.h.


Data Structure Documentation

◆ fr_bio_protocol_t

struct fr_bio_protocol_t

The settings and functions which define transport for a protocol.

Each protocol library can export one of these structures, as libfreeradius_<name>_bio_protocol.

Definition at line 104 of file protocol.h.

+ Collaboration diagram for fr_bio_protocol_t:
Data Fields
struct fr_bio_protocol_t.cleanup_delay cleanup_delay
fr_bio_protocol_decode_t decode decode a packet into pairs
fr_cmp_t dedup_cmp compare the dedup contexts of two fr_bio_dedup_entry_t
fr_protocol_dedup_ctx_t dedup_ctx create the dedup context of a packet
fr_cmp_t duplicate_cmp 0 if two entries with the same key hold the same packet
fr_bio_protocol_encode_t encode encode pairs into a packet
size_t max_packet_size largest valid packet
size_t min_packet_size smallest valid packet
char const * name protocol name, e.g. "radius"
struct fr_bio_protocol_t.track_duplicates track_duplicates
fr_bio_protocol_validate_t validate check whether a packet is well-formed

◆ fr_bio_protocol_t.cleanup_delay

struct fr_bio_protocol_t.cleanup_delay

Definition at line 115 of file protocol.h.

Data Fields
fr_time_delta_t dflt default cleanup_delay
fr_time_delta_t max largest allowed cleanup_delay
fr_time_delta_t min smallest allowed cleanup_delay

◆ fr_bio_protocol_t.track_duplicates

struct fr_bio_protocol_t.track_duplicates

Definition at line 110 of file protocol.h.

Data Fields
bool tcp true if TCP transports track duplicates
bool udp true if UDP transports track duplicates

Typedef Documentation

◆ fr_bio_protocol_decode_t

typedef ssize_t(* fr_bio_protocol_decode_t) (TALLOC_CTX *ctx, fr_pair_list_t *out, uint8_t const *packet, size_t packet_len, uint8_t const *original, size_t original_len, void *uctx)

Decode a packet into pairs.

Parameters
ctxtalloc ctx for the pairs.
[out]outwhere the decoded pairs go. The pairs include the protocol header pairs, e.g. Packet-Type.
packetthe packet to decode. The function does not change the packet.
packet_lenlength of the packet.
originalthe request, when decoding a reply. NULL when decoding a request.
original_lenlength of the request.
uctxprotocol-specific settings, e.g. fr_radius_bio_verify_t
Returns
  • <0 on error.
  • the number of octets decoded.

Definition at line 81 of file protocol.h.

◆ fr_bio_protocol_encode_t

typedef ssize_t(* fr_bio_protocol_encode_t) (uint8_t *out, size_t outlen, fr_pair_list_t *list, uint8_t const *original, size_t original_len, void *uctx)

Encode pairs into a packet.

Parameters
outwhere the packet goes.
outlenthe size of out.
listthe pairs to encode, including the protocol header pairs, e.g. Packet-Type.
originalthe request, when encoding a reply. NULL when encoding a request.
original_lenlength of the request.
uctxprotocol-specific settings, e.g. fr_radius_bio_verify_t
Returns
  • <0 on error.
  • the length of the packet.

Definition at line 97 of file protocol.h.

◆ fr_bio_protocol_validate_t

typedef int(* fr_bio_protocol_validate_t) (void *uctx, size_t *want, uint8_t const *data, size_t data_len)

Check whether a packet is well-formed.

Parameters
uctxprotocol-specific settings, e.g. fr_radius_bio_verify_t
[out]wanthow many octets the packet needs. Set when returning 0 or 1.
datathe data which has been read
data_lenhow much data has been read. Always > 0.
Returns
  • <0 the packet is malformed
  • 0 the packet is incomplete, read until there are *want octets
  • 1 the first *want octets of data are a complete, well-formed packet

Definition at line 48 of file protocol.h.

◆ fr_protocol_dedup_ctx_t

typedef void *(* fr_protocol_dedup_ctx_t) (TALLOC_CTX *ctx, uint8_t const *packet, size_t packet_len, void *uctx)

Create the dedup context of a packet.

The dedup context holds the protocol data which the dedup tree compares, such as the RADIUS ID and Code.

Parameters
ctxtalloc ctx for the dedup context. The dedup bio passes the fr_bio_dedup_entry_t. Allocate the dedup context under ctx. The dedup bio frees every child of ctx when the dedup bio frees or reuses the entry.
packetthe packet that the dedup bio read
packet_lenlength of the packet
uctxthe packet_ctx of the read, e.g. fr_bio_fd_packet_ctx_t
Returns

Definition at line 65 of file protocol.h.