The FreeRADIUS server
$Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
|
Encoder/decoder library interface. More...
#include <freeradius-devel/server/dl_module.h>
#include <freeradius-devel/util/value.h>
Go to the source code of this file.
Data Structures | |
struct | fr_proto_lib_t |
The public structure exported by protocol encoding/decoding libraries. More... | |
struct | fr_proto_stack_frame_t |
A protocol transcoder stack frame. More... | |
struct | fr_proto_stack_t |
Protocol transcoder stack. More... | |
Macros | |
#define | FR_PROTO_STACK_MAX 10 |
Typedefs | |
typedef ssize_t(* | fr_proto_decode_t) (void *proto_ctx, uint8_t const *data, size_t data_len) |
Decode a packet header. More... | |
typedef ssize_t(* | fr_proto_encode_t) (void *proto_ctx, uint8_t *buffer, size_t buffer_len) |
Encode a packet header. More... | |
typedef int(* | fr_proto_get_option_t) (fr_value_box_t *out, void const *proto_ctx, fr_proto_opt_group_t opt_group, int opt) |
Retrieve a protocol option. More... | |
typedef void(* | fr_proto_invert_t) (void *proto_ctx) |
Invert the src and address fields of a proto_ctx. More... | |
typedef int(* | fr_proto_set_option_t) (void *proto_ctx, fr_proto_opt_group_t opt_group, int opt, fr_value_box_t *in) |
Set a protocol option. More... | |
Enumerations | |
enum | fr_proto_opt_app_t { PROTO_OPT_PAIRS = 0 } |
Application options. More... | |
enum | fr_proto_opt_group_t { PROTO_OPT_GROUP_CUSTOM = 0x01 , PROTO_OPT_GROUP_L2 = 0x02 , PROTO_OPT_GROUP_L3 = 0x04 , PROTO_OPT_GROUP_L4 = 0x08 , PROTO_OPT_GROUP_APPLICATION = 0x10 } |
Option contexts. More... | |
enum | fr_proto_opt_l2_t { PROTO_OPT_L2_PAYLOAD_LEN = 0 , PROTO_OPT_L2_SRC_ADDRESS , PROTO_OPT_L2_DST_ADDRESS , PROTO_OPT_L2_NEXT_PROTOCOL } |
Layer 2 options such as Media addresses. More... | |
enum | fr_proto_opt_l3_t { PROTO_OPT_L3_PAYLOAD_LEN = 0 , PROTO_OPT_L3_SRC_ADDRESS , PROTO_OPT_L3_DST_ADDRESS , PROTO_OPT_L3_NEXT_PROTOCOL } |
Layer 3 options, such as IP address. More... | |
enum | fr_proto_opt_l4_t { PROTO_OPT_L4_PAYLOAD_LEN = 0 , PROTO_OPT_L4_SRC_PORT , PROTO_OPT_L4_DST_PORT } |
Layer 4 options, such as port number. More... | |
Encoder/decoder library interface.
Definition in file proto.h.
struct fr_proto_lib_t |
The public structure exported by protocol encoding/decoding libraries.
Data Fields | ||
---|---|---|
fr_proto_decode_t | decode | Function to decode a protocol/header. |
DL_MODULE_COMMON | Common fields to all loadable modules. | |
fr_proto_encode_t | encode | Function to encode a protocol/header. |
fr_proto_get_option_t | get_option | Get data from the proto_ctx. |
fr_proto_invert_t | invert | |
int | opt_group | Option groups implemented by proto lib. |
size_t | proto_ctx_size | Size required for the packet ctx structure. |
fr_proto_set_option_t | set_option | Set data in the proto_ctx. |
struct fr_proto_stack_frame_t |
Data Fields | ||
---|---|---|
fr_proto_lib_t const * | proto | Protocol library. |
void * | proto_ctx | Packet ctx produced by the decoder, or populated for consumption by the encoder. |
struct fr_proto_stack_t |
Protocol transcoder stack.
Describes a series of encoders/decoders data must pass through
Data Fields | ||
---|---|---|
int | depth | |
fr_proto_stack_frame_t | frame[FR_PROTO_STACK_MAX+1] |
Decode a packet header.
This function is the opposite of fr_proto_encode_t.
The "decode" function is ONLY for decoding data. It should be aware of the protocol (e.g. RADIUS), but it MUST NOT know anything about the underlying network transport (e.g. UDP), and it MUST NOT know anything about how the data will be used.
[out] | proto_ctx | populated with information learned from the packet header. |
[in] | data | the raw packet data. |
[in] | data_len | the length of the raw data. |
Encode a packet header.
This function is the opposite of fr_proto_decode_t.
The "encode" function is ONLY for encoding data. It should be aware of the protocol (e.g. RADIUS), but it MUST NOT know anything about the underlying network transport (e.g. UDP), and it MUST NOT know anything about how the data will be used (e.g. reject delay on Access-Reject)
[in] | proto_ctx | as created by fr_proto_decode_t. |
[out] | buffer | the buffer where the raw packet will be written. |
[in] | buffer_len | the length of the buffer. |
typedef int(* fr_proto_get_option_t) (fr_value_box_t *out, void const *proto_ctx, fr_proto_opt_group_t opt_group, int opt) |
typedef void(* fr_proto_invert_t) (void *proto_ctx) |
typedef int(* fr_proto_set_option_t) (void *proto_ctx, fr_proto_opt_group_t opt_group, int opt, fr_value_box_t *in) |
enum fr_proto_opt_app_t |
enum fr_proto_opt_group_t |
Option contexts.
Exported by the protocol library. Indicates which option contexts the library implements.
enum fr_proto_opt_l2_t |
enum fr_proto_opt_l3_t |
enum fr_proto_opt_l4_t |