The FreeRADIUS server  $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
Macros | Functions | Variables
proto_detail.c File Reference

Detail master protocol handler. More...

#include <freeradius-devel/io/application.h>
#include <freeradius-devel/io/listen.h>
#include <freeradius-devel/io/schedule.h>
#include <freeradius-devel/radius/radius.h>
#include <freeradius-devel/util/pair_legacy.h>
#include <freeradius-devel/server/dl_module.h>
#include <freeradius-devel/server/module.h>
#include <freeradius-devel/server/module_rlm.h>
#include "proto_detail.h"
+ Include dependency graph for proto_detail.c:

Go to the source code of this file.

Macros

#define MPRINT(x, ...)
 

Functions

static int mod_decode (void const *instance, request_t *request, uint8_t *const data, size_t data_len)
 Decode the packet, and set the request->process function. More...
 
static ssize_t mod_encode (UNUSED void const *instance, request_t *request, uint8_t *buffer, size_t buffer_len)
 
static int mod_instantiate (module_inst_ctx_t const *mctx)
 Instantiate the application. More...
 
static int mod_open (void *instance, fr_schedule_t *sc, CONF_SECTION *conf)
 Open listen sockets/connect to external event source. More...
 
static int mod_priority_set (void const *instance, UNUSED uint8_t const *buffer, UNUSED size_t buflen)
 
static int transport_parse (TALLOC_CTX *ctx, void *out, void *parent, CONF_ITEM *ci, conf_parser_t const *rule)
 
static int type_parse (TALLOC_CTX *ctx, void *out, UNUSED void *parent, CONF_ITEM *ci, conf_parser_t const *rule)
 
static int type_parse (UNUSED TALLOC_CTX *ctx, void *out, void *parent, CONF_ITEM *ci, UNUSED conf_parser_t const *rule)
 Translates the packet-type into a submodule name. More...
 

Variables

static fr_dict_attr_t const * attr_packet_dst_ip_address
 
static fr_dict_attr_t const * attr_packet_dst_port
 
static fr_dict_attr_t const * attr_packet_original_timestamp
 
static fr_dict_attr_t const * attr_packet_src_ip_address
 
static fr_dict_attr_t const * attr_packet_src_port
 
static fr_dict_attr_t const * attr_protocol
 
static fr_dict_t const * dict_freeradius
 
fr_app_t proto_detail
 
static conf_parser_t const proto_detail_config []
 How to parse a Detail listen section. More...
 
fr_dict_autoload_t proto_detail_dict []
 
fr_dict_attr_autoload_t proto_detail_dict_attr []
 

Detailed Description

Detail master protocol handler.

Id
20e537c678922e935c0282347211e73d2b094d02

Definition in file proto_detail.c.

Macro Definition Documentation

◆ MPRINT

#define MPRINT (   x,
  ... 
)

Definition at line 49 of file proto_detail.c.

Function Documentation

◆ mod_decode()

static int mod_decode ( void const *  instance,
request_t request,
uint8_t *const  data,
size_t  data_len 
)
static

Decode the packet, and set the request->process function.

Definition at line 217 of file proto_detail.c.

+ Here is the call graph for this function:

◆ mod_encode()

static ssize_t mod_encode ( UNUSED void const *  instance,
request_t request,
uint8_t buffer,
size_t  buffer_len 
)
static

Definition at line 404 of file proto_detail.c.

◆ mod_instantiate()

static int mod_instantiate ( module_inst_ctx_t const *  mctx)
static

Instantiate the application.

Instantiate I/O and type submodules.

Returns
  • 0 on success.
  • -1 on failure.

Definition at line 522 of file proto_detail.c.

+ Here is the call graph for this function:

◆ mod_open()

static int mod_open ( void *  instance,
fr_schedule_t sc,
CONF_SECTION conf 
)
static

Open listen sockets/connect to external event source.

Parameters
[in]instanceCtx data for this application.
[in]scto add our file descriptor to.
[in]confListen section parsed to give us instance.
Returns
  • 0 on success.
  • -1 on failure.

Definition at line 432 of file proto_detail.c.

+ Here is the call graph for this function:

◆ mod_priority_set()

static int mod_priority_set ( void const *  instance,
UNUSED uint8_t const *  buffer,
UNUSED size_t  buflen 
)
static

Definition at line 412 of file proto_detail.c.

◆ transport_parse()

static int transport_parse ( TALLOC_CTX *  ctx,
void *  out,
void *  parent,
CONF_ITEM ci,
conf_parser_t const *  rule 
)
static

Definition at line 154 of file proto_detail.c.

+ Here is the call graph for this function:

◆ type_parse() [1/2]

static int type_parse ( TALLOC_CTX *  ctx,
void *  out,
UNUSED void *  parent,
CONF_ITEM ci,
conf_parser_t const *  rule 
)
static

◆ type_parse() [2/2]

static int type_parse ( UNUSED TALLOC_CTX *  ctx,
void *  out,
void *  parent,
CONF_ITEM ci,
UNUSED conf_parser_t const *  rule 
)
static

Translates the packet-type into a submodule name.

Parameters
[in]ctxto allocate data in (instance of proto_detail).
[out]outWhere to write a module_instance_t containing the module handle and instance.
[in]parentBase structure address.
[in]ciCONF_PAIR specifying the name of the type module.
[in]ruleunused.
Returns
  • 0 on success.
  • -1 on failure.

Definition at line 118 of file proto_detail.c.

+ Here is the call graph for this function:

Variable Documentation

◆ attr_packet_dst_ip_address

fr_dict_attr_t const* attr_packet_dst_ip_address
static

Definition at line 88 of file proto_detail.c.

◆ attr_packet_dst_port

fr_dict_attr_t const* attr_packet_dst_port
static

Definition at line 89 of file proto_detail.c.

◆ attr_packet_original_timestamp

fr_dict_attr_t const* attr_packet_original_timestamp
static

Definition at line 90 of file proto_detail.c.

◆ attr_packet_src_ip_address

fr_dict_attr_t const* attr_packet_src_ip_address
static

Definition at line 91 of file proto_detail.c.

◆ attr_packet_src_port

fr_dict_attr_t const* attr_packet_src_port
static

Definition at line 92 of file proto_detail.c.

◆ attr_protocol

fr_dict_attr_t const* attr_protocol
static

Definition at line 93 of file proto_detail.c.

◆ dict_freeradius

fr_dict_t const* dict_freeradius
static

Definition at line 79 of file proto_detail.c.

◆ proto_detail

fr_app_t proto_detail
Initial value:
= {
.common = {
.name = "detail",
.inst_size = sizeof(proto_detail_t),
},
.open = mod_open,
.decode = mod_decode,
.encode = mod_encode,
.priority = mod_priority_set
}
#define MODULE_MAGIC_INIT
Stop people using different module/library/server versions together.
Definition: dl_module.h:63
static ssize_t mod_encode(UNUSED void const *instance, request_t *request, uint8_t *buffer, size_t buffer_len)
Definition: proto_detail.c:404
static int mod_open(void *instance, fr_schedule_t *sc, CONF_SECTION *conf)
Open listen sockets/connect to external event source.
Definition: proto_detail.c:432
static int mod_decode(void const *instance, request_t *request, uint8_t *const data, size_t data_len)
Decode the packet, and set the request->process function.
Definition: proto_detail.c:217
static int mod_priority_set(void const *instance, UNUSED uint8_t const *buffer, UNUSED size_t buflen)
Definition: proto_detail.c:412
static int mod_instantiate(module_inst_ctx_t const *mctx)
Instantiate the application.
Definition: proto_detail.c:522
static conf_parser_t const proto_detail_config[]
How to parse a Detail listen section.
Definition: proto_detail.c:55
static int instantiate(module_inst_ctx_t const *mctx)
Definition: rlm_rest.c:1302

Definition at line 568 of file proto_detail.c.

◆ proto_detail_config

conf_parser_t const proto_detail_config[]
static
Initial value:
= {
type), .func = type_parse },
{ FR_CONF_OFFSET_TYPE_FLAGS("transport", FR_TYPE_VOID, 0, proto_detail_t, io_submodule),
.func = transport_parse, .dflt = "file" },
{ FR_CONF_OFFSET("max_entry_size", proto_detail_t, max_packet_size) } ,
{ FR_CONF_OFFSET("max_packet_size", proto_detail_t, max_packet_size) } ,
{ FR_CONF_OFFSET("num_messages", proto_detail_t, num_messages) } ,
{ FR_CONF_OFFSET("exit_when_done", proto_detail_t, exit_when_done) },
{ FR_CONF_OFFSET("priority", proto_detail_t, priority) },
}
#define CONF_PARSER_TERMINATOR
Definition: cf_parse.h:627
#define FR_CONF_OFFSET(_name, _struct, _field)
conf_parser_t which parses a single CONF_PAIR, writing the result to a field in a struct
Definition: cf_parse.h:268
@ CONF_FLAG_REQUIRED
Error out if no matching CONF_PAIR is found, and no dflt value is set.
Definition: cf_parse.h:405
@ CONF_FLAG_NOT_EMPTY
CONF_PAIR is required to have a non zero length value.
Definition: cf_parse.h:420
#define FR_CONF_OFFSET_TYPE_FLAGS(_name, _type, _flags, _struct, _field)
conf_parser_t which parses a single CONF_PAIR, writing the result to a field in a struct
Definition: cf_parse.h:241
@ FR_TYPE_VOID
User data.
Definition: merged_model.c:127
static int type_parse(TALLOC_CTX *ctx, void *out, UNUSED void *parent, CONF_ITEM *ci, conf_parser_t const *rule)
static int transport_parse(TALLOC_CTX *ctx, void *out, void *parent, CONF_ITEM *ci, conf_parser_t const *rule)
Definition: proto_detail.c:154
fr_aka_sim_id_type_t type

How to parse a Detail listen section.

Definition at line 55 of file proto_detail.c.

◆ proto_detail_dict

fr_dict_autoload_t proto_detail_dict
Initial value:
= {
{ .out = &dict_freeradius, .proto = "freeradius" },
{ NULL }
}
static fr_dict_t const * dict_freeradius
Definition: proto_detail.c:79

Definition at line 82 of file proto_detail.c.

◆ proto_detail_dict_attr

fr_dict_attr_autoload_t proto_detail_dict_attr
Initial value:
= {
{ .out = &attr_packet_dst_ip_address, .name = "Net.Dst.IP", .type = FR_TYPE_COMBO_IP_ADDR, .dict = &dict_freeradius },
{ .out = &attr_packet_dst_port, .name = "Net.Dst.Port", .type = FR_TYPE_UINT16, .dict = &dict_freeradius },
{ .out = &attr_packet_original_timestamp, .name = "Packet-Original-Timestamp", .type = FR_TYPE_DATE, .dict = &dict_freeradius },
{ .out = &attr_packet_src_ip_address, .name = "Net.Src.IP", .type = FR_TYPE_COMBO_IP_ADDR, .dict = &dict_freeradius },
{ .out = &attr_packet_src_port, .name = "Net.Src.Port", .type = FR_TYPE_UINT16, .dict = &dict_freeradius },
{ .out = &attr_protocol, .name = "Protocol", .type = FR_TYPE_UINT32, .dict = &dict_freeradius },
{ NULL }
}
@ FR_TYPE_UINT16
16 Bit unsigned integer.
Definition: merged_model.c:98
@ FR_TYPE_DATE
Unix time stamp, always has value >2^31.
Definition: merged_model.c:111
@ FR_TYPE_UINT32
32 Bit unsigned integer.
Definition: merged_model.c:99
@ FR_TYPE_COMBO_IP_ADDR
IPv4 or IPv6 address depending on length.
Definition: merged_model.c:91
static fr_dict_attr_t const * attr_protocol
Definition: proto_detail.c:93
static fr_dict_attr_t const * attr_packet_src_port
Definition: proto_detail.c:92
static fr_dict_attr_t const * attr_packet_original_timestamp
Definition: proto_detail.c:90
static fr_dict_attr_t const * attr_packet_dst_ip_address
Definition: proto_detail.c:88
static fr_dict_attr_t const * attr_packet_src_ip_address
Definition: proto_detail.c:91
static fr_dict_attr_t const * attr_packet_dst_port
Definition: proto_detail.c:89

Definition at line 96 of file proto_detail.c.