The FreeRADIUS server  $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
map_proc_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: 4b333bfdc02553d8ca059e3274c9fc091213d154 $
20  *
21  * @file src/lib/server/map_proc_priv.h
22  * @brief Private map process structures and functions.
23  *
24  * @author Arran Cudbard-Bell (a.cudbardb@freeradius.org)
25  */
26 #include <freeradius-devel/server/cf_util.h> /* Need CONF_* definitions */
27 #include <freeradius-devel/server/map_proc.h>
28 #include <freeradius-devel/server/modpriv.h>
29 #include <freeradius-devel/server/map_proc.h>
30 #include <freeradius-devel/util/debug.h>
31 #include <freeradius-devel/util/value.h>
32 
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
36 
37 /** Map processor registration
38  */
39 struct map_proc {
40  fr_rb_node_t node; //!< Entry in the map processor tree.
41  void *mod_inst; //!< Module instance.
42  char name[FR_MAX_STRING_LEN]; //!< Name of the map function.
43  int length; //!< Length of name.
44 
45  map_proc_func_t evaluate; //!< Module's map processor function.
46  map_proc_instantiate_t instantiate; //!< Callback to create new instance struct.
47  size_t inst_size; //!< Size of map_proc instance data to allocate.
48  fr_value_box_safe_for_t literals_safe_for; //!< Safe for values to be set for literals in the map source.
49 };
50 
51 /** Map processor instance
52  */
53 struct map_proc_inst {
54  map_proc_t const *proc; //!< Map processor.
55  tmpl_t const *src; //!< Evaluated to provide source value for map processor.
56  map_list_t const *maps; //!< Head of the map list.
57  void *data; //!< Instance data created by #map_proc_instantiate
58 };
59 
60 #ifdef __cplusplus
61 }
62 #endif
unlang_action_t(* map_proc_func_t)(rlm_rcode_t *p_result, void *mod_inst, void *proc_inst, request_t *request, fr_value_box_list_t *result, map_list_t const *maps)
Function to evaluate the src string and map the result to server attributes.
Definition: map_proc.h:63
int(* map_proc_instantiate_t)(CONF_SECTION *cs, void *mod_inst, void *proc_inst, tmpl_t const *src, map_list_t const *maps)
Allocate new instance data for a map processor.
Definition: map_proc.h:77
char name[FR_MAX_STRING_LEN]
Name of the map function.
Definition: map_proc_priv.h:42
int length
Length of name.
Definition: map_proc_priv.h:43
fr_rb_node_t node
Entry in the map processor tree.
Definition: map_proc_priv.h:40
fr_value_box_safe_for_t literals_safe_for
Safe for values to be set for literals in the map source.
Definition: map_proc_priv.h:48
map_proc_t const * proc
Map processor.
Definition: map_proc_priv.h:54
tmpl_t const * src
Evaluated to provide source value for map processor.
Definition: map_proc_priv.h:55
size_t inst_size
Size of map_proc instance data to allocate.
Definition: map_proc_priv.h:47
map_proc_func_t evaluate
Module's map processor function.
Definition: map_proc_priv.h:45
void * data
Instance data created by map_proc_instantiate.
Definition: map_proc_priv.h:57
void * mod_inst
Module instance.
Definition: map_proc_priv.h:41
map_proc_instantiate_t instantiate
Callback to create new instance struct.
Definition: map_proc_priv.h:46
map_list_t const * maps
Head of the map list.
Definition: map_proc_priv.h:56
Map processor registration.
Definition: map_proc_priv.h:39
Map processor instance.
Definition: map_proc_priv.h:53
#define FR_MAX_STRING_LEN
Definition: value.h:30
uintptr_t fr_value_box_safe_for_t
Escaping that's been applied to a value box.
Definition: value.h:155