The FreeRADIUS server  $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
rlm_radius.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 #include <freeradius-devel/io/atomic_queue.h>
18 #include <freeradius-devel/server/base.h>
19 #include <freeradius-devel/server/map.h>
20 #include <freeradius-devel/server/module_rlm.h>
21 #include <freeradius-devel/server/trunk.h>
22 #include <freeradius-devel/util/dlist.h>
23 #include <freeradius-devel/util/retry.h>
24 #include <freeradius-devel/unlang/module.h>
25 #include <freeradius-devel/radius/radius.h>
26 
27 /*
28  * $Id: 3ef8c8b87db7022880844b17e4be49dbb2d71016 $
29  *
30  * @file rlm_radius.h
31  * @brief Structures for the RADIUS client packets
32  *
33  * @copyright 2017 Alan DeKok (aland@freeradius.org)
34  */
35 
36 typedef struct rlm_radius_s rlm_radius_t;
37 typedef struct rlm_radius_io_s rlm_radius_io_t;
38 
39 /*
40  * Define a structure for our module configuration.
41  */
42 struct rlm_radius_s {
43  char const *name;
45  rlm_radius_io_t const *io; //!< Public symbol exported by the submodule.
46 
50 
51  bool replicate; //!< Ignore responses.
52  bool synchronous; //!< Retransmit when receiving a duplicate request.
53  bool originate; //!< Originating packets, instead of proxying existing ones.
54  ///< Controls whether Proxy-State is added to the outbound
55  ///< request.
56 
57  uint32_t max_attributes; //!< Maximum number of attributes to decode in response.
58 
59  fr_radius_require_ma_t require_message_authenticator; //!< Require Message-Authenticator in responses.
60  bool *received_message_authenticator; //!< Received Message-Authenticator in responses.
61 
62  uint32_t proxy_state; //!< Unique ID (mostly) of this module.
63  uint32_t *types; //!< array of allowed packet types
64  uint32_t status_check; //!< code of status-check type
65  map_list_t status_check_map; //!< attributes for the status-server checks
66  uint32_t num_answers_to_alive; //!< How many status check responses we need to
67  ///< mark the connection as alive.
68 
71 
72  trunk_conf_t trunk_conf; //!< trunk configuration
73 };
74 
75 /** Enqueue a request_t to an IO submodule
76  *
77  */
78 typedef unlang_action_t (*rlm_radius_io_enqueue_t)(rlm_rcode_t *p_result, void **rctx, void *instance, void *thread, request_t *request);
79 
80 /** Public structure describing an I/O path for an outgoing socket.
81  *
82  * This structure is exported by client I/O modules e.g. rlm_radius_udp.
83  */
85  module_t common; //!< Common fields to all loadable modules.
86  rlm_radius_io_enqueue_t enqueue; //!< Enqueue a request_t with an IO submodule.
87  unlang_module_signal_t signal; //!< Send a signal to an IO module.
88  module_method_t resume; //!< Resume a request, and get rcode.
89 };
unlang_action_t
Returned by unlang_op_t calls, determine the next action of the interpreter.
Definition: action.h:35
@ FR_RADIUS_CODE_MAX
Maximum possible protocol code.
Definition: defs.h:53
unsigned int uint32_t
Definition: merged_model.c:33
fr_radius_require_ma_t
Control whether Message-Authenticator is required in Access-Requests.
Definition: radius.h:62
rlm_rcode_t
Return codes indicating the result of the module call.
Definition: rcode.h:40
fr_radius_require_ma_t require_message_authenticator
Require Message-Authenticator in responses.
Definition: rlm_radius.h:59
bool replicate
Ignore responses.
Definition: rlm_radius.h:51
uint32_t num_answers_to_alive
How many status check responses we need to mark the connection as alive.
Definition: rlm_radius.h:66
map_list_t status_check_map
attributes for the status-server checks
Definition: rlm_radius.h:65
fr_time_delta_t revive_interval
Definition: rlm_radius.h:49
rlm_radius_io_enqueue_t enqueue
Enqueue a request_t with an IO submodule.
Definition: rlm_radius.h:86
uint32_t proxy_state
Unique ID (mostly) of this module.
Definition: rlm_radius.h:62
module_t common
Common fields to all loadable modules.
Definition: rlm_radius.h:85
fr_retry_config_t retry[FR_RADIUS_CODE_MAX]
Definition: rlm_radius.h:70
char const * name
Definition: rlm_radius.h:43
bool originate
Originating packets, instead of proxying existing ones.
Definition: rlm_radius.h:53
uint32_t status_check
code of status-check type
Definition: rlm_radius.h:64
bool * received_message_authenticator
Received Message-Authenticator in responses.
Definition: rlm_radius.h:60
uint32_t * types
array of allowed packet types
Definition: rlm_radius.h:63
fr_time_delta_t response_window
Definition: rlm_radius.h:47
uint32_t max_attributes
Maximum number of attributes to decode in response.
Definition: rlm_radius.h:57
bool allowed[FR_RADIUS_CODE_MAX]
Definition: rlm_radius.h:69
module_instance_t * io_submodule
Definition: rlm_radius.h:44
trunk_conf_t trunk_conf
trunk configuration
Definition: rlm_radius.h:72
unlang_action_t(* rlm_radius_io_enqueue_t)(rlm_rcode_t *p_result, void **rctx, void *instance, void *thread, request_t *request)
Enqueue a request_t to an IO submodule.
Definition: rlm_radius.h:78
rlm_radius_io_t const * io
Public symbol exported by the submodule.
Definition: rlm_radius.h:45
fr_time_delta_t zombie_period
Definition: rlm_radius.h:48
unlang_module_signal_t signal
Send a signal to an IO module.
Definition: rlm_radius.h:87
bool synchronous
Retransmit when receiving a duplicate request.
Definition: rlm_radius.h:52
module_method_t resume
Resume a request, and get rcode.
Definition: rlm_radius.h:88
Public structure describing an I/O path for an outgoing socket.
Definition: rlm_radius.h:84
unlang_action_t(* module_method_t)(rlm_rcode_t *p_result, module_ctx_t const *mctx, request_t *request)
Module section callback.
Definition: module.h:68
Module instance data.
Definition: module.h:265
Struct exported by a rlm_* module.
Definition: module.h:195
A time delta, a difference in time measured in nanoseconds.
Definition: time.h:80
Common configuration parameters for a trunk.
Definition: trunk.h:224
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:80