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: 0b63546028142462f3f253ceb1a37f4dce240fb8 $
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  uint32_t proxy_state; //!< Unique ID (mostly) of this module.
60  uint32_t *types; //!< array of allowed packet types
61  uint32_t status_check; //!< code of status-check type
62  map_list_t status_check_map; //!< attributes for the status-server checks
63  uint32_t num_answers_to_alive; //!< How many status check responses we need to
64  ///< mark the connection as alive.
65 
68 
69  fr_trunk_conf_t trunk_conf; //!< trunk configuration
70 };
71 
72 /** Enqueue a request_t to an IO submodule
73  *
74  */
75 typedef unlang_action_t (*rlm_radius_io_enqueue_t)(rlm_rcode_t *p_result, void **rctx, void *instance, void *thread, request_t *request);
76 
77 /** Public structure describing an I/O path for an outgoing socket.
78  *
79  * This structure is exported by client I/O modules e.g. rlm_radius_udp.
80  */
82  module_t common; //!< Common fields to all loadable modules.
83  rlm_radius_io_enqueue_t enqueue; //!< Enqueue a request_t with an IO submodule.
84  unlang_module_signal_t signal; //!< Send a signal to an IO module.
85  module_method_t resume; //!< Resume a request, and get rcode.
86 };
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
rlm_rcode_t
Return codes indicating the result of the module call.
Definition: rcode.h:40
bool replicate
Ignore responses.
Definition: rlm_radius.h:51
uint32_t num_answers_to_alive
How many status check responses we need to.
Definition: rlm_radius.h:63
map_list_t status_check_map
attributes for the status-server checks
Definition: rlm_radius.h:62
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:83
uint32_t proxy_state
Unique ID (mostly) of this module.
Definition: rlm_radius.h:59
module_t common
Common fields to all loadable modules.
Definition: rlm_radius.h:82
fr_retry_config_t retry[FR_RADIUS_CODE_MAX]
Definition: rlm_radius.h:67
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:61
uint32_t * types
array of allowed packet types
Definition: rlm_radius.h:60
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:66
module_instance_t * io_submodule
Definition: rlm_radius.h:44
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:75
fr_trunk_conf_t trunk_conf
trunk configuration
Definition: rlm_radius.h:69
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:84
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:85
Public structure describing an I/O path for an outgoing socket.
Definition: rlm_radius.h:81
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:69
Per instance data.
Definition: module.h:169
Struct exported by a rlm_* module.
Definition: module.h:142
A time delta, a difference in time measured in nanoseconds.
Definition: time.h:80
Common configuration parameters for a trunk.
Definition: trunk.h:213
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:79