*/
if (radclient->use_connected && !inst->app_io->connection_set) {
DEBUG("proto_%s - cannot use connected sockets as underlying 'transport = %s' does not support it.",
- inst->app_io->common.name, inst->transport);
+ inst->app_io->common.name, inst->submodule->dl_inst->module->common->name);
goto error;
}
/*
* Find and bootstrap the application IO handler.
*/
- inst->app_io = (fr_app_io_t const *) inst->submodule->module->common;
+ inst->app_io = (fr_app_io_t const *) inst->submodule->dl_inst->module->common;
- inst->app_io_conf = inst->submodule->conf;
- inst->app_io_instance = inst->submodule->data;
+ inst->app_io_conf = inst->submodule->dl_inst->conf;
+ inst->app_io_instance = inst->submodule->dl_inst->data;
/*
* If we're not tracking duplicates then we don't need a
}
}
- if (inst->app_io->common.bootstrap && (inst->app_io->common.bootstrap(MODULE_INST_CTX(inst->submodule)) < 0)) {
+ if (inst->app_io->common.bootstrap && (inst->app_io->common.bootstrap(MODULE_INST_CTX(inst->submodule->dl_inst)) < 0)) {
cf_log_err(inst->app_io_conf, "Bootstrap failed for proto_%s", inst->app_io->common.name);
return -1;
}
fr_assert(inst->app_io != NULL);
if (inst->app_io->common.instantiate &&
- (inst->app_io->common.instantiate(MODULE_INST_CTX(inst->submodule)) < 0)) {
+ (inst->app_io->common.instantiate(MODULE_INST_CTX(inst->submodule->dl_inst)) < 0)) {
cf_log_err(conf, "Instantiation failed for \"proto_%s\"", inst->app_io->common.name);
return -1;
}
CONF_SECTION *server_cs; //!< server CS for this listener
- dl_module_inst_t *submodule; //!< As provided by the transport_parse
+ module_instance_t *submodule; //!< As provided by the transport_parse
///< callback. Broken out into the
///< app_io_* fields below for convenience.
fr_app_t *app; //!< main protocol handler
CONF_SECTION *app_io_conf; //!< Easy access to the app_io's config section.
int ipproto; //!< IP proto by number
- char const *transport; //!< transport, typically name of IP proto
-
fr_trie_t const *networks; //!< trie of allowed networks
} fr_io_instance_t;
* work submodule. We leave that until later.
*/
if (inst->app_io->common.instantiate &&
- (inst->app_io->common.instantiate(MODULE_INST_CTX(inst->io_submodule)) < 0)) {
+ (inst->app_io->common.instantiate(MODULE_INST_CTX(inst->io_submodule->dl_inst)) < 0)) {
cf_log_err(conf, "Instantiation failed for \"%s\"", inst->app_io->common.name);
return -1;
}
parent_inst = cf_data_value(cf_data_find(inst->cs, dl_module_inst_t, "proto_arp"));
fr_assert(parent_inst);
- if (dl_module_instance(inst->cs, &inst->io_submodule,
+ if (dl_module_instance(inst->cs, &inst->io_submodule->dl_inst,
parent_inst,
DL_MODULE_TYPE_SUBMODULE, "ethernet", dl_module_inst_name_from_conf(inst->cs)) < 0) {
cf_log_perr(inst->cs, "Failed to load proto_arp_ethernet");
return -1;
}
- if (dl_module_conf_parse(inst->io_submodule, inst->cs) < 0) {
+ if (dl_module_conf_parse(inst->io_submodule->dl_inst, inst->cs) < 0) {
TALLOC_FREE(inst->io_submodule);
return -1;
}
/*
* Bootstrap the I/O module
*/
- inst->app_io = (fr_app_io_t const *) inst->io_submodule->module->common;
- inst->app_io_instance = inst->io_submodule->data;
+ inst->app_io = (fr_app_io_t const *) inst->io_submodule->dl_inst->module->common;
+ inst->app_io_instance = inst->io_submodule->dl_inst->data;
inst->app_io_conf = conf;
- if (inst->app_io->common.bootstrap && (inst->app_io->common.bootstrap(MODULE_INST_CTX(inst->io_submodule)) < 0)) {
+ if (inst->app_io->common.bootstrap && (inst->app_io->common.bootstrap(MODULE_INST_CTX(inst->io_submodule->dl_inst)) < 0)) {
cf_log_err(inst->app_io_conf, "Bootstrap failed for \"%s\"", inst->app_io->common.name);
return -1;
}
CONF_SECTION *server_cs; //!< server CS for this listener
CONF_SECTION *cs; //!< my configuration
- dl_module_inst_t *io_submodule; //!< As provided by the transport_parse
+ module_instance_t *io_submodule; //!< As provided by the transport_parse
///< callback. Broken out into the
///< app_io_* fields below for convenience.
fr_listen_t *listen; //!< The listener structure which describes
//!< the I/O path.
} proto_arp_t;
-
-
extern fr_app_t proto_bfd;
-static int transport_parse(TALLOC_CTX *ctx, void *out, UNUSED void *parent, CONF_ITEM *ci, conf_parser_t const *rule);
static int auth_type_parse(TALLOC_CTX *ctx, void *out, UNUSED void *parent, CONF_ITEM *ci, conf_parser_t const *rule);
/** How to parse a BFD listen section
*/
static conf_parser_t const proto_bfd_config[] = {
{ FR_CONF_OFFSET_TYPE_FLAGS("transport", FR_TYPE_VOID, 0, proto_bfd_t, io.submodule),
- .func = transport_parse },
+ .func = virtual_sever_listen_transport_parse },
CONF_PARSER_TERMINATOR
};
return fr_ipaddr_cmp(&a->ipaddr, &b->ipaddr);
}
-/** Wrapper around dl_instance
- *
- * @param[in] ctx to allocate data in (instance of proto_bfd).
- * @param[out] out Where to write a dl_module_inst_t containing the module handle and instance.
- * @param[in] parent Base structure address.
- * @param[in] ci #CONF_PAIR specifying the name of the type module.
- * @param[in] rule unused.
- * @return
- * - 0 on success.
- * - -1 on failure.
- */
-static int transport_parse(TALLOC_CTX *ctx, void *out, UNUSED void *parent, CONF_ITEM *ci, UNUSED conf_parser_t const *rule)
-{
- char const *name = cf_pair_value(cf_item_to_pair(ci));
- dl_module_inst_t *parent_inst;
- proto_bfd_t *inst;
- CONF_SECTION *listen_cs = cf_item_to_section(cf_parent(ci));
- CONF_SECTION *transport_cs;
- dl_module_inst_t *dl_mod_inst;
-
- transport_cs = cf_section_find(listen_cs, name, NULL);
-
- parent_inst = cf_data_value(cf_data_find(listen_cs, dl_module_inst_t, "proto_bfd"));
- fr_assert(parent_inst);
-
- /*
- * Set the allowed codes so that we can compile them as
- * necessary.
- */
- inst = talloc_get_type_abort(parent_inst->data, proto_bfd_t);
- inst->io.transport = name;
-
- /*
- * Allocate an empty section if one doesn't exist
- * this is so defaults get parsed.
- */
- if (!transport_cs) {
- transport_cs = cf_section_alloc(listen_cs, listen_cs, name, NULL);
- inst->io.app_io_conf = transport_cs;
- }
-
- if (dl_module_instance(ctx, &dl_mod_inst, parent_inst,
- DL_MODULE_TYPE_SUBMODULE, name, dl_module_inst_name_from_conf(transport_cs)) < 0) return -1;
- if (dl_module_conf_parse(dl_mod_inst, transport_cs) < 0) {
- talloc_free(dl_mod_inst);
- return -1;
- }
- *((dl_module_inst_t **)out) = dl_mod_inst;
-
- return 0;
-}
-
/** Parse auth_type
*
* @param[in] ctx to allocate data in (instance of proto_bfd).
#include "proto_control.h"
extern fr_app_t proto_control;
-static int transport_parse(TALLOC_CTX *ctx, void *out, UNUSED void *parent, CONF_ITEM *ci, conf_parser_t const *rule);
static conf_parser_t const limit_config[] = {
{ FR_CONF_OFFSET("idle_timeout", proto_control_t, io.idle_timeout), .dflt = "30.0" } ,
*/
static conf_parser_t const proto_control_config[] = {
{ FR_CONF_OFFSET_TYPE_FLAGS("transport", FR_TYPE_VOID, 0, proto_control_t, io.submodule),
- .func = transport_parse },
+ .func = virtual_sever_listen_transport_parse },
{ FR_CONF_POINTER("limit", 0, CONF_FLAG_SUBSECTION, NULL), .subcs = (void const *) limit_config },
CONF_PARSER_TERMINATOR
{ NULL }
};
-/** Wrapper around dl_instance
- *
- * @param[in] ctx to allocate data in (instance of proto_control).
- * @param[out] out Where to write a dl_module_inst_t containing the module handle and instance.
- * @param[in] parent Base structure address.
- * @param[in] ci #CONF_PAIR specifying the name of the type module.
- * @param[in] rule unused.
- * @return
- * - 0 on success.
- * - -1 on failure.
- */
-static int transport_parse(TALLOC_CTX *ctx, void *out, UNUSED void *parent, CONF_ITEM *ci, UNUSED conf_parser_t const *rule)
-{
- char const *name = cf_pair_value(cf_item_to_pair(ci));
- dl_module_inst_t *parent_inst;
- proto_control_t *inst;
- CONF_SECTION *listen_cs = cf_item_to_section(cf_parent(ci));
- CONF_SECTION *transport_cs;
- dl_module_inst_t *dl_mod_inst;
-
- transport_cs = cf_section_find(listen_cs, name, NULL);
-
- /*
- * Allocate an empty section if one doesn't exist
- * this is so defaults get parsed.
- */
- if (!transport_cs) transport_cs = cf_section_alloc(listen_cs, listen_cs, name, NULL);
-
- parent_inst = cf_data_value(cf_data_find(listen_cs, dl_module_inst_t, "proto_control"));
- fr_assert(parent_inst);
-
- /*
- * Set the allowed codes so that we can compile them as
- * necessary.
- */
- inst = talloc_get_type_abort(parent_inst->data, proto_control_t);
- inst->io.transport = name;
-
- if (dl_module_instance(ctx, &dl_mod_inst, parent_inst,
- DL_MODULE_TYPE_SUBMODULE, name, dl_module_inst_name_from_conf(transport_cs)) < 0) return -1;
- if (dl_module_conf_parse(dl_mod_inst, transport_cs) < 0) {
- talloc_free(dl_mod_inst);
- return -1;
- }
- *((dl_module_inst_t **)out) = dl_mod_inst;
-
- return 0;
-}
-
-
/** Open listen sockets/connect to external event source
*
* @param[in] instance Ctx data for this application.
extern fr_app_t proto_cron;
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, UNUSED void *parent, CONF_ITEM *ci, conf_parser_t const *rule);
/** How to parse a Load listen section
*
{ FR_CONF_OFFSET_TYPE_FLAGS("type", FR_TYPE_VOID, CONF_FLAG_NOT_EMPTY | CONF_FLAG_REQUIRED, proto_cron_t,
type), .func = type_parse },
{ FR_CONF_OFFSET_TYPE_FLAGS("transport", FR_TYPE_VOID, 0, proto_cron_t, io.submodule),
- .func = transport_parse, .dflt = "crontab" },
+ .func = virtual_sever_listen_transport_parse, .dflt = "crontab" },
/*
* Add this as a synonym so normal humans can understand it.
return 0;
}
-/** Wrapper around dl_instance
- *
- * @param[in] ctx to allocate data in (instance of proto_cron).
- * @param[out] out Where to write a dl_module_inst_t containing the module handle and instance.
- * @param[in] parent Base structure address.
- * @param[in] ci #CONF_PAIR specifying the name of the type module.
- * @param[in] rule unused.
- * @return
- * - 0 on success.
- * - -1 on failure.
- */
-static int transport_parse(TALLOC_CTX *ctx, void *out, UNUSED void *parent,
- CONF_ITEM *ci, UNUSED conf_parser_t const *rule)
-{
- char const *name = cf_pair_value(cf_item_to_pair(ci));
- dl_module_inst_t *parent_inst;
- CONF_SECTION *listen_cs = cf_item_to_section(cf_parent(ci));
- CONF_SECTION *transport_cs;
- dl_module_inst_t *dl_mod_inst;
-
- transport_cs = cf_section_find(listen_cs, name, NULL);
-
- /*
- * Allocate an empty section if one doesn't exist
- * this is so defaults get parsed.
- */
- if (!transport_cs) transport_cs = cf_section_alloc(listen_cs, listen_cs, name, NULL);
-
- parent_inst = cf_data_value(cf_data_find(listen_cs, dl_module_inst_t, "proto_cron"));
- fr_assert(parent_inst);
-
- if (dl_module_instance(ctx, &dl_mod_inst, parent_inst,
- DL_MODULE_TYPE_SUBMODULE, name, dl_module_inst_name_from_conf(transport_cs)) < 0) return -1;
- if (dl_module_conf_parse(dl_mod_inst, transport_cs) < 0) {
- talloc_free(dl_mod_inst);
- return -1;
- }
- *((dl_module_inst_t **)out) = dl_mod_inst;
-
- return 0;
-}
-
/** Decode the packet, and set the request->process function
*
*/
extern fr_app_t proto_detail;
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, UNUSED void *parent, CONF_ITEM *ci, conf_parser_t const *rule);
#if 0
/*
{ FR_CONF_OFFSET_TYPE_FLAGS("type", FR_TYPE_VOID, CONF_FLAG_NOT_EMPTY | CONF_FLAG_REQUIRED, proto_detail_t,
type), .func = type_parse },
{ FR_CONF_OFFSET_TYPE_FLAGS("transport", FR_TYPE_VOID, 0, proto_detail_t, io_submodule),
- .func = transport_parse, .dflt = "file" },
+ .func = virtual_sever_listen_transport_parse, .dflt = "file" },
/*
* Add this as a synonym so normal humans can understand it.
return 0;
}
-/** Wrapper around dl_instance
- *
- * @param[in] ctx to allocate data in (instance of proto_detail).
- * @param[out] out Where to write a dl_module_inst_t containing the module handle and instance.
- * @param[in] parent Base structure address.
- * @param[in] ci #CONF_PAIR specifying the name of the type module.
- * @param[in] rule unused.
- * @return
- * - 0 on success.
- * - -1 on failure.
- */
-static int transport_parse(TALLOC_CTX *ctx, void *out, UNUSED void *parent,
- CONF_ITEM *ci, UNUSED conf_parser_t const *rule)
-{
- char const *name = cf_pair_value(cf_item_to_pair(ci));
- dl_module_inst_t *parent_inst;
- CONF_SECTION *listen_cs = cf_item_to_section(cf_parent(ci));
- CONF_SECTION *transport_cs;
- dl_module_inst_t *dl_mod_inst;
-
- transport_cs = cf_section_find(listen_cs, name, NULL);
-
- /*
- * Allocate an empty section if one doesn't exist
- * this is so defaults get parsed.
- */
- if (!transport_cs) transport_cs = cf_section_alloc(listen_cs, listen_cs, name, NULL);
-
- parent_inst = cf_data_value(cf_data_find(listen_cs, dl_module_inst_t, "proto_detail"));
- fr_assert(parent_inst);
-
- if (dl_module_instance(ctx, &dl_mod_inst, parent_inst,
- DL_MODULE_TYPE_SUBMODULE, name, dl_module_inst_name_from_conf(transport_cs)) < 0) return -1;
- if (dl_module_conf_parse(dl_mod_inst, transport_cs) < 0) {
- talloc_free(dl_mod_inst);
- return -1;
- }
- *((dl_module_inst_t **)out) = dl_mod_inst;
-
- return 0;
-}
-
/** Decode the packet, and set the request->process function
*
*/
* Testing: allow it to read a "detail.work" file
* directly.
*/
- if (strcmp(inst->io_submodule->module->dl->name, "proto_detail_work") == 0) {
+ if (strcmp(inst->io_submodule->dl_inst->module->dl->name, "proto_detail_work") == 0) {
if (!fr_schedule_listen_add(sc, li)) {
talloc_free(li);
return -1;
* work submodule. We leave that until later.
*/
if (inst->app_io->common.instantiate &&
- (inst->app_io->common.instantiate(MODULE_INST_CTX(inst->io_submodule)) < 0)) {
+ (inst->app_io->common.instantiate(MODULE_INST_CTX(inst->io_submodule->dl_inst)) < 0)) {
cf_log_err(conf, "Instantiation failed for \"%s\"", inst->app_io->common.name);
return -1;
}
/*
* If the IO is "file" and not the worker, instantiate the worker now.
*/
- if (strcmp(inst->io_submodule->module->dl->name, "proto_detail_work") != 0) {
+ if (strcmp(inst->io_submodule->dl_inst->module->dl->name, "proto_detail_work") != 0) {
if (inst->work_io->common.instantiate &&
(inst->work_io->common.instantiate(MODULE_INST_CTX(inst->work_submodule)) < 0)) {
cf_log_err(inst->work_io_conf, "Instantiation failed for \"%s\"", inst->work_io->common.name);
/*
* Bootstrap the I/O module
*/
- inst->app_io = (fr_app_io_t const *) inst->io_submodule->module->common;
- inst->app_io_instance = inst->io_submodule->data;
- inst->app_io_conf = inst->io_submodule->conf;
+ inst->app_io = (fr_app_io_t const *) inst->io_submodule->dl_inst->module->common;
+ inst->app_io_instance = inst->io_submodule->dl_inst->data;
+ inst->app_io_conf = inst->io_submodule->dl_inst->conf;
- if (inst->app_io->common.bootstrap && (inst->app_io->common.bootstrap(MODULE_INST_CTX(inst->io_submodule)) < 0)) {
+ if (inst->app_io->common.bootstrap && (inst->app_io->common.bootstrap(MODULE_INST_CTX(inst->io_submodule->dl_inst)) < 0)) {
cf_log_err(inst->app_io_conf, "Bootstrap failed for \"%s\"", inst->app_io->common.name);
return -1;
}
/*
* If we're not loading the work submodule directly, then try to load it here.
*/
- if (strcmp(inst->io_submodule->module->dl->name, "proto_detail_work") != 0) {
+ if (strcmp(inst->io_submodule->dl_inst->module->dl->name, "proto_detail_work") != 0) {
CONF_SECTION *transport_cs;
dl_module_inst_t *parent_inst;
fr_app_t *self; //!< child / parent linking issues
char const *type; //!< packet type name
- dl_module_inst_t *io_submodule; //!< As provided by the transport_parse
+ module_instance_t *io_submodule; //!< As provided by the transport_parse
///< callback. Broken out into the
///< app_io_* fields below for convenience.
extern fr_app_t proto_dhcpv4;
static int type_parse(TALLOC_CTX *ctx, void *out, void *parent, CONF_ITEM *ci, conf_parser_t const *rule);
-static int transport_parse(TALLOC_CTX *ctx, void *out, UNUSED void *parent, CONF_ITEM *ci, conf_parser_t const *rule);
static const conf_parser_t priority_config[] = {
{ FR_CONF_OFFSET("Discover", proto_dhcpv4_t, priorities[FR_DHCP_DISCOVER]),
*/
static conf_parser_t const proto_dhcpv4_config[] = {
{ FR_CONF_OFFSET_FLAGS("type", CONF_FLAG_NOT_EMPTY, proto_dhcpv4_t, allowed_types), .func = type_parse },
- { FR_CONF_OFFSET_TYPE_FLAGS("transport", FR_TYPE_VOID, 0, proto_dhcpv4_t, io.submodule), .func = transport_parse },
+ { FR_CONF_OFFSET_TYPE_FLAGS("transport", FR_TYPE_VOID, 0, proto_dhcpv4_t, io.submodule),
+ .func = virtual_sever_listen_transport_parse },
{ FR_CONF_POINTER("limit", 0, CONF_FLAG_SUBSECTION, NULL), .subcs = (void const *) limit_config },
return 0;
}
-/** Wrapper around dl_instance
- *
- * @param[in] ctx to allocate data in (instance of proto_dhcpv4).
- * @param[out] out Where to write a dl_module_inst_t containing the module handle and instance.
- * @param[in] parent Base structure address.
- * @param[in] ci #CONF_PAIR specifying the name of the type module.
- * @param[in] rule unused.
- * @return
- * - 0 on success.
- * - -1 on failure.
- */
-static int transport_parse(TALLOC_CTX *ctx, void *out, UNUSED void *parent,
- CONF_ITEM *ci, UNUSED conf_parser_t const *rule)
-{
- char const *name = cf_pair_value(cf_item_to_pair(ci));
- dl_module_inst_t *parent_inst;
- proto_dhcpv4_t *inst;
- CONF_SECTION *listen_cs = cf_item_to_section(cf_parent(ci));
- CONF_SECTION *transport_cs;
- dl_module_inst_t *dl_mod_inst;
-
- transport_cs = cf_section_find(listen_cs, name, NULL);
-
- /*
- * Allocate an empty section if one doesn't exist
- * this is so defaults get parsed.
- */
- if (!transport_cs) transport_cs = cf_section_alloc(listen_cs, listen_cs, name, NULL);
-
- parent_inst = cf_data_value(cf_data_find(listen_cs, dl_module_inst_t, "proto_dhcpv4"));
- fr_assert(parent_inst);
-
- /*
- * Set the allowed codes so that we can compile them as
- * necessary.
- */
- inst = talloc_get_type_abort(parent_inst->data, proto_dhcpv4_t);
- inst->io.transport = name;
-
- if (dl_module_instance(ctx, &dl_mod_inst, parent_inst,
- DL_MODULE_TYPE_SUBMODULE, name, dl_module_inst_name_from_conf(transport_cs)) < 0) return -1;
- if (dl_module_conf_parse(dl_mod_inst, transport_cs) < 0) {
- talloc_free(dl_mod_inst);
- return -1;
- }
- *((dl_module_inst_t **)out) = dl_mod_inst;
-
- return 0;
-}
-
/** Decode the packet
*
*/
extern fr_app_t proto_dhcpv6;
static int type_parse(TALLOC_CTX *ctx, void *out, void *parent, CONF_ITEM *ci, conf_parser_t const *rule);
-static int transport_parse(TALLOC_CTX *ctx, void *out, UNUSED void *parent, CONF_ITEM *ci, conf_parser_t const *rule);
static const conf_parser_t priority_config[] = {
{ FR_CONF_OFFSET("Solicit", proto_dhcpv6_t, priorities[FR_DHCPV6_SOLICIT]),
*/
static conf_parser_t const proto_dhcpv6_config[] = {
{ FR_CONF_OFFSET_FLAGS("type", CONF_FLAG_NOT_EMPTY, proto_dhcpv6_t, allowed_types), .func = type_parse },
- { FR_CONF_OFFSET_TYPE_FLAGS("transport", FR_TYPE_VOID, 0, proto_dhcpv6_t, io.submodule), .func = transport_parse },
+ { FR_CONF_OFFSET_TYPE_FLAGS("transport", FR_TYPE_VOID, 0, proto_dhcpv6_t, io.submodule),
+ .func = virtual_sever_listen_transport_parse },
{ FR_CONF_POINTER("limit", 0, CONF_FLAG_SUBSECTION, NULL), .subcs = (void const *) limit_config },
return 0;
}
-/** Wrapper around dl_instance
- *
- * @param[in] ctx to allocate data in (instance of proto_dhcpv6).
- * @param[out] out Where to write a dl_module_inst_t containing the module handle and instance.
- * @param[in] parent Base structure address.
- * @param[in] ci #CONF_PAIR specifying the name of the type module.
- * @param[in] rule unused.
- * @return
- * - 0 on success.
- * - -1 on failure.
- */
-static int transport_parse(TALLOC_CTX *ctx, void *out, UNUSED void *parent,
- CONF_ITEM *ci, UNUSED conf_parser_t const *rule)
-{
- char const *name = cf_pair_value(cf_item_to_pair(ci));
- dl_module_inst_t *parent_inst;
- proto_dhcpv6_t *inst;
- CONF_SECTION *listen_cs = cf_item_to_section(cf_parent(ci));
- CONF_SECTION *transport_cs;
- dl_module_inst_t *dl_mod_inst;
-
- transport_cs = cf_section_find(listen_cs, name, NULL);
-
- /*
- * Allocate an empty section if one doesn't exist
- * this is so defaults get parsed.
- */
- if (!transport_cs) transport_cs = cf_section_alloc(listen_cs, listen_cs, name, NULL);
-
- parent_inst = cf_data_value(cf_data_find(listen_cs, dl_module_inst_t, "proto_dhcpv6"));
- fr_assert(parent_inst);
-
- /*
- * Set the allowed codes so that we can compile them as
- * necessary.
- */
- inst = talloc_get_type_abort(parent_inst->data, proto_dhcpv6_t);
- inst->io.transport = name;
-
- if (dl_module_instance(ctx, &dl_mod_inst, parent_inst,
- DL_MODULE_TYPE_SUBMODULE, name, dl_module_inst_name_from_conf(transport_cs)) < 0) return -1;
- if (dl_module_conf_parse(dl_mod_inst, transport_cs) < 0) {
- talloc_free(dl_mod_inst);
- return -1;
- }
- *((dl_module_inst_t **)out) = dl_mod_inst;
-
- return 0;
-}
-
/** Decode the packet
*
*/
extern fr_app_t proto_dns;
static int type_parse(TALLOC_CTX *ctx, void *out, void *parent, CONF_ITEM *ci, conf_parser_t const *rule);
-static int transport_parse(TALLOC_CTX *ctx, void *out, UNUSED void *parent, CONF_ITEM *ci, conf_parser_t const *rule);
static const conf_parser_t priority_config[] = {
{ FR_CONF_OFFSET_TYPE_FLAGS("query", FR_TYPE_VOID, 0, proto_dns_t, priorities[FR_DNS_QUERY]),
static conf_parser_t const proto_dns_config[] = {
{ FR_CONF_OFFSET_FLAGS("type", CONF_FLAG_NOT_EMPTY, proto_dns_t, allowed_types), .func = type_parse },
{ FR_CONF_OFFSET_TYPE_FLAGS("transport", FR_TYPE_VOID, 0, proto_dns_t, io.submodule),
- .func = transport_parse },
+ .func = virtual_sever_listen_transport_parse },
{ FR_CONF_POINTER("limit", 0, CONF_FLAG_SUBSECTION, NULL), .subcs = (void const *) limit_config },
return 0;
}
-/** Wrapper around dl_instance
- *
- * @param[in] ctx to allocate data in (instance of proto_dns).
- * @param[out] out Where to write a dl_module_inst_t containing the module handle and instance.
- * @param[in] parent Base structure address.
- * @param[in] ci #CONF_PAIR specifying the name of the type module.
- * @param[in] rule unused.
- * @return
- * - 0 on success.
- * - -1 on failure.
- */
-static int transport_parse(TALLOC_CTX *ctx, void *out, UNUSED void *parent,
- CONF_ITEM *ci, UNUSED conf_parser_t const *rule)
-{
- char const *name = cf_pair_value(cf_item_to_pair(ci));
- dl_module_inst_t *parent_inst;
- proto_dns_t *inst;
- CONF_SECTION *listen_cs = cf_item_to_section(cf_parent(ci));
- CONF_SECTION *transport_cs;
- dl_module_inst_t *dl_mod_inst;
-
- transport_cs = cf_section_find(listen_cs, name, NULL);
-
- /*
- * Allocate an empty section if one doesn't exist
- * this is so defaults get parsed.
- */
- if (!transport_cs) transport_cs = cf_section_alloc(listen_cs, listen_cs, name, NULL);
-
- parent_inst = cf_data_value(cf_data_find(listen_cs, dl_module_inst_t, "proto_dns"));
- fr_assert(parent_inst);
-
- /*
- * Set the allowed codes so that we can compile them as
- * necessary.
- */
- inst = talloc_get_type_abort(parent_inst->data, proto_dns_t);
- inst->io.transport = name;
-
- if (dl_module_instance(ctx, &dl_mod_inst, parent_inst,
- DL_MODULE_TYPE_SUBMODULE, name, dl_module_inst_name_from_conf(transport_cs)) < 0) return -1;
- if (dl_module_conf_parse(dl_mod_inst, transport_cs) < 0) {
- talloc_free(dl_mod_inst);
- return -1;
- }
- *((dl_module_inst_t **)out) = dl_mod_inst;
-
- return 0;
-}
-
/** Decode the packet
*
*/
extern fr_app_t proto_ldap_sync;
-static int transport_parse(TALLOC_CTX *ctx, void *out, UNUSED void *parent, CONF_ITEM *ci, conf_parser_t const *rule);
-
static conf_parser_t const ldap_sync_search_config[] = {
{ FR_CONF_OFFSET("base_dn", sync_config_t, base_dn), .dflt = "", .quote = T_SINGLE_QUOTED_STRING },
static conf_parser_t const proto_ldap_sync_config[] = {
{ FR_CONF_OFFSET_TYPE_FLAGS("transport", FR_TYPE_VOID, 0, proto_ldap_sync_t, io_submodule),
- .func = transport_parse },
+ .func = virtual_sever_listen_transport_parse },
{ FR_CONF_OFFSET("max_packet_size", proto_ldap_sync_t, max_packet_size) },
{ FR_CONF_OFFSET("num_messages", proto_ldap_sync_t, num_messages) },
{ NULL }
};
-/** Wrapper around dl_instance
- *
- * @param[in] ctx to allocate data in (instance of proto_dns).
- * @param[out] out Where to write a dl_module_inst_t containing the module handle and instance.
- * @param[in] parent Base structure address.
- * @param[in] ci #CONF_PAIR specifying the name of the type module.
- * @param[in] rule unused.
- * @return
- * - 0 on success.
- * - -1 on failure.
- */
-static int transport_parse(TALLOC_CTX *ctx, void *out, UNUSED void *parent,
- CONF_ITEM *ci, UNUSED conf_parser_t const *rule)
-{
- char const *name = cf_pair_value(cf_item_to_pair(ci));
- dl_module_inst_t *parent_inst;
- CONF_SECTION *listen_cs = cf_item_to_section(cf_parent(ci));
- CONF_SECTION *transport_cs;
- dl_module_inst_t *dl_mod_inst;
-
- transport_cs = cf_section_find(listen_cs, name, NULL);
-
- /*
- * Allocate an empty section if one doesn't exist
- * this is so defaults get parsed.
- */
- if (!transport_cs) transport_cs = cf_section_alloc(listen_cs, listen_cs, name, NULL);
-
- parent_inst = cf_data_value(cf_data_find(listen_cs, dl_module_inst_t, "proto_ldap_sync"));
- fr_assert(parent_inst);
-
- if (dl_module_instance(ctx, &dl_mod_inst, parent_inst, DL_MODULE_TYPE_SUBMODULE, name,
- dl_module_inst_name_from_conf(transport_cs)) < 0) return -1;
- if (dl_module_conf_parse(dl_mod_inst, transport_cs) < 0) {
- talloc_free(dl_mod_inst);
- return -1;
- }
- *((dl_module_inst_t **)out) = dl_mod_inst;
- return 0;
-}
-
/** Check if an attribute is in the config list and add if not present
*
* @param[in,out] config to check for attribute.
* Instantiate the I/O module.
*/
if (inst->app_io->common.instantiate &&
- (inst->app_io->common.instantiate(MODULE_INST_CTX(inst->io_submodule)) < 0)) {
+ (inst->app_io->common.instantiate(MODULE_INST_CTX(inst->io_submodule->dl_inst)) < 0)) {
cf_log_err(conf, "Instantiation failed for \"%s\"", inst->app_io->common.name);
return -1;
}
/*
* Bootstrap the I/O module
*/
- inst->app_io = (fr_app_io_t const *) inst->io_submodule->module->common;
- inst->app_io_instance = inst->io_submodule->data;
- inst->app_io_conf = inst->io_submodule->conf;
+ inst->app_io = (fr_app_io_t const *) inst->io_submodule->dl_inst->module->common;
+ inst->app_io_instance = inst->io_submodule->dl_inst->data;
+ inst->app_io_conf = inst->io_submodule->dl_inst->conf;
if (inst->app_io->common.bootstrap &&
- (inst->app_io->common.bootstrap(MODULE_INST_CTX(inst->io_submodule)) < 0)) {
+ (inst->app_io->common.bootstrap(MODULE_INST_CTX(inst->io_submodule->dl_inst)) < 0)) {
cf_log_err(inst->app_io_conf, "Bootstrap failed for \"%s\"", inst->app_io->common.name);
return -1;
}
fr_app_t *self; //!< child / parent linking issues
- dl_module_inst_t *io_submodule; //!< As provided by the transport_parse
+ module_instance_t *io_submodule; //!< As provided by the transport_parse
//!< callback. Broken out into the
//!< app_io_* fields below for convenience.
extern fr_app_t proto_load;
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, UNUSED void *parent, CONF_ITEM *ci, conf_parser_t const *rule);
/** How to parse a Load listen section
*
{ FR_CONF_OFFSET_TYPE_FLAGS("type", FR_TYPE_VOID, CONF_FLAG_NOT_EMPTY | CONF_FLAG_REQUIRED, proto_load_t,
type), .func = type_parse },
{ FR_CONF_OFFSET_TYPE_FLAGS("transport", FR_TYPE_VOID, 0, proto_load_t, io.submodule),
- .func = transport_parse, .dflt = "step" },
+ .func = virtual_sever_listen_transport_parse, .dflt = "step" },
/*
* Add this as a synonym so normal humans can understand it.
return 0;
}
-/** Wrapper around dl_instance
- *
- * @param[in] ctx to allocate data in (instance of proto_load).
- * @param[out] out Where to write a dl_module_inst_t containing the module handle and instance.
- * @param[in] parent Base structure address.
- * @param[in] ci #CONF_PAIR specifying the name of the type module.
- * @param[in] rule unused.
- * @return
- * - 0 on success.
- * - -1 on failure.
- */
-static int transport_parse(TALLOC_CTX *ctx, void *out, UNUSED void *parent,
- CONF_ITEM *ci, UNUSED conf_parser_t const *rule)
-{
- char const *name = cf_pair_value(cf_item_to_pair(ci));
- dl_module_inst_t *parent_inst;
- CONF_SECTION *listen_cs = cf_item_to_section(cf_parent(ci));
- CONF_SECTION *transport_cs;
- dl_module_inst_t *dl_mod_inst;
-
- transport_cs = cf_section_find(listen_cs, name, NULL);
-
- /*
- * Allocate an empty section if one doesn't exist
- * this is so defaults get parsed.
- */
- if (!transport_cs) transport_cs = cf_section_alloc(listen_cs, listen_cs, name, NULL);
-
- parent_inst = cf_data_value(cf_data_find(listen_cs, dl_module_inst_t, "proto_load"));
- fr_assert(parent_inst);
-
- if (dl_module_instance(ctx, &dl_mod_inst, parent_inst,
- DL_MODULE_TYPE_SUBMODULE, name, dl_module_inst_name_from_conf(transport_cs)) < 0) return -1;
- if (dl_module_conf_parse(dl_mod_inst, transport_cs) < 0) {
- talloc_free(dl_mod_inst);
- return -1;
- }
- *((dl_module_inst_t **)out) = dl_mod_inst;
-
- return 0;
-}
-
/** Decode the packet, and set the request->process function
*
*/
extern fr_app_t proto_radius;
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, UNUSED void *parent, CONF_ITEM *ci, conf_parser_t const *rule);
static conf_parser_t const limit_config[] = {
{ FR_CONF_OFFSET("cleanup_delay", proto_radius_t, io.cleanup_delay), .dflt = "5.0" } ,
static conf_parser_t const proto_radius_config[] = {
{ FR_CONF_OFFSET_FLAGS("type", CONF_FLAG_NOT_EMPTY, proto_radius_t, allowed_types), .func = type_parse },
{ FR_CONF_OFFSET_TYPE_FLAGS("transport", FR_TYPE_VOID, 0, proto_radius_t, io.submodule),
- .func = transport_parse },
+ .func = virtual_sever_listen_transport_parse },
/*
* Check whether or not the *trailing* bits of a
return 0;
}
-/** Wrapper around dl_instance
- *
- * @param[in] ctx to allocate data in (instance of proto_radius).
- * @param[out] out Where to write a dl_module_inst_t containing the module handle and instance.
- * @param[in] parent Base structure address.
- * @param[in] ci #CONF_PAIR specifying the name of the type module.
- * @param[in] rule unused.
- * @return
- * - 0 on success.
- * - -1 on failure.
- */
-static int transport_parse(TALLOC_CTX *ctx, void *out, UNUSED void *parent, CONF_ITEM *ci, UNUSED conf_parser_t const *rule)
-{
- char const *name = cf_pair_value(cf_item_to_pair(ci));
- dl_module_inst_t *parent_inst;
- proto_radius_t *inst;
- CONF_SECTION *listen_cs = cf_item_to_section(cf_parent(ci));
- CONF_SECTION *transport_cs;
- dl_module_inst_t *dl_mod_inst;
-
- transport_cs = cf_section_find(listen_cs, name, NULL);
-
- parent_inst = cf_data_value(cf_data_find(listen_cs, dl_module_inst_t, "proto_radius"));
- fr_assert(parent_inst);
-
- /*
- * Set the allowed codes so that we can compile them as
- * necessary.
- */
- inst = talloc_get_type_abort(parent_inst->data, proto_radius_t);
- inst->io.transport = name;
-
- /*
- * Allocate an empty section if one doesn't exist
- * this is so defaults get parsed.
- */
- if (!transport_cs) {
- transport_cs = cf_section_alloc(listen_cs, listen_cs, name, NULL);
- inst->io.app_io_conf = transport_cs;
- }
-
- if (dl_module_instance(ctx, &dl_mod_inst, parent_inst,
- DL_MODULE_TYPE_SUBMODULE, name, dl_module_inst_name_from_conf(transport_cs)) < 0) return -1;
- if (dl_module_conf_parse(dl_mod_inst, transport_cs) < 0) {
- talloc_free(dl_mod_inst);
- return -1;
- }
- *((dl_module_inst_t **)out) = dl_mod_inst;
-
- return 0;
-}
-
/** Decode the packet
*
*/
extern fr_app_t proto_tacacs;
static int type_parse(TALLOC_CTX *ctx, void *out, void *parent, CONF_ITEM *ci, UNUSED conf_parser_t const *rule);
-static int transport_parse(TALLOC_CTX *ctx, void *out, UNUSED void *parent, CONF_ITEM *ci, conf_parser_t const *rule);
static conf_parser_t const limit_config[] = {
{ FR_CONF_OFFSET("idle_timeout", proto_tacacs_t, io.idle_timeout), .dflt = "30.0" } ,
static const conf_parser_t proto_tacacs_config[] = {
{ FR_CONF_OFFSET_FLAGS("type", CONF_FLAG_NOT_EMPTY, proto_tacacs_t, allowed_types), .func = type_parse },
- { FR_CONF_OFFSET_TYPE_FLAGS("transport", FR_TYPE_VOID, 0, proto_tacacs_t, io.submodule), .func = transport_parse },
+ { FR_CONF_OFFSET_TYPE_FLAGS("transport", FR_TYPE_VOID, 0, proto_tacacs_t, io.submodule), .func = virtual_sever_listen_transport_parse },
{ FR_CONF_POINTER("limit", 0, CONF_FLAG_SUBSECTION, NULL), .subcs = (void const *) limit_config },
{ FR_CONF_POINTER("priority", 0, CONF_FLAG_SUBSECTION, NULL), .subcs = (void const *) priority_config },
return 0;
}
-/** Wrapper around dl_instance
- *
- * @param[in] ctx to allocate data in (instance of proto_tacacs).
- * @param[out] out Where to write a dl_module_inst_t containing the module handle and instance.
- * @param[in] parent Base structure address.
- * @param[in] ci #CONF_PAIR specifying the name of the type module.
- * @param[in] rule unused.
- * @return
- * - 0 on success.
- * - -1 on failure.
- */
-static int transport_parse(TALLOC_CTX *ctx, void *out, UNUSED void *parent, CONF_ITEM *ci, UNUSED conf_parser_t const *rule)
-{
- char const *name = cf_pair_value(cf_item_to_pair(ci));
- dl_module_inst_t *parent_inst;
- proto_tacacs_t *inst;
- CONF_SECTION *listen_cs = cf_item_to_section(cf_parent(ci));
- CONF_SECTION *transport_cs;
- dl_module_inst_t *dl_mod_inst;
-
- transport_cs = cf_section_find(listen_cs, name, NULL);
-
- parent_inst = cf_data_value(cf_data_find(listen_cs, dl_module_inst_t, "proto_tacacs"));
- fr_assert(parent_inst);
-
- /*
- * Set the allowed codes so that we can compile them as
- * necessary.
- */
- inst = talloc_get_type_abort(parent_inst->data, proto_tacacs_t);
- inst->io.transport = name;
-
- /*
- * Allocate an empty section if one doesn't exist
- * this is so defaults get parsed.
- */
- if (!transport_cs) {
- transport_cs = cf_section_alloc(listen_cs, listen_cs, name, NULL);
- inst->io.app_io_conf = transport_cs;
- }
-
- if (dl_module_instance(ctx, &dl_mod_inst, parent_inst,
- DL_MODULE_TYPE_SUBMODULE, name, dl_module_inst_name_from_conf(transport_cs)) < 0) return -1;
- if (dl_module_conf_parse(dl_mod_inst, transport_cs) < 0) {
- talloc_free(dl_mod_inst);
- return -1;
- }
- *((dl_module_inst_t **)out) = dl_mod_inst;
-
- return 0;
-}
-
/** Decode the packet
*
*/
extern fr_app_t proto_vmps;
static int type_parse(TALLOC_CTX *ctx, void *out, void *parent,
CONF_ITEM *ci, conf_parser_t const *rule);
-static int transport_parse(TALLOC_CTX *ctx, void *out, UNUSED void *parent,
- CONF_ITEM *ci, conf_parser_t const *rule);
static const conf_parser_t priority_config[] = {
{ FR_CONF_OFFSET("Join-Request", proto_vmps_t, priorities[FR_PACKET_TYPE_VALUE_JOIN_REQUEST]),
*/
static conf_parser_t const proto_vmps_config[] = {
{ FR_CONF_OFFSET_FLAGS("type", CONF_FLAG_NOT_EMPTY, proto_vmps_t, allowed_types), .func = type_parse },
- { FR_CONF_OFFSET_TYPE_FLAGS("transport", FR_TYPE_VOID, 0, proto_vmps_t, io.submodule), .func = transport_parse },
+ { FR_CONF_OFFSET_TYPE_FLAGS("transport", FR_TYPE_VOID, 0, proto_vmps_t, io.submodule), .func = virtual_sever_listen_transport_parse },
{ FR_CONF_POINTER("limit", 0, CONF_FLAG_SUBSECTION, NULL), .subcs = (void const *) limit_config },
{ FR_CONF_POINTER("priority", 0, CONF_FLAG_SUBSECTION, NULL), .subcs = (void const *) priority_config },
return 0;
}
-/** Wrapper around dl_instance
- *
- * @param[in] ctx to allocate data in (instance of proto_vmps).
- * @param[out] out Where to write a dl_module_inst_t containing the module handle and instance.
- * @param[in] parent Base structure address.
- * @param[in] ci #CONF_PAIR specifying the name of the type module.
- * @param[in] rule unused.
- * @return
- * - 0 on success.
- * - -1 on failure.
- */
-static int transport_parse(TALLOC_CTX *ctx, void *out, UNUSED void *parent,
- CONF_ITEM *ci, UNUSED conf_parser_t const *rule)
-{
- char const *name = cf_pair_value(cf_item_to_pair(ci));
- dl_module_inst_t *parent_inst;
- proto_vmps_t *inst;
- CONF_SECTION *listen_cs = cf_item_to_section(cf_parent(ci));
- CONF_SECTION *transport_cs;
- dl_module_inst_t *dl_mod_inst;
-
- transport_cs = cf_section_find(listen_cs, name, NULL);
-
- /*
- * Allocate an empty section if one doesn't exist
- * this is so defaults get parsed.
- */
- if (!transport_cs) transport_cs = cf_section_alloc(listen_cs, listen_cs, name, NULL);
-
- parent_inst = cf_data_value(cf_data_find(listen_cs, dl_module_inst_t, "proto_vmps"));
- fr_assert(parent_inst);
-
- /*
- * Set the allowed codes so that we can compile them as
- * necessary.
- */
- inst = talloc_get_type_abort(parent_inst->data, proto_vmps_t);
- inst->io.transport = name;
-
- if (dl_module_instance(ctx, &dl_mod_inst, parent_inst,
- DL_MODULE_TYPE_SUBMODULE, name, dl_module_inst_name_from_conf(transport_cs)) < 0) return -1;
- if (dl_module_conf_parse(dl_mod_inst, transport_cs) < 0) {
- talloc_free(dl_mod_inst);
- return -1;
- }
- *((dl_module_inst_t **)out) = dl_mod_inst;
-
- return 0;
-}
-
/** Decode the packet
*
*/