25 #include <freeradius-devel/io/application.h>
26 #include <freeradius-devel/io/listen.h>
27 #include <freeradius-devel/io/schedule.h>
28 #include <freeradius-devel/radius/radius.h>
83 cf_log_err(ci,
"Please define 'namespace' in this virtual server");
88 if (!
inst->attr_packet_type) {
89 cf_log_err(ci,
"Failed to find 'Packet-Type' attribute");
104 inst->code = type_enum->
value->vb_uint32;
119 inst->io.app_io_instance = mi->
data;
132 request->dict =
inst->dict;
133 request->packet->code =
inst->code;
138 request->packet->socket.fd = -1;
139 request->packet->socket.inet.src_ipaddr.af = AF_INET;
140 request->packet->socket.inet.src_ipaddr.addr.v4.s_addr = htonl(INADDR_NONE);
141 request->packet->socket.inet.dst_ipaddr = request->packet->socket.inet.src_ipaddr;
143 request->reply->socket.inet.src_ipaddr = request->packet->socket.inet.src_ipaddr;
144 request->reply->socket.inet.dst_ipaddr = request->packet->socket.inet.src_ipaddr;
149 return inst->io.app_io->decode(
inst->io.app_io_instance, request,
data, data_len);
157 if (buffer_len < 2)
return -1;
159 buffer[0] = request->reply->code;
187 inst->io.app_instance = instance;
193 inst->max_packet_size,
inst->num_messages);
218 if (!
inst->io.submodule) {
219 cf_log_err(
conf,
"The load generator MUST have a 'transport = ...' set");
246 if (!
inst->max_packet_size &&
inst->io.app_io)
inst->max_packet_size =
inst->io.app_io->default_message_size;
248 if (!
inst->num_messages)
inst->num_messages = 256;
static int const char char buffer[256]
module_t common
Common fields to all loadable modules.
Public structure describing an I/O path for a protocol.
module_t common
Common fields provided by all modules.
Describes a new application (protocol)
#define CONF_PARSER_TERMINATOR
#define FR_INTEGER_BOUND_CHECK(_name, _var, _op, _bound)
#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
@ CONF_FLAG_REQUIRED
Error out if no matching CONF_PAIR is found, and no dflt value is set.
@ CONF_FLAG_NOT_EMPTY
CONF_PAIR is required to have a non zero length value.
#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
Defines a CONF_PAIR to C data type mapping.
Common header for all CONF_* types.
Configuration AVP similar to a fr_pair_t.
A section grouping multiple CONF_PAIR.
CONF_PAIR * cf_item_to_pair(CONF_ITEM const *ci)
Cast a CONF_ITEM to a CONF_PAIR.
char const * cf_pair_value(CONF_PAIR const *pair)
Return the value of a CONF_PAIR.
CONF_SECTION * cf_item_to_section(CONF_ITEM const *ci)
Cast a CONF_ITEM to a CONF_SECTION.
#define cf_log_err(_cf, _fmt,...)
fr_dict_attr_t const * fr_dict_attr_by_name(fr_dict_attr_err_t *err, fr_dict_attr_t const *parent, char const *attr))
Locate a fr_dict_attr_t by its name.
fr_dict_attr_t const * fr_dict_root(fr_dict_t const *dict)
Return the root attribute of a dictionary.
fr_value_box_t const * value
Enum value (what name maps to).
fr_dict_enum_value_t * fr_dict_enum_by_name(fr_dict_attr_t const *da, char const *name, ssize_t len)
Value of an enumerated attribute.
#define MODULE_MAGIC_INIT
Stop people using different module/library/server versions together.
fr_app_io_t fr_master_app_io
int fr_master_io_listen(fr_io_instance_t *inst, fr_schedule_t *sc, size_t default_message_size, size_t num_messages)
#define MODULE_INST_CTX(_mi)
Wrapper to create a module_inst_ctx_t as a compound literal.
module_instance_t * mi
Instance of the module being instantiated.
Temporary structure to hold arguments for instantiation calls.
static ssize_t mod_encode(UNUSED void const *instance, request_t *request, uint8_t *buffer, size_t buffer_len)
static int type_parse(TALLOC_CTX *ctx, void *out, UNUSED void *parent, CONF_ITEM *ci, conf_parser_t const *rule)
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.
static int transport_parse(TALLOC_CTX *ctx, void *out, void *parent, CONF_ITEM *ci, conf_parser_t const *rule)
static conf_parser_t const proto_load_config[]
How to parse a Load listen section.
static int mod_instantiate(module_inst_ctx_t const *mctx)
Instantiate the application.
static int mod_open(void *instance, fr_schedule_t *sc, UNUSED CONF_SECTION *conf)
Open listen sockets/connect to external event source.
Load master protocol handler.
static int instantiate(module_inst_ctx_t const *mctx)
CONF_SECTION * conf
Module's instance configuration.
void * data
Module's instance data.
module_instantiate_t instantiate
Callback to allow the module to register any per-instance resources like sockets and file handles.
module_t * exported
Public module structure.
static const uchar sc[16]
int module_instantiate(module_instance_t *instance)
Manually complete module setup by calling its instantiate function.
eap_aka_sim_process_conf_t * inst
fr_aka_sim_id_type_t type
#define talloc_get_type_abort_const
static size_t char ** out
fr_dict_t const * virtual_server_dict_by_child_ci(CONF_ITEM const *ci)
Return the namespace for a given virtual server specified by a CONF_ITEM within the virtual server.
int virtual_server_listen_transport_parse(TALLOC_CTX *ctx, void *out, void *parent, CONF_ITEM *ci, conf_parser_t const *rule)
Generic conf_parser_t func for loading drivers.