]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Simplify field names
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Sun, 23 Feb 2020 21:12:55 +0000 (16:12 -0500)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Sun, 23 Feb 2020 21:12:55 +0000 (16:12 -0500)
Reorder struct definitions in order of use (first last)

src/lib/server/dl_module.c
src/modules/rlm_radius/rlm_radius.c
src/modules/rlm_radius/rlm_radius.h

index c3eff331b90ccbf67bcf2ad6b507dfe2b491756e..3f709c5d139d58b4d2faabcb62189184e7560124 100644 (file)
@@ -479,7 +479,6 @@ void *dl_module_instance_symbol(dl_module_inst_t const *dl_inst, char const *sym
 }
 
 /** 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,
index 613e5bf1d66157d84e72782cf05a6f2135cfea78..849d4d6e681a6bd45a2af33470b14b1a11fee04b 100644 (file)
@@ -391,7 +391,7 @@ static void mod_radius_signal(void *instance, void *thread, REQUEST *request, vo
 
        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);
 }
 
 
@@ -403,7 +403,7 @@ static rlm_rcode_t mod_radius_resume(void *instance, void *thread, REQUEST *requ
        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.
@@ -507,7 +507,7 @@ static rlm_rcode_t CC_HINT(nonnull) mod_process(void *instance, void *thread, RE
         *      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;
@@ -529,7 +529,7 @@ static int mod_thread_detach(fr_event_list_t *el, void *thread)
         *      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;
        }
 
@@ -553,20 +553,20 @@ static int mod_thread_instantiate(UNUSED CONF_SECTION const *cs, void *instance,
         *      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;
 }
@@ -585,7 +585,7 @@ static int mod_instantiate(void *instance, UNUSED CONF_SECTION *conf)
 {
        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;
 }
index 5f7b5ec31c4e74fe133255ba52cd81fd042a545b..03a2999ce4536800472f8e93a5953dc23b344a2f 100644 (file)
  */
 
 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.
@@ -94,14 +80,26 @@ struct rlm_radius_s {
        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
+};