72 RCSIDH(tmpl_h,
"$Id: 08919e8f543e7776b19edbb797a9d95b7c90105d $")
74 #include <freeradius-devel/xlat.h>
228 #define tmpl_request data.attribute.request
229 #define tmpl_list data.attribute.list
230 #define tmpl_da data.attribute.da
231 #define tmpl_unknown data.attribute.unknown.da
232 #define tmpl_unknown_name data.attribute.unknown.name
233 #define tmpl_num data.attribute.num
234 #define tmpl_tag data.attribute.tag
241 #define tmpl_xlat data.xlat
248 #define tmpl_data data.literal
249 #define tmpl_data_type data.literal.type
250 #define tmpl_data_length data.literal.data.length
251 #define tmpl_data_value data.literal.data
259 # define tmpl_preg data.preg
260 # define tmpl_iflag iflag
261 # define tmpl_mflag mflag
265 #ifndef WITH_VERIFY_PTR
266 # define VERIFY_TMPL(_x)
268 # define VERIFY_TMPL(_x) tmpl_verify(__FILE__, __LINE__, _x)
269 void tmpl_verify(
char const *file,
int line,
vp_tmpl_t const *vpt);
293 #define tmpl_initialiser_list(_request, _list)\
296 .len = sizeof("static"), \
297 .type = TMPL_TYPE_LIST, \
298 .quote = T_SINGLE_QUOTED_STRING, \
301 .request = _request, \
333 #define RADIUS_LIST_AND_CTX(_ctx, _head, _request, _ref, _list) \
335 REQUEST *_rctx = _request; \
336 if ((radius_request(&_rctx, _ref) < 0) || \
337 !(_head = radius_list(_rctx, _list)) || \
338 !(_ctx = radius_list_ctx(_rctx, _list))) {\
370 bool allow_unknown,
bool allow_undefined);
375 bool allow_unknown,
bool allow_undefined);
379 bool allow_unknown,
bool allow_undefined);
384 bool allow_unknown,
bool allow_undefined);
void tmpl_from_da(vp_tmpl_t *vpt, fr_dict_attr_t const *da, int8_t tag, int num, request_refs_t request, pair_lists_t list)
Initialise a vp_tmpl_t to search for, or create attributes.
ssize_t tmpl_expand(char const **out, char *buff, size_t outlen, REQUEST *request, vp_tmpl_t const *vpt, xlat_escape_t escape, void *escape_ctx)
Expand a vp_tmpl_t to a string writing the result to a buffer.
ssize_t tmpl_afrom_str(TALLOC_CTX *ctx, vp_tmpl_t **out, char const *name, size_t inlen, FR_TOKEN type, request_refs_t request_def, pair_lists_t list_def, bool do_escape)
Convert an arbitrary string into a vp_tmpl_t.
struct vp_tmpl_t vp_tmpl_t
A source or sink of value data.
REQUEST containing the outer layer of the EAP conversation.
RADIUS_PACKET * radius_packet(REQUEST *request, pair_lists_t list_name)
Resolve a list to the RADIUS_PACKET holding the HEAD pointer for a VALUE_PAIR list.
char const * name
Raw string used to create the template.
int tmpl_afrom_value_data(TALLOC_CTX *ctx, vp_tmpl_t **out, value_data_t *data, PW_TYPE type, fr_dict_attr_t const *enumv, bool steal)
Create a vp_tmpl_t from a value_data_t.
TALLOC_CTX * radius_list_ctx(REQUEST *request, pair_lists_t list_name)
Return the correct TALLOC_CTX to alloc VALUE_PAIR in, for a list.
VALUE_PAIR ** radius_list(REQUEST *request, pair_lists_t list)
Resolve attribute pair_lists_t value to an attribute list.
bool auto_converted
Attr-26.9.1 –> Cisco-AVPair.
Attributes sent in response to the forked Disconnect-Request.
Pre-parsed XLAT expansion.
Attributes to send in a forked CoA-Request.
ssize_t tmpl_from_attr_substr(vp_tmpl_t *vpt, char const *name, request_refs_t request_def, pair_lists_t list_def, bool allow_unknown, bool allow_undefined)
Parse a string into a TMPL_TYPE_ATTR_* or TMPL_TYPE_LIST type vp_tmpl_t.
ssize_t tmpl_afrom_attr_str(TALLOC_CTX *ctx, vp_tmpl_t **out, char const *name, request_refs_t request_def, pair_lists_t list_def, bool allow_unknown, bool allow_undefined)
Parse a string into a TMPL_TYPE_ATTR_* or TMPL_TYPE_LIST type vp_tmpl_t.
Values of the encryption flags.
A copy of attributes in the request list that may be modified in pre-proxy before proxying the reques...
tmpl_type
Types of vp_tmpl_t.
size_t(* xlat_escape_t)(REQUEST *request, char *out, size_t outlen, char const *in, void *arg)
pair_lists_t list
List to search or insert in.
Abstraction to allow iterating over different configurations of VALUE_PAIRs.
Attributes to send in a forked Disconnect-Request.
Attribute not found in the global dictionary.
Pre-parsed regular expression.
int tmpl_define_unknown_attr(vp_tmpl_t *vpt)
Add an unknown fr_dict_attr_t specified by a vp_tmpl_t to the main dictionary.
const FR_NAME_NUMBER request_refs[]
Map keywords to request_refs_t values.
VALUE_PAIR * tmpl_cursor_init(int *err, vp_cursor_t *cursor, REQUEST *request, vp_tmpl_t const *vpt)
Initialise a vp_cursor_t to the VALUE_PAIR specified by a vp_tmpl_t.
int tmpl_find_vp(VALUE_PAIR **out, REQUEST *request, vp_tmpl_t const *vpt)
Returns the first VP matching a vp_tmpl_t.
ssize_t tmpl_from_attr_str(vp_tmpl_t *vpt, char const *name, request_refs_t request_def, pair_lists_t list_def, bool allow_unknown, bool allow_undefined)
Parse a string into a TMPL_TYPE_ATTR_* or TMPL_TYPE_LIST type vp_tmpl_t.
Attributes sent in response to the forked CoA-Request.
Attributes in incoming or internally proxied request.
int radius_request(REQUEST **request, request_refs_t name)
Resolve a request_refs_t to a REQUEST.
int tmpl_find_or_add_vp(VALUE_PAIR **out, REQUEST *request, vp_tmpl_t const *vpt)
Returns the first VP matching a vp_tmpl_t, or if no VPs match, creates a new one. ...
Stores an attribute, a value and various bits of other data.
ssize_t tmpl_aexpand(TALLOC_CTX *ctx, char **out, REQUEST *request, vp_tmpl_t const *vpt, xlat_escape_t escape, void *escape_ctx)
Expand a template to a string, allocing a new buffer to hold the string.
#define FR_DICT_ATTR_SIZE
Maximum dictionary attribute size.
int num
For array references.
int tmpl_define_undefined_attr(vp_tmpl_t *vpt, PW_TYPE type, fr_dict_attr_flags_t const *flags)
Add an undefined fr_dict_attr_t specified by a vp_tmpl_t to the main dictionary.
tmpl_type_t type
What type of value tmpl refers to.
enum tmpl_type tmpl_type_t
Types of vp_tmpl_t.
size_t len
Length of the raw string used to create the template.
int tmpl_copy_vps(TALLOC_CTX *ctx, VALUE_PAIR **out, REQUEST *request, vp_tmpl_t const *vpt)
Copy pairs matching a vp_tmpl_t in the current REQUEST.
int tmpl_cast_to_vp(VALUE_PAIR **out, REQUEST *request, vp_tmpl_t const *vpt, fr_dict_attr_t const *cast)
Expand a vp_tmpl_t to a string, parse it as an attribute of type cast, create a VALUE_PAIR from the r...
vp_tmpl_t * tmpl_init(vp_tmpl_t *vpt, tmpl_type_t type, char const *name, ssize_t len, FR_TOKEN quote)
Initialise stack allocated vp_tmpl_t.
void tmpl_cast_in_place_str(vp_tmpl_t *vpt)
Convert vp_tmpl_t of type TMPL_TYPE_UNPARSED to TMPL_TYPE_DATA of type PW_TYPE_STRING.
Callout to an external script or program.
request_refs_t request
Request to search or insert in.
size_t radius_list_name(pair_lists_t *out, char const *name, pair_lists_t default_list)
Resolve attribute name to a pair_lists_t value.
Describes a TMPL_TYPE_ATTR, TMPL_TYPE_ATTR_UNDEFINED or TMPL_TYPE_LIST.
size_t tmpl_snprint(char *buffer, size_t bufsize, vp_tmpl_t const *vpt, fr_dict_attr_t const *values)
Print a vp_tmpl_t to a string.
Attributes to send in the response.
enum pair_lists pair_lists_t
fr_dict_attr_t const * da
Resolved dictionary attribute.
size_t radius_request_name(request_refs_t *out, char const *name, request_refs_t unknown)
Resolve attribute name to a request_refs_t value.
Attributes to store multiple rounds of challenges/responses.
Attributes that change the behaviour of modules.
FR_TOKEN quote
What type of quoting was around the raw string.
VALUE_PAIR * tmpl_cursor_next(vp_cursor_t *cursor, vp_tmpl_t const *vpt)
Returns the next VALUE_PAIR specified by vpt.
Attributes sent in response to the proxied request.
int tmpl_cast_in_place(vp_tmpl_t *vpt, PW_TYPE type, fr_dict_attr_t const *enumv)
Convert vp_tmpl_t of type TMPL_TYPE_UNPARSED or TMPL_TYPE_DATA to TMPL_TYPE_DATA of type specified...
union vp_tmpl_t::@11 data
ssize_t tmpl_afrom_attr_substr(TALLOC_CTX *ctx, vp_tmpl_t **out, char const *name, request_refs_t request_def, pair_lists_t list_def, bool allow_unknown, bool allow_undefined)
Parse a string into a TMPL_TYPE_ATTR_* or TMPL_TYPE_LIST type vp_tmpl_t.
A source or sink of value data.
enum requests request_refs_t
const FR_NAME_NUMBER tmpl_names[]
Map tmpl_type_t values to descriptive strings.
vp_tmpl_t * tmpl_alloc(TALLOC_CTX *ctx, tmpl_type_t type, char const *name, ssize_t len, FR_TOKEN quote)
Create a new heap allocated vp_tmpl_t.
int8_t tag
For tag references.
PW_TYPE
Internal data types used within libfreeradius.
struct pair_list PAIR_LIST