}
/** Load a module and parse its #CONF_SECTION in one operation
- *
*
* When this instance is no longer needed, it should be freed with talloc_free().
* When all instances of a particular module are unloaded, the dl handle will be closed,
if (!inst->io->signal) return;
- inst->io->signal(request, inst->io_instance, t->thread_io_ctx, rctx, action);
+ inst->io->signal(request, inst->io_instance, t->io_thread, rctx, action);
}
rlm_radius_t const *inst = talloc_get_type_abort_const(instance, rlm_radius_t);
rlm_radius_thread_t *t = talloc_get_type_abort(thread, rlm_radius_thread_t);
- return inst->io->resume(request, inst->io_instance, t->thread_io_ctx, ctx);
+ return inst->io->resume(request, inst->io_instance, t->io_thread, ctx);
}
/** Do any RADIUS-layer fixups for proxying.
* return another code which indicates what happened to
* the request...b
*/
- rcode = inst->io->push(inst->io_instance, request, request_io_ctx, t->thread_io_ctx);
+ rcode = inst->io->push(inst->io_instance, request, request_io_ctx, t->io_thread);
if (rcode != RLM_MODULE_YIELD) {
talloc_free(request_io_ctx);
return rcode;
* connections.
*/
if (inst->io->thread_detach &&
- (inst->io->thread_detach(el, t->thread_io_ctx) < 0)) {
+ (inst->io->thread_detach(el, t->io_thread) < 0)) {
return -1;
}
* Allocate thread-specific data. The connections should
* live here.
*/
- t->thread_io_ctx = talloc_zero_array(t, uint8_t, inst->io->thread_inst_size);
- if (!t->thread_io_ctx) return -1;
+ t->io_thread = talloc_zero_array(t, uint8_t, inst->io->thread_inst_size);
+ if (!t->io_thread) return -1;
/*
* Set the name of the IO modules thread instance.
*/
- if (inst->io->thread_inst_type) (void) talloc_set_name_const(t->thread_io_ctx, inst->io->thread_inst_type);
+ if (inst->io->thread_inst_type) (void) talloc_set_name_const(t->io_thread, inst->io->thread_inst_type);
/*
* Instantiate the per-thread data. This should open up
* sockets, set timers, etc.
*/
if (inst->io->thread_instantiate &&
- inst->io->thread_instantiate(inst->io_conf, inst->io_instance, el, t->thread_io_ctx) < 0) return -1;
+ inst->io->thread_instantiate(inst->io_conf, inst->io_instance, el, t->io_thread) < 0) return -1;
return 0;
}
{
rlm_radius_t *inst = talloc_get_type_abort(instance, rlm_radius_t);
- if (inst->io->instantiate(inst->io_instance, inst->io_conf) < 0) return -1;
+ if (inst->io->instantiate && inst->io->instantiate(inst->io_instance, inst->io_conf) < 0) return -1;
return 0;
}
*/
typedef struct rlm_radius_s rlm_radius_t;
+typedef struct rlm_radius_io_s rlm_radius_io_t;
-
-/** Push a REQUEST to an IO submodule
- *
- */
-typedef rlm_rcode_t (*rlm_radius_io_push_t)(void *instance, REQUEST *request, void *request_io_ctx, void *thread);
-typedef void (*rlm_radius_io_signal_t)(REQUEST *request, void *instance, void *thread, void *request_io_ctx, fr_state_signal_t action);
-typedef int (*rlm_radius_io_instantiate_t)(rlm_radius_t *inst, void *io_instance, CONF_SECTION *cs);
-
-
-/** Public structure describing an I/O path for an outgoing socket.
+/** Per-thread instance data
*
- * This structure is exported by client I/O modules e.g. rlm_radius_udp.
+ * Contains buffers and connection handles specific to the thread.
*/
typedef struct {
- DL_MODULE_COMMON; //!< Common fields to all loadable modules.
- FR_MODULE_COMMON;
- FR_MODULE_THREADED_COMMON;
-
- size_t request_inst_size; //!< size of the data per request
- char const *request_inst_type; //!< Talloc type of the request_inst.
+ rlm_radius_t const *inst; //!< Instance of the module.
+ fr_event_list_t *el; //!< This thread's event list.
- rlm_radius_io_push_t push; //!< push a REQUEST to an IO submodule
- rlm_radius_io_signal_t signal; //!< send a signal to an IO module
- fr_unlang_module_resume_t resume; //!< resume a request, and get rcode
-} rlm_radius_io_t;
+ void *io_thread; //!< thread context for the IO submodule
+} rlm_radius_thread_t;
/*
* Define a structure for our module configuration.
fr_trunk_conf_t trunk_conf; //!< trunk configuration
};
+/** Push a REQUEST to an IO submodule
+ *
+ */
+typedef rlm_rcode_t (*rlm_radius_io_push_t)(void *instance, REQUEST *request, void *request_io_ctx, void *thread);
+typedef void (*rlm_radius_io_signal_t)(REQUEST *request, void *instance, void *thread, void *request_io_ctx, fr_state_signal_t action);
+typedef int (*rlm_radius_io_instantiate_t)(rlm_radius_t *inst, void *io_instance, CONF_SECTION *cs);
-/** Per-thread instance data
+/** Public structure describing an I/O path for an outgoing socket.
*
- * Contains buffers and connection handles specific to the thread.
+ * This structure is exported by client I/O modules e.g. rlm_radius_udp.
*/
-typedef struct {
- rlm_radius_t const *inst; //!< Instance of the module.
- fr_event_list_t *el; //!< This thread's event list.
+struct rlm_radius_io_s {
+ DL_MODULE_COMMON; //!< Common fields to all loadable modules.
+ FR_MODULE_COMMON;
+ FR_MODULE_THREADED_COMMON;
- void *thread_io_ctx; //!< thread context for the IO submodule
-} rlm_radius_thread_t;
+ size_t request_inst_size; //!< size of the data per request
+ char const *request_inst_type; //!< Talloc type of the request_inst.
+
+ rlm_radius_io_push_t push; //!< push a REQUEST to an IO submodule
+ rlm_radius_io_signal_t signal; //!< send a signal to an IO module
+ fr_unlang_module_resume_t resume; //!< resume a request, and get rcode
+};