The FreeRADIUS server $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
Loading...
Searching...
No Matches
rcode.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 of the License, or
6 * (at your option) 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
15 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
16 */
17
18/**
19 * $Id: 74eed3d707af2d7844b432d5979fe876692db6a6 $
20 *
21 * @file lib/server/rcode.h
22 * @brief Return codes returned by modules and virtual server sections
23 *
24 * @copyright 2018 The FreeRADIUS server project
25 */
26RCSIDH(rcode_h, "$Id: 74eed3d707af2d7844b432d5979fe876692db6a6 $")
27
28#include <freeradius-devel/util/table.h>
29#include <freeradius-devel/unlang/action.h>
30
31#ifdef __cplusplus
32extern "C" {
33#endif
34
35/** Return codes indicating the result of the module call
36 *
37 * All module functions must return one of the codes listed below (apart from
38 * RLM_MODULE_NUMCODES, which is used to check for validity).
39 */
40typedef enum {
41 RLM_MODULE_REJECT = 0, //!< Immediately reject the request.
42 RLM_MODULE_FAIL, //!< Module failed, don't reply.
43 RLM_MODULE_OK, //!< The module is OK, continue.
44 RLM_MODULE_HANDLED, //!< The module handled the request, so stop.
45 RLM_MODULE_INVALID, //!< The module considers the request invalid.
46 RLM_MODULE_DISALLOW, //!< Reject the request (user is locked out).
47 RLM_MODULE_NOTFOUND, //!< User not found.
48 RLM_MODULE_NOOP, //!< Module succeeded without doing anything.
49 RLM_MODULE_UPDATED, //!< OK (pairs modified).
50 RLM_MODULE_NUMCODES, //!< How many valid return codes there are.
51 RLM_MODULE_NOT_SET, //!< Error resolving rcode (should not be
52 //!< returned by modules).
54
55#define RETURN_MODULE_REJECT do { *p_result = RLM_MODULE_REJECT; return UNLANG_ACTION_CALCULATE_RESULT; } while (0)
56#define RETURN_MODULE_FAIL do { *p_result = RLM_MODULE_FAIL; return UNLANG_ACTION_CALCULATE_RESULT; } while (0)
57#define RETURN_MODULE_OK do { *p_result = RLM_MODULE_OK; return UNLANG_ACTION_CALCULATE_RESULT; } while (0)
58#define RETURN_MODULE_HANDLED do { *p_result = RLM_MODULE_HANDLED; return UNLANG_ACTION_CALCULATE_RESULT; } while (0)
59#define RETURN_MODULE_INVALID do { *p_result = RLM_MODULE_INVALID; return UNLANG_ACTION_CALCULATE_RESULT; } while (0)
60#define RETURN_MODULE_DISALLOW do { *p_result = RLM_MODULE_DISALLOW; return UNLANG_ACTION_CALCULATE_RESULT; } while (0)
61#define RETURN_MODULE_NOTFOUND do { *p_result = RLM_MODULE_NOTFOUND; return UNLANG_ACTION_CALCULATE_RESULT; } while (0)
62#define RETURN_MODULE_NOOP do { *p_result = RLM_MODULE_NOOP; return UNLANG_ACTION_CALCULATE_RESULT; } while (0)
63#define RETURN_MODULE_UPDATED do { *p_result = RLM_MODULE_UPDATED; return UNLANG_ACTION_CALCULATE_RESULT; } while (0)
64#define RETURN_MODULE_RCODE(_rcode) do { *p_result = (_rcode); return UNLANG_ACTION_CALCULATE_RESULT; } while (0)
65
67extern size_t rcode_table_len;
68
69/** Rcodes that translate to a user configurable section failing overall
70 *
71 */
72#define RLM_MODULE_USER_SECTION_REJECT \
73 RLM_MODULE_REJECT: \
74 case RLM_MODULE_FAIL: \
75 case RLM_MODULE_INVALID: \
76 case RLM_MODULE_DISALLOW
77
78#ifdef __cplusplus
79}
80#endif
#define RCSIDH(h, id)
Definition build.h:484
size_t rcode_table_len
Definition rcode.c:46
fr_table_num_sorted_t const rcode_table[]
Definition rcode.c:35
rlm_rcode_t
Return codes indicating the result of the module call.
Definition rcode.h:40
@ RLM_MODULE_INVALID
The module considers the request invalid.
Definition rcode.h:45
@ RLM_MODULE_OK
The module is OK, continue.
Definition rcode.h:43
@ RLM_MODULE_FAIL
Module failed, don't reply.
Definition rcode.h:42
@ RLM_MODULE_DISALLOW
Reject the request (user is locked out).
Definition rcode.h:46
@ RLM_MODULE_REJECT
Immediately reject the request.
Definition rcode.h:41
@ RLM_MODULE_NOTFOUND
User not found.
Definition rcode.h:47
@ RLM_MODULE_UPDATED
OK (pairs modified).
Definition rcode.h:49
@ RLM_MODULE_NOT_SET
Error resolving rcode (should not be returned by modules).
Definition rcode.h:51
@ RLM_MODULE_NOOP
Module succeeded without doing anything.
Definition rcode.h:48
@ RLM_MODULE_NUMCODES
How many valid return codes there are.
Definition rcode.h:50
@ RLM_MODULE_HANDLED
The module handled the request, so stop.
Definition rcode.h:44
An element in a lexicographically sorted array of name to num mappings.
Definition table.h:49