The FreeRADIUS server $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
Loading...
Searching...
No Matches
mod_action.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: 23fadd2f8d3b972c94873ec7d715b87774cf26c6 $
20 *
21 * @file unlang/mod_action.h
22 * @brief Unlang module actions
23 *
24 * @copyright 2024 The FreeRADIUS server project
25 */
26
27#ifdef __cplusplus
28extern "C" {
29#endif
30
31#include <freeradius-devel/server/rcode.h>
32#include <freeradius-devel/util/retry.h>
33
34#define MOD_PRIORITY(_x) ((_x) | 0x80)
35
36typedef enum {
37 MOD_ACTION_NOT_SET = 0, //!< default "not set by anything"
38 MOD_ACTION_RETRY = 1, //!< retry the instruction, MUST also set a retry config
39 MOD_ACTION_REJECT = 2, //!< change the rcode to REJECT, with unset priority
40 MOD_ACTION_RETURN = 3, //!< stop processing the section,
41 //!< and return the rcode with unset priority
42
47
48 /*
49 * If ubsan or the compiler complains
50 * about the missing enum values we'll
51 * need to add them here.
52 *
53 * Defining MOD_PRIORITY_MAX ensures the
54 * enum will always be large enough.
55 */
58
59#define MOD_PRIORITY_MIN MOD_PRIORITY_1
60#define MOD_ACTION_VALID(_x) ((((_x) >= 0) && ((_x) <= 3)) || (((_x) >= MOD_PRIORITY_MIN) && ((_x) <= MOD_PRIORITY_MAX)))
61#define MOD_ACTION_VALID_SET(_x) ((((_x) > 0) && ((_x) <= 3)) || (((_x) >= MOD_PRIORITY_MIN) && ((_x) <= MOD_PRIORITY_MAX)))
62
67
68#define DEFAULT_MOD_ACTIONS { .actions = {}, .retry = RETRY_INIT }
69#define MOD_ACTIONS_FAIL_TIMEOUT_RETURN { .actions = { [RLM_MODULE_FAIL] = MOD_ACTION_RETURN, [RLM_MODULE_TIMEOUT] = MOD_ACTION_RETURN,}, .retry = RETRY_INIT }
70
76extern const char *mod_action_name[MOD_PRIORITY_MAX + 1];
77
78#ifdef __cplusplus
79}
80#endif
unlang_mod_actions_t const mod_actions_preacct
Definition mod_action.c:62
const char * mod_action_name[MOD_PRIORITY_MAX+1]
Definition mod_action.c:113
unlang_mod_action_t
Definition mod_action.h:36
@ MOD_ACTION_NOT_SET
default "not set by anything"
Definition mod_action.h:37
@ MOD_PRIORITY_1
Definition mod_action.h:43
@ MOD_ACTION_RETURN
stop processing the section, and return the rcode with unset priority
Definition mod_action.h:40
@ MOD_PRIORITY_2
Definition mod_action.h:44
@ MOD_PRIORITY_3
Definition mod_action.h:45
@ MOD_ACTION_REJECT
change the rcode to REJECT, with unset priority
Definition mod_action.h:39
@ MOD_PRIORITY_MAX
Definition mod_action.h:56
@ MOD_ACTION_RETRY
retry the instruction, MUST also set a retry config
Definition mod_action.h:38
@ MOD_PRIORITY_4
Definition mod_action.h:46
unlang_mod_actions_t const mod_actions_authenticate
Definition mod_action.c:30
unlang_mod_actions_t const mod_actions_accounting
Definition mod_action.c:78
fr_retry_config_t retry
Definition mod_action.h:65
unlang_mod_actions_t const mod_actions_authorize
Definition mod_action.c:46
#define MOD_PRIORITY(_x)
Definition mod_action.h:34
unlang_mod_actions_t const mod_actions_postauth
Definition mod_action.c:93
@ RLM_MODULE_NUMCODES
How many valid return codes there are.
Definition rcode.h:53