From: Arran Cudbard-Bell Date: Fri, 16 Jun 2017 17:13:13 +0000 (-0400) Subject: Invert arguments to set_process X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7e527fd57ddeddf3d19c0713b01e9b09cd998477;p=thirdparty%2Ffreeradius-server.git Invert arguments to set_process Put the full fr_app_t in the fr_listen_t (no point in hiding it) --- diff --git a/src/lib/io/application.h b/src/lib/io/application.h index e60388d0414..a1b4574436a 100644 --- a/src/lib/io/application.h +++ b/src/lib/io/application.h @@ -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) * diff --git a/src/lib/io/listen.h b/src/lib/io/listen.h index 0e9584f7a0c..4477e53e10f 100644 --- a/src/lib/io/listen.h +++ b/src/lib/io/listen.h @@ -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; }; /** diff --git a/src/lib/io/worker.c b/src/lib/io/worker.c index eb98096d4e1..6784df6f871 100644 --- a/src/lib/io/worker.c +++ b/src/lib/io/worker.c @@ -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); diff --git a/src/modules/proto_radius/proto_radius.c b/src/modules/proto_radius/proto_radius.c index 3f892e0d88d..03b4e670fda 100644 --- a/src/modules/proto_radius/proto_radius.c +++ b/src/modules/proto_radius/proto_radius.c @@ -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;