]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Invert arguments to set_process
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Fri, 16 Jun 2017 17:13:13 +0000 (13:13 -0400)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Fri, 16 Jun 2017 17:13:13 +0000 (13:13 -0400)
Put the full fr_app_t in the fr_listen_t (no point in hiding it)

src/lib/io/application.h
src/lib/io/listen.h
src/lib/io/worker.c
src/modules/proto_radius/proto_radius.c

index e60388d0414e835409f3ee3431ca633ac3265d1b..a1b4574436a0e8b28779af5a393bd6cf52cc548f 100644 (file)
@@ -39,9 +39,10 @@ typedef int (*fr_app_instantiate_t)(void *instance, CONF_SECTION *cs);
 typedef int (*fr_app_bootstrap_t)( void *instance, CONF_SECTION *cs);
 /** Set the next state executed by the request to be one of the application subtype's entry points
  *
+ * @param[in] instance of the #fr_app_t.
  * @param[in] request  To set the next state function for.
  */
-typedef void (*fr_app_set_process_t)(REQUEST *request, void const *uctx);
+typedef void (*fr_app_set_process_t)(void const *instance, REQUEST *request);
 
 /** Allows submodules to receive uctx data (a structure provided by their parent)
  *
index 0e9584f7a0c58c658b47e363183a59959a0a0b0b..4477e53e10f8af4f7644f609d3c7d7a081b5c019 100644 (file)
@@ -27,11 +27,11 @@ struct fr_listen {
        fr_app_io_t const       *app_io;                //!< I/O path functions.
        void                    *app_io_instance;       //!< I/O path specific context.
 
+       fr_app_t const          *app;
+       void const              *app_instance;
+
        fr_io_decode_t          decode;                 //!< Function to decode packet to request (worker)
        fr_io_encode_t          encode;                 //!< Function to encode request to packet (worker)
-
-       fr_app_set_process_t    set_process;            //!< Set the state machine entry point for a request.
-       void const              *app_ctx;
 };
 
 /**
index eb98096d4e19cac4157e69fae64cc3f5a4d7e727..6784df6f8716b8e51a6016730abf4b5bc58b53cc 100644 (file)
@@ -710,7 +710,7 @@ nak:
         *      Call the main protocol handlr to set the right async
         *      process function.
         */
-       listen->set_process(request, listen->app_ctx);
+       listen->app->set_process(listen->app_instance, request);
 
        rad_assert(request->async->process != NULL);
 
index 3f892e0d88d68fdf00e1594f1722dae2744b3136..03b4e670fdaae26590db32f0a164ee75325b1e2f 100644 (file)
@@ -209,7 +209,7 @@ static ssize_t mod_encode(UNUSED void const *io_ctx, REQUEST *request,
        return len;
 }
 
-static void mod_set_process(REQUEST *request, void const *instance)
+static void mod_set_process(void const *instance, REQUEST *request)
 {
        proto_radius_ctx_t const *inst = talloc_get_type_abort(instance, proto_radius_ctx_t);
        fr_app_process_t const *process;
@@ -263,8 +263,8 @@ static int mod_open(void *instance, fr_schedule_t *sc, CONF_SECTION *conf)
        listen->app_io = inst->app_io;
        listen->app_io_instance = inst->io_submodule->inst;
 
-       listen->set_process = mod_set_process;
-       listen->app_ctx = instance;
+       listen->app = &proto_radius;
+       listen->app_instance = instance;
        listen->encode = mod_encode;
        listen->decode = mod_decode;