]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Add C structure for Python state object
authorNick Porter <nick@portercomputing.co.uk>
Wed, 16 Apr 2025 09:56:31 +0000 (10:56 +0100)
committerNick Porter <nick@portercomputing.co.uk>
Mon, 21 Apr 2025 11:30:20 +0000 (12:30 +0100)
src/modules/rlm_python/rlm_python.c

index f51108779ff5741a7f3c2dd5646b0ce1aadacc1e..cba7acfd3d09fd7cdb35a0de5d0159bc4de4b182 100644 (file)
@@ -109,6 +109,18 @@ typedef struct {
        PyObject                *state;         //!< Session state list.
 } py_freeradius_request_t;
 
+/** Wrapper around a python instance
+ *
+ * This is added to the FreeRADIUS module to allow us to
+ * get at the global and thread local instance data.
+ */
+typedef struct {
+       PyObject_HEAD                           //!< Common fields needed for every python object.
+       rlm_python_t const      *inst;          //!< Module instance.
+       rlm_python_thread_t     *t;             //!< Thread-specific python instance.
+       request_t               *request;       //!< Current request.
+} py_freeradius_state_t;
+
 static void                    *python_dlhandle;
 static PyThreadState           *global_interpreter;    //!< Our first interpreter.