![]() |
The FreeRADIUS server $Id: a4e7f8c94e8038b7627bcf52356b7ed15955c1d7 $
|
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. | |
Protocol-specific callbacks for the bios.
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.
| 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 |
| 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 |
| 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 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.
| ctx | talloc ctx for the pairs. | |
| [out] | out | where the decoded pairs go. The pairs include the protocol header pairs, e.g. Packet-Type. |
| packet | the packet to decode. The function does not change the packet. | |
| packet_len | length of the packet. | |
| original | the request, when decoding a reply. NULL when decoding a request. | |
| original_len | length of the request. | |
| uctx | protocol-specific settings, e.g. fr_radius_bio_verify_t |
Definition at line 81 of file protocol.h.
| 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.
| out | where the packet goes. |
| outlen | the size of out. |
| list | the pairs to encode, including the protocol header pairs, e.g. Packet-Type. |
| original | the request, when encoding a reply. NULL when encoding a request. |
| original_len | length of the request. |
| uctx | protocol-specific settings, e.g. fr_radius_bio_verify_t |
Definition at line 97 of file protocol.h.
| 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.
| uctx | protocol-specific settings, e.g. fr_radius_bio_verify_t | |
| [out] | want | how many octets the packet needs. Set when returning 0 or 1. |
| data | the data which has been read | |
| data_len | how much data has been read. Always > 0. |
*want octets*want octets of data are a complete, well-formed packet Definition at line 48 of file protocol.h.
| 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.
| ctx | talloc 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. |
| packet | the packet that the dedup bio read |
| packet_len | length of the packet |
| uctx | the packet_ctx of the read, e.g. fr_bio_fd_packet_ctx_t |
Definition at line 65 of file protocol.h.
1.9.8