The FreeRADIUS server $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
Loading...
Searching...
No Matches
module_priv.h
Go to the documentation of this file.
1#pragma once
2/*
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2, or (at your option)
6 * any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software Foundation,
15 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 */
17
18/**
19 * $Id: 38c3aa94b815e6e61164f9e2d09456b7c3a3bf71 $
20 *
21 * @file unlang/module_priv.h
22 * @brief Declarations for the unlang module interface
23 *
24 * @copyright 2006-2019 The FreeRADIUS server project
25 */
26#include "unlang_priv.h"
27
28#ifdef __cplusplus
29extern "C" {
30#endif
31
32/** A call to a module method
33 *
34 */
35typedef struct {
36 unlang_t self; //!< Common fields in all #unlang_t tree nodes.
37 call_env_t const *call_env; //!< The per call parsed call environment.
38 module_method_call_t mmc; //!< Everything needed to call a module method.
40
41/** A module stack entry
42 *
43 * Represents a single module call on the unlang stack.
44 */
45typedef struct {
46 char const *previous_module; //!< old request->module
47 module_thread_instance_t *thread; //!< thread-local data for this module.
48 ///< Caching is necessary in the frame state
49 ///< structure because the #unlang_t tree is
50 ///< shared between all threads, so we can't
51 ///< cache thread-specific data in the #unlang_t.
52 call_env_result_t env_result; //!< Result of the previous call environment expansion.
53 void *env_data; //!< Expanded per call "call environment" tmpls.
54
55#ifndef NDEBUG
56 int unlang_indent; //!< Record what this was when we entered the module.
57#endif
58 /** @} */
59
60 /** @name Resumption and signalling
61 * @{
62 */
63 void *rctx; //!< for resume / signal
64 module_method_t resume; //!< resumption handler
65 unlang_module_signal_t signal; //!< for signal handlers
66 fr_signal_t sigmask; //!< Signals to block.
67
68 /** @} */
69
70 /** @name Retry handlers.
71 * @{
72 */
73 module_method_t retry_resume; //!< which stops retries on resume
74 unlang_module_retry_t retry_cb; //!< callback to run on timeout
75 void *timeout_rctx; //!< rctx data to pass to timeout callback
76 module_instance_t const *mi; //!< Module instance to pass to callbacks.
78
79 fr_timer_t *ev; //!< retry timer just for this module.
80 fr_retry_t retry; //!< retry timers, etc.
81
82 /** @} */
83
85
91
93{
94 return (unlang_t *)p;
95}
96
97#ifdef __cplusplus
98}
99#endif
#define UNCONST(_type, _ptr)
Remove const qualification from a pointer.
Definition build.h:167
call_env_result_t
Definition call_env.h:51
Structure containing both a talloc pool, a list of parsed call_env_pairs.
Definition call_env.h:252
fr_timer_t * ev
retry timer just for this module.
Definition module_priv.h:79
static unlang_t * unlang_module_to_generic(unlang_module_t *p)
Definition module_priv.h:92
static unlang_module_t * unlang_generic_to_module(unlang_t const *p)
Definition module_priv.h:86
module_instance_t const * mi
Module instance to pass to callbacks.
Definition module_priv.h:76
module_method_t resume
resumption handler
Definition module_priv.h:64
char const * previous_module
old request->module
Definition module_priv.h:46
fr_signal_t sigmask
Signals to block.
Definition module_priv.h:66
module_method_t retry_resume
which stops retries on resume
Definition module_priv.h:73
call_env_result_t env_result
Result of the previous call environment expansion.
Definition module_priv.h:52
module_method_call_t mmc
Everything needed to call a module method.
Definition module_priv.h:38
fr_retry_t retry
retry timers, etc.
Definition module_priv.h:80
void * env_data
Expanded per call "call environment" tmpls.
Definition module_priv.h:53
module_thread_instance_t * thread
thread-local data for this module.
Definition module_priv.h:47
unlang_t self
Common fields in all unlang_t tree nodes.
Definition module_priv.h:36
unlang_module_signal_t signal
for signal handlers
Definition module_priv.h:65
int unlang_indent
Record what this was when we entered the module.
Definition module_priv.h:56
void * timeout_rctx
rctx data to pass to timeout callback
Definition module_priv.h:75
void * rctx
for resume / signal
Definition module_priv.h:63
call_env_t const * call_env
The per call parsed call environment.
Definition module_priv.h:37
unlang_module_retry_t retry_cb
callback to run on timeout
Definition module_priv.h:74
A module stack entry.
Definition module_priv.h:45
A call to a module method.
Definition module_priv.h:35
The output of module_rlm_by_name_and_method.
Definition module_rlm.h:62
#define fr_assert(_expr)
Definition rad_assert.h:38
unlang_action_t(* module_method_t)(unlang_result_t *p_result, module_ctx_t const *mctx, request_t *request)
Module section callback.
Definition module.h:69
Module instance data.
Definition module.h:285
Per thread per instance data.
Definition module.h:367
fr_signal_t
Signals that can be generated/processed by request signal handlers.
Definition signal.h:38
#define talloc_get_type_abort_const
Definition talloc.h:287
A timer event.
Definition timer.c:84
void(* unlang_module_retry_t)(module_ctx_t const *mctx, request_t *request, fr_retry_t const *retry)
A callback when a retry happens.
Definition module.h:53
void(* unlang_module_signal_t)(module_ctx_t const *mctx, request_t *request, fr_signal_t action)
A callback when the request gets a fr_signal_t.
Definition module.h:81
Private interpreter structures and functions.
@ UNLANG_TYPE_MODULE
Module method.
Definition unlang_priv.h:47
unlang_type_t type
The specialisation of this node.
A node in a graph of unlang_op_t (s) that we execute.