All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Typedefs | Enumerations | Variables
tmpl.h File Reference

Structures and prototypes for templates. More...

#include <freeradius-devel/xlat.h>
+ Include dependency graph for tmpl.h:

Go to the source code of this file.

Data Structures

struct  pair_list
 
struct  value_pair_tmpl_attr_t
 Describes a TMPL_TYPE_ATTR, TMPL_TYPE_ATTR_UNDEFINED or TMPL_TYPE_LIST. More...
 
union  value_pair_tmpl_attr_t.unknown
 
struct  vp_tmpl_t
 A source or sink of value data. More...
 
union  vp_tmpl_t.data
 
struct  vp_tmpl_t.data.literal
 

Macros

Field accessors for #TMPL_TYPE_ATTR, #TMPL_TYPE_ATTR_UNDEFINED, #TMPL_TYPE_LIST
#define tmpl_request   data.attribute.request
 
#define tmpl_list   data.attribute.list
 
#define tmpl_da   data.attribute.da
 
#define tmpl_unknown   data.attribute.unknown.da
 
#define tmpl_unknown_name   data.attribute.unknown.name
 
#define tmpl_num   data.attribute.num
 
#define tmpl_tag   data.attribute.tag
 
Field accessors for #TMPL_TYPE_XLAT_STRUCT
#define tmpl_xlat   data.xlat
 
Field accessors for #TMPL_TYPE_DATA
#define tmpl_data   data.literal
 
#define tmpl_data_type   data.literal.type
 
#define tmpl_data_length   data.literal.data.length
 
#define tmpl_data_value   data.literal.data
 

Typedefs

typedef struct pair_list PAIR_LIST
 
typedef enum pair_lists pair_lists_t
 
typedef enum requests request_refs_t
 
typedef enum tmpl_type tmpl_type_t
 Types of vp_tmpl_t. More...
 
typedef struct vp_tmpl_t vp_tmpl_t
 A source or sink of value data. More...
 

Enumerations

enum  pair_lists {
  PAIR_LIST_UNKNOWN = 0,
  PAIR_LIST_REQUEST,
  PAIR_LIST_REPLY,
  PAIR_LIST_CONTROL,
  PAIR_LIST_STATE,
  PAIR_LIST_PROXY_REQUEST,
  PAIR_LIST_PROXY_REPLY,
  PAIR_LIST_COA,
  PAIR_LIST_COA_REPLY,
  PAIR_LIST_DM,
  PAIR_LIST_DM_REPLY
}
 
enum  requests {
  REQUEST_UNKNOWN = 0,
  REQUEST_OUTER,
  REQUEST_CURRENT,
  REQUEST_PARENT
}
 
enum  tmpl_type {
  TMPL_TYPE_UNKNOWN = 0,
  TMPL_TYPE_UNPARSED,
  TMPL_TYPE_XLAT,
  TMPL_TYPE_ATTR,
  TMPL_TYPE_ATTR_UNDEFINED,
  TMPL_TYPE_LIST,
  TMPL_TYPE_REGEX,
  TMPL_TYPE_EXEC,
  TMPL_TYPE_DATA,
  TMPL_TYPE_XLAT_STRUCT,
  TMPL_TYPE_REGEX_STRUCT,
  TMPL_TYPE_NULL
}
 Types of vp_tmpl_t. More...
 

Variables

const FR_NAME_NUMBER pair_lists []
 Map keywords to pair_lists_t values. More...
 
const FR_NAME_NUMBER request_refs []
 Map keywords to request_refs_t values. More...
 
const FR_NAME_NUMBER tmpl_names []
 Map tmpl_type_t values to descriptive strings. More...
 

Field accessors for #TMPL_TYPE_REGEX_STRUCT and #TMPL_TYPE_REGEX

#define VERIFY_TMPL(_x)
 
#define tmpl_initialiser_list(_request, _list)
 Produces an initialiser for static TMPL_TYPE_LIST type vp_tmpl_t. More...
 
#define RADIUS_LIST_AND_CTX(_ctx, _head, _request, _ref, _list)
 Determine the correct context and list head. More...
 
VALUE_PAIR ** radius_list (REQUEST *request, pair_lists_t list)
 Resolve attribute pair_lists_t value to an attribute list. More...
 
RADIUS_PACKETradius_packet (REQUEST *request, pair_lists_t list_name)
 Resolve a list to the RADIUS_PACKET holding the HEAD pointer for a VALUE_PAIR list. More...
 
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. More...
 
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. More...
 
int radius_request (REQUEST **request, request_refs_t name)
 Resolve a request_refs_t to a REQUEST. More...
 
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. More...
 
vp_tmpl_ttmpl_init (vp_tmpl_t *vpt, tmpl_type_t type, char const *name, ssize_t len, FR_TOKEN quote)
 Initialise stack allocated vp_tmpl_t. More...
 
vp_tmpl_ttmpl_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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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 result. More...
 
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. More...
 
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. More...
 
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. More...
 
VALUE_PAIRtmpl_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. More...
 
VALUE_PAIRtmpl_cursor_next (vp_cursor_t *cursor, vp_tmpl_t const *vpt)
 Returns the next VALUE_PAIR specified by vpt. More...
 
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. More...
 
int tmpl_find_vp (VALUE_PAIR **out, REQUEST *request, vp_tmpl_t const *vpt)
 Returns the first VP matching a vp_tmpl_t. More...
 
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. More...
 
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. More...
 
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. More...
 

Detailed Description

Structures and prototypes for templates.

Id:
08919e8f543e7776b19edbb797a9d95b7c90105d

These functions are used to work with vp_tmpl_t structs.

vp_tmpl_t (VPTs) specify either a data source, or a data sink.

Examples of sources are TMPL_TYPE_XLAT, TMPL_TYPE_EXEC and TMPL_TYPE_ATTR. Examples of sinks are TMPL_TYPE_ATTR, TMPL_TYPE_LIST.

VPTs are used to gather values or attributes for evaluation, or copying, and to specify where values or VALUE_PAIR should be copied to.

To create new vp_tmpl_t use one of the tmpl_*from_* functions. These parse strings into VPTs. The main parsing function is tmpl_afrom_str, which can produce most types of VPTs. It uses the type of quoting (passed as an FR_TOKEN) to determine what type of VPT to parse the string as. For example a T_DOUBLE_QUOTED_STRING will produce either a TMPL_TYPE_XLAT or a TMPL_TYPE_UNPARSED (depending if the string contained a non-literal expansion).

See Also
tmpl_afrom_str
tmpl_afrom_attr_str
tmpl_from_attr_str
tmpl_from_attr_substr

In the case of TMPL_TYPE_ATTR and TMPL_TYPE_LIST, there are special cursor overlay functions which can be used to iterate over only the VALUE_PAIR that match a vp_tmpl_t in a given list.

See Also
tmpl_cursor_init
tmpl_cursor_next

Or for simplicity, there are functions which wrap the cursor functions, to copy or return the VALUE_PAIR that match the VPT.

See Also
tmpl_copy_vps
tmpl_find_vp

If you just need the string value of whatever the VPT refers to, the tmpl_*expand functions may be used. These functions evaluate the VPT, execing, and xlat expanding as necessary. In the case of TMPL_TYPE_ATTR, and PW_TYPE_STRING or PW_TYPE_OCTETS tmpl_expand will return a pointer to the raw VALUE_PAIR buffer. This can be very useful when using the PW_TYPE_TMPL type in CONF_PARSER structs, as it allows the user to determine whether they want the module to sanitise the value using presentation format specific xlat_escape_t function, or to operate on the raw value.

See Also
tmpl_expand
tmpl_aexpand

Definition in file tmpl.h.


Data Structure Documentation

struct pair_list

Definition at line 119 of file tmpl.h.

+ Collaboration diagram for pair_list:
Data Fields
VALUE_PAIR * check
int lineno
char const * name
struct pair_list * next
VALUE_PAIR * reply
struct value_pair_tmpl_attr_t

Describes a TMPL_TYPE_ATTR, TMPL_TYPE_ATTR_UNDEFINED or TMPL_TYPE_LIST.

Definition at line 148 of file tmpl.h.

+ Collaboration diagram for value_pair_tmpl_attr_t:
Data Fields
fr_dict_attr_t const * da Resolved dictionary attribute.
pair_lists_t list List to search or insert in.
int num For array references.
request_refs_t request Request to search or insert in.
int8_t tag For tag references.
union value_pair_tmpl_attr_t unknown
union value_pair_tmpl_attr_t.unknown

Definition at line 153 of file tmpl.h.

Data Fields
uint8_t da[FR_DICT_ATTR_SIZE] Unknown dictionary attribute buffer.
char name[FR_DICT_ATTR_SIZE] Raw unknown dictionary name.
uint8_t vendor[FR_DICT_ATTR_SIZE] Unknown dictionary attribute buffer.
struct vp_tmpl_t

A source or sink of value data.

Is used as both the RHS and LHS of a map (both update, and conditional types)

Use in update vp_map_t

When used on the LHS it describes an attribute to create and should be one of these types:

When used on the RHS it describes the value to assign to the attribute being created and should be one of these types:

Use in conditional vp_map_t

When used as part of a condition it may be any of the RHS side types, as well as:

See Also
vp_map_t

Definition at line 187 of file tmpl.h.

Data Fields
bool auto_converted Attr-26.9.1 –> Cisco-AVPair.
union vp_tmpl_t data
size_t len Length of the raw string used to create the template.
char const * name Raw string used to create the template.
FR_TOKEN quote What type of quoting was around the raw string.
tmpl_type_t type What type of value tmpl refers to.
union vp_tmpl_t.data

Definition at line 201 of file tmpl.h.

Data Fields
value_pair_tmpl_attr_t attribute
data literal
xlat_exp_t * xlat pre-parsed xlat_exp_t
struct vp_tmpl_t.data.literal

Definition at line 211 of file tmpl.h.

Data Fields
value_data_t data Value data.
PW_TYPE type Type of data.

Macro Definition Documentation

#define RADIUS_LIST_AND_CTX (   _ctx,
  _head,
  _request,
  _ref,
  _list 
)
Value:
do {\
REQUEST *_rctx = _request; \
if ((radius_request(&_rctx, _ref) < 0) || \
!(_head = radius_list(_rctx, _list)) || \
!(_ctx = radius_list_ctx(_rctx, _list))) {\
_ctx = NULL; \
_head = NULL; \
}\
} while (0)
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.
Definition: tmpl.c:331
VALUE_PAIR ** radius_list(REQUEST *request, pair_lists_t list)
Resolve attribute pair_lists_t value to an attribute list.
Definition: tmpl.c:195
int radius_request(REQUEST **request, request_refs_t name)
Resolve a request_refs_t to a REQUEST.
Definition: tmpl.c:451
struct rad_request REQUEST
Definition: radiusd.h:34

Determine the correct context and list head.

Used in conjunction with the fr_cursor functions to determine the correct list and TALLOC_CTX for inserting VALUE_PAIRs.

Example:

TALLOC_CTX *ctx;
VALUE_PAIR **head;
RADIUS_LIST_AND_CTX(ctx, head, request, CURRENT_REQUEST, PAIR_LIST_REQUEST);
if (!list) return -1; // error
value.strvalue = talloc_strdup(NULL, "my new username");
value.length = talloc_array_length(value.strvalue) - 1;
if (fr_pair_update_by_num(ctx, head, PW_USERNAME, 0, TAG_ANY, PW_TYPE_STRING, &value) < 0) return -1; // error
Parameters
_ctxnew VALUE_PAIR s should be allocated in for the specified list.
_headof the VALUE_PAIR list.
_requestThe current request.
_refto resolve.
_listto resolve.

Definition at line 333 of file tmpl.h.

#define tmpl_da   data.attribute.da

Definition at line 230 of file tmpl.h.

#define tmpl_data   data.literal

Definition at line 248 of file tmpl.h.

#define tmpl_data_length   data.literal.data.length

Definition at line 250 of file tmpl.h.

#define tmpl_data_type   data.literal.type

Definition at line 249 of file tmpl.h.

#define tmpl_data_value   data.literal.data

Definition at line 251 of file tmpl.h.

#define tmpl_initialiser_list (   _request,
  _list 
)
Value:
{ \
.name = "static", \
.len = sizeof("static"), \
.type = TMPL_TYPE_LIST, \
.data = { \
.attribute = { \
.request = _request, \
.list = _list \
} \
} \
}
Attribute list.
Definition: tmpl.h:135
uint8_t data[]
Definition: eap_pwd.h:625

Produces an initialiser for static TMPL_TYPE_LIST type vp_tmpl_t.

Example:

static vp_tmpl_t list = tmpl_initialiser_list(CURRENT_REQUEST, PAIR_LIST_REQUEST);
vp_cursor_t cursor;
// Iterate over all pairs in the request list
for (vp = tmpl_cursor_init(NULL, &cursor, request, &list);
vp;
vp = tmpl_cursor_next(&cursor, &list)) {
// Do something
}
Parameters
_requestto locate the list in.
_listto set as the target for the template.
See Also
tmpl_cursor_init
tmpl_cursor_next

Definition at line 293 of file tmpl.h.

#define tmpl_list   data.attribute.list

Definition at line 229 of file tmpl.h.

#define tmpl_num   data.attribute.num

Definition at line 233 of file tmpl.h.

#define tmpl_request   data.attribute.request

Definition at line 228 of file tmpl.h.

#define tmpl_tag   data.attribute.tag

Definition at line 234 of file tmpl.h.

#define tmpl_unknown   data.attribute.unknown.da

Definition at line 231 of file tmpl.h.

#define tmpl_unknown_name   data.attribute.unknown.name

Definition at line 232 of file tmpl.h.

#define tmpl_xlat   data.xlat

Definition at line 241 of file tmpl.h.

#define VERIFY_TMPL (   _x)

Definition at line 266 of file tmpl.h.

Typedef Documentation

typedef struct pair_list PAIR_LIST
typedef enum pair_lists pair_lists_t
typedef enum requests request_refs_t
typedef enum tmpl_type tmpl_type_t

Types of vp_tmpl_t.

typedef struct vp_tmpl_t vp_tmpl_t

A source or sink of value data.

Is used as both the RHS and LHS of a map (both update, and conditional types)

Use in update vp_map_t

When used on the LHS it describes an attribute to create and should be one of these types:

When used on the RHS it describes the value to assign to the attribute being created and should be one of these types:

Use in conditional vp_map_t

When used as part of a condition it may be any of the RHS side types, as well as:

See Also
vp_map_t

Enumeration Type Documentation

enum pair_lists
Enumerator
PAIR_LIST_UNKNOWN 

Unknown list.

PAIR_LIST_REQUEST 

Attributes in incoming or internally proxied request.

PAIR_LIST_REPLY 

Attributes to send in the response.

PAIR_LIST_CONTROL 

Attributes that change the behaviour of modules.

PAIR_LIST_STATE 

Attributes to store multiple rounds of challenges/responses.

PAIR_LIST_PROXY_REQUEST 

A copy of attributes in the request list that may be modified in pre-proxy before proxying the request.

PAIR_LIST_PROXY_REPLY 

Attributes sent in response to the proxied request.

PAIR_LIST_COA 

Attributes to send in a forked CoA-Request.

PAIR_LIST_COA_REPLY 

Attributes sent in response to the forked CoA-Request.

PAIR_LIST_DM 

Attributes to send in a forked Disconnect-Request.

PAIR_LIST_DM_REPLY 

Attributes sent in response to the forked Disconnect-Request.

Definition at line 80 of file tmpl.h.

enum requests
Enumerator
REQUEST_UNKNOWN 

Unknown request.

REQUEST_OUTER 

REQUEST containing the outer layer of the EAP conversation.

Usually the RADIUS request sent by the NAS.

REQUEST_CURRENT 

The current request.

REQUEST_PARENT 

Not currently used.

Definition at line 108 of file tmpl.h.

enum tmpl_type

Types of vp_tmpl_t.

Enumerator
TMPL_TYPE_UNKNOWN 

Uninitialised.

TMPL_TYPE_UNPARSED 

Unparsed literal string.

TMPL_TYPE_XLAT 

XLAT expansion.

TMPL_TYPE_ATTR 

Dictionary attribute.

TMPL_TYPE_ATTR_UNDEFINED 

Attribute not found in the global dictionary.

TMPL_TYPE_LIST 

Attribute list.

TMPL_TYPE_REGEX 

Regular expression.

TMPL_TYPE_EXEC 

Callout to an external script or program.

TMPL_TYPE_DATA 

Value in native format.

TMPL_TYPE_XLAT_STRUCT 

Pre-parsed XLAT expansion.

TMPL_TYPE_REGEX_STRUCT 

Pre-parsed regular expression.

TMPL_TYPE_NULL 

Has no value.

Definition at line 129 of file tmpl.h.

Function Documentation

VALUE_PAIR** radius_list ( REQUEST request,
pair_lists_t  list 
)

Resolve attribute pair_lists_t value to an attribute list.

The value returned is a pointer to the pointer of the HEAD of a VALUE_PAIR list in the REQUEST. If the head of the list changes, the pointer will still be valid.

Parameters
[in]requestcontaining the target lists.
[in]listpair_lists_t value to resolve to VALUE_PAIR list. Will be NULL if list name couldn't be resolved.
Returns
a pointer to the HEAD of a list in the REQUEST.
See Also
tmpl_cursor_init
fr_cursor_init

Definition at line 195 of file tmpl.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

TALLOC_CTX* radius_list_ctx ( REQUEST request,
pair_lists_t  list 
)

Return the correct TALLOC_CTX to alloc VALUE_PAIR in, for a list.

Allocating new VALUE_PAIR in the context of a REQUEST is usually wrong. VALUE_PAIR should be allocated in the context of a RADIUS_PACKET, so that if the RADIUS_PACKET is freed before the REQUEST, the associated VALUE_PAIR lists are freed too.

Parameters
[in]requestcontaining the target lists.
[in]listpair_lists_t value to resolve to TALLOC_CTX.
Returns
  • TALLOC_CTX on success.
  • NULL on failure.
See Also
radius_list

Definition at line 331 of file tmpl.c.

+ Here is the caller graph for this function:

size_t radius_list_name ( pair_lists_t out,
char const *  name,
pair_lists_t  def 
)

Resolve attribute name to a pair_lists_t value.

Check the name string for pair_lists qualifiers and write a pair_lists_t value for that list to out. This value may be passed to radius_list, along with the current REQUEST, to get a pointer to the actual list in the REQUEST.

If we're sure we've definitely found a list qualifier token delimiter (:) but the string doesn't match a radius_list qualifier, return 0 and write PAIR_LIST_UNKNOWN to out.

If we can't find a string that looks like a request qualifier, set out to def, and return 0.

Note
radius_list_name should be called before passing a name string that may contain qualifiers to fr_dict_attr_by_name.
Parameters
[out]outWhere to write the list qualifier.
[in]nameString containing list qualifiers to parse.
[in]defthe list to return if no qualifiers were found.
Returns
0 if no valid list qualifier could be found, else the number of bytes consumed. The caller may then advanced the name pointer by the value returned, to get the start of the attribute name (if any).
See Also
pair_list
radius_list

Definition at line 120 of file tmpl.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

RADIUS_PACKET* radius_packet ( REQUEST request,
pair_lists_t  list 
)

Resolve a list to the RADIUS_PACKET holding the HEAD pointer for a VALUE_PAIR list.

Returns a pointer to the RADIUS_PACKET that holds the HEAD pointer of a given list, for the current REQUEST.

Parameters
[in]requestTo resolve list in.
[in]listpair_lists_t value to resolve to RADIUS_PACKET.
Returns
See Also
radius_list

Definition at line 279 of file tmpl.c.

+ Here is the caller graph for this function:

int radius_request ( REQUEST **  context,
request_refs_t  name 
)

Resolve a request_refs_t to a REQUEST.

Sometimes REQUEST structs may be chained to each other, as is the case when internally proxying EAP. This function resolves a request_refs_t to a REQUEST higher in the chain than the current REQUEST.

See Also
radius_list
Parameters
[in,out]contextREQUEST to start resolving from, and where to write a pointer to the resolved REQUEST back to.
[in]name(request) to resolve.
Returns
  • 0 if request is valid in this context.
  • -1 if request is not valid in this context.

Definition at line 451 of file tmpl.c.

+ Here is the caller graph for this function:

size_t radius_request_name ( request_refs_t out,
char const *  name,
request_refs_t  def 
)

Resolve attribute name to a request_refs_t value.

Check the name string for qualifiers that reference a parent REQUEST.

If we find a string that matches a request_refs qualifier, return the number of chars we consumed.

If we're sure we've definitely found a list qualifier token delimiter (*) but the qualifier doesn't match one of the request_refs qualifiers, return 0 and set out to REQUEST_UNKNOWN.

If we can't find a string that looks like a request qualifier, set out to def, and return 0.

Parameters
[out]outThe request_refs_t value the name resolved to (or REQUEST_UNKNOWN).
[in]nameof attribute.
[in]defdefault request ref to return if no request qualifier is present.
Returns
0 if no valid request qualifier could be found, else the number of bytes consumed. The caller may then advanced the name pointer by the value returned, to get the start of the attribute list or attribute name(if any).
See Also
radius_list_name
request_refs

Definition at line 413 of file tmpl.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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.

The intended use of tmpl_expand and tmpl_aexpand is for modules to easily convert a vp_tmpl_t provided by the conf parser, into a usable value. The value returned should be raw and undoctored for PW_TYPE_STRING and PW_TYPE_OCTETS types, and the printable (string) version of the data for all others.

This function will always duplicate values, whereas tmpl_expand may return a pointer to an existing buffer.

Note
This function is used where raw string values are needed, which may mean the string returned may be binary data or contain unprintable chars. fr_snprint or fr_asprint should be used before using these values in debug statements. is_printable can be used to check if the string only contains printable chars.
The type (char or uint8_t) can be obtained with talloc_get_type, and may be used as a hint as to how to process or print the data.
Parameters
ctxto allocate new buffer in.
outWhere to write pointer to the new buffer.
requestCurrent request.
vptto expand. Must be one of the following types:
escapexlat escape function (only used for xlat types).
escape_ctxxlat escape function data (only used for xlat types).
Returns
  • -1 on failure.
  • The length of data written to buff, or pointed to by out.

Definition at line 1653 of file tmpl.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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.

Note
Unlike tmpl_afrom_attr_substr this function will error out if the entire name string isn't parsed.
Parameters
[in,out]ctxto allocate vp_tmpl_t in.
[out]outWhere to write pointer to new vp_tmpl_t.
[in]nameof attribute including request_refs and pair_lists qualifiers. If only request_refs pair_lists qualifiers are found, a TMPL_TYPE_LIST vp_tmpl_t will be produced.
[in]request_defThe default REQUEST to set if no request_refs qualifiers are found in name.
[in]list_defThe default list to set if no pair_lists qualifiers are found in name.
[in]allow_unknownIf true attributes in the format accepted by fr_dict_unknown_from_suboid will be allowed, even if they're not in the main dictionaries. If an unknown attribute is found a TMPL_TYPE_ATTR vp_tmpl_t will be produced with the unknown fr_dict_attr_t stored in the unknown.da buffer. This fr_dict_attr_t will have its flags.is_unknown field set to true. If tmpl_from_attr_substr is being called on startup, the vp_tmpl_t may be passed to tmpl_define_unknown_attr to add the unknown attribute to the main dictionary. If the unknown attribute is not added to the main dictionary the vp_tmpl_t cannot be used to search for a VALUE_PAIR in a REQUEST.
[in]allow_undefinedIf true, we don't generate a parse error on unknown attributes. If an unknown attribute is found a TMPL_TYPE_ATTR_UNDEFINED vp_tmpl_t will be produced.
Returns
<= 0 on error (offset as negative integer), > 0 on success (number of bytes parsed).
See Also
REMARKER to produce pretty error markers from the return value.

Definition at line 956 of file tmpl.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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.

Parameters
[in,out]ctxto allocate vp_tmpl_t in.
[out]outWhere to write pointer to new vp_tmpl_t.
[in]nameof attribute including request_refs and pair_lists qualifiers. If only request_refs pair_lists qualifiers are found, a TMPL_TYPE_LIST vp_tmpl_t will be produced.
[in]request_defThe default REQUEST to set if no request_refs qualifiers are found in name.
[in]list_defThe default list to set if no pair_lists qualifiers are found in name.
[in]allow_unknownIf true attributes in the format accepted by fr_dict_unknown_from_suboid will be allowed, even if they're not in the main dictionaries. If an unknown attribute is found a TMPL_TYPE_ATTR vp_tmpl_t will be produced with the unknown fr_dict_attr_t stored in the unknown.da buffer. This fr_dict_attr_t will have its flags.is_unknown field set to true. If tmpl_from_attr_substr is being called on startup, the vp_tmpl_t may be passed to tmpl_define_unknown_attr to add the unknown attribute to the main dictionary. If the unknown attribute is not added to the main dictionary the vp_tmpl_t cannot be used to search for a VALUE_PAIR in a REQUEST.
[in]allow_undefinedIf true, we don't generate a parse error on unknown attributes. If an unknown attribute is found a TMPL_TYPE_ATTR_UNDEFINED vp_tmpl_t will be produced.
Returns
<= 0 on error (offset as negative integer), > 0 on success (number of bytes parsed).
See Also
REMARKER to produce pretty error markers from the return value.

Definition at line 926 of file tmpl.c.

+ Here is the call graph for this function:

ssize_t tmpl_afrom_str ( TALLOC_CTX *  ctx,
vp_tmpl_t **  out,
char const *  in,
size_t  inlen,
FR_TOKEN  type,
request_refs_t  request_def,
pair_lists_t  list_def,
bool  do_unescape 
)

Convert an arbitrary string into a vp_tmpl_t.

Note
Unlike tmpl_afrom_attr_str return code 0 doesn't necessarily indicate failure, may just mean a 0 length string was parsed.
xlats and regexes are left uncompiled. This is to support the two pass parsing done by the modcall code. Compilation on pass1 of that code could fail, as attributes or xlat functions registered by modules may not be available (yet).
For details of attribute parsing see tmpl_from_attr_substr.
Parameters
[in,out]ctxTo allocate vp_tmpl_t in.
[out]outWhere to write the pointer to the new vp_tmpl_t.
[in]inString to convert to a vp_tmpl_t.
[in]inlenlength of string to convert.
[in]typeof quoting around value. May be one of:
[in]request_defThe default REQUEST to set if no request_refs qualifiers are found in name.
[in]list_defThe default list to set if no pair_lists qualifiers are found in name.
[in]do_unescapewhether or not we should do unescaping. Should be false if the caller already did it.
Returns
<= 0 on error (offset as negative integer), > 0 on success (number of bytes parsed).
See Also
REMARKER to produce pretty error markers from the return value.
tmpl_from_attr_substr

Definition at line 1022 of file tmpl.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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.

Parameters
[in,out]ctxto allocate vp_tmpl_t in.
[out]outWhere to write pointer to new vp_tmpl_t.
[in]datato convert.
[in]typeof data.
[in]enumvUsed to convert integers to string types for printing. May be NULL.
[in]stealIf true, any buffers are moved to the new ctx instead of being duplicated.
Returns
  • 0 on success.
  • -1 on failure.

Definition at line 595 of file tmpl.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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.

Parameters
[in,out]ctxto allocate in.
[in]typeto set in the vp_tmpl_t.
[in]nameof the vp_tmpl_t (will be copied to a new talloc buffer parented by the vp_tmpl_t).
[in]lenThe length of the buffer (or a substring of the buffer) pointed to by name. If < 0 strlen will be used to determine the length.
[in]quoteThe type of quoting around the template name.
Returns
the newly allocated vp_tmpl_t.

Definition at line 526 of file tmpl.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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.

Note
Conversion is done in place.
Irrespective of whether the vp_tmpl_t was TMPL_TYPE_UNPARSED or TMPL_TYPE_DATA, on successful cast it will be TMPL_TYPE_DATA.
Parameters
[in,out]vptThe template to modify. Must be of type TMPL_TYPE_UNPARSED or TMPL_TYPE_DATA.
[in]typeto cast to.
[in]enumvEnumerated dictionary values associated with a fr_dict_attr_t.
Returns
  • 0 on success.
  • -1 on failure.

Definition at line 1212 of file tmpl.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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.

Note
Conversion is done in place.
Parameters
[in,out]vptThe template to modify. Must be of type TMPL_TYPE_UNPARSED.

Definition at line 1273 of file tmpl.c.

+ Here is the call graph for this function:

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 result.

Note
Like tmpl_expand, but produces a VALUE_PAIR.
Parameters
outWhere to write pointer to the new VALUE_PAIR.
requestThe current REQUEST.
vptto cast. Must be one of the following types:
casttype of VALUE_PAIR to create.
Returns
  • 0 on success.
  • -1 on failure.

Definition at line 1304 of file tmpl.c.

+ Here is the call graph for this function:

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.

Parameters
ctxto allocate new VALUE_PAIR in.
outWhere to write the copied VALUE_PAIR (s).
requestThe current REQUEST.
vptspecifying the VALUE_PAIR type/tag or list to copy. Must be one of the following types:
Returns
  • -1 if no matching VALUE_PAIR could be found.
  • -2 if list could not be found (doesn't exist in current REQUEST).
  • -3 if context could not be found (no parent REQUEST available).
  • -4 on memory allocation error.

Definition at line 2181 of file tmpl.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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.

This makes iterating over the one or more VALUE_PAIR specified by a vp_tmpl_t significantly easier.

Parameters
errMay be NULL if no error code is required. Will be set to:
  • 0 on success.
  • -1 if no matching VALUE_PAIR could be found.
  • -2 if list could not be found (doesn't exist in current REQUEST).
  • -3 if context could not be found (no parent REQUEST available).
cursorto store iterator state.
requestThe current REQUEST.
vptspecifying the VALUE_PAIR type/tag or list to iterate over.
Returns
See Also
tmpl_cursor_next

Definition at line 1990 of file tmpl.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

VALUE_PAIR* tmpl_cursor_next ( vp_cursor_t cursor,
vp_tmpl_t const *  vpt 
)

Returns the next VALUE_PAIR specified by vpt.

Parameters
cursorinitialised with tmpl_cursor_init.
vptspecifying the VALUE_PAIR type/tag to iterate over. Must be one of the following types:
Returns

Definition at line 2128 of file tmpl.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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.

Note
fr_dict_attr_add will not return an error if the attribute already exists meaning that multiple vp_tmpl_t specifying the same attribute can be passed to this function to be fixed up, so long as the type and flags are identical.
Parameters
vptspecifying undefined attribute to add. tmpl_da pointer will be updated to point to the fr_dict_attr_t inserted into the dictionary. Lists and requests will be preserved.
typeto define undefined attribute as.
flagsto define undefined attribute with.
Returns
  • 1 noop (did nothing) - Not possible to convert tmpl.
  • 0 on success.
  • -1 on failure.

Definition at line 1396 of file tmpl.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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.

Parameters
vptto add. tmpl_da pointer will be updated to point to the fr_dict_attr_t inserted into the dictionary.
Returns
  • 1 noop (did nothing) - Not possible to convert tmpl.
  • 0 on success.
  • -1 on failure.

Definition at line 1360 of file tmpl.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ssize_t tmpl_expand ( char const **  out,
char *  buff,
size_t  bufflen,
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.

The intended use of tmpl_expand and tmpl_aexpand is for modules to easily convert a vp_tmpl_t provided by the conf parser, into a usable value. The value returned should be raw and undoctored for PW_TYPE_STRING and PW_TYPE_OCTETS types, and the printable (string) version of the data for all others.

Depending what arguments are passed, either copies the value to buff, or writes a pointer to a string buffer to out. This allows the most efficient access to the value resolved by the vp_tmpl_t, avoiding unecessary string copies.

Note
This function is used where raw string values are needed, which may mean the string returned may be binary data or contain unprintable chars. fr_snprint or fr_asprint should be used before using these values in debug statements. is_printable can be used to check if the string only contains printable chars.
Parameters
outWhere to write a pointer to the string buffer. On return may point to buff if buff was used to store the value. Otherwise will point to a value_data_t buffer, or the name of the template. To force copying to buff, out should be NULL.
buffExpansion buffer, may be NULL if out is not NULL, and processing TMPL_TYPE_UNPARSED or string types.
bufflenLength of expansion buffer.
requestCurrent request.
vptto expand. Must be one of the following types:
escapexlat escape function (only used for xlat types).
escape_ctxxlat escape function data.
Returns
  • -1 on failure.
  • The length of data written to buff, or pointed to by out.
Todo:
tmpl_expand should accept an enumv da from the lhs of the map.

Definition at line 1479 of file tmpl.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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.

Parameters
[out]outwhere to write the retrieved or created vp.
[in]requestThe current REQUEST.
[in]vptspecifying the VALUE_PAIR type/tag to retrieve or create. Must be TMPL_TYPE_ATTR.
Returns
  • 1 on success a pair was created.
  • 0 on success a pair was found.
  • -1 if a new VALUE_PAIR couldn't be found or created.
  • -2 if list could not be found (doesn't exist in current REQUEST).
  • -3 if context could not be found (no parent REQUEST available).

Definition at line 2251 of file tmpl.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int tmpl_find_vp ( VALUE_PAIR **  out,
REQUEST request,
vp_tmpl_t const *  vpt 
)

Returns the first VP matching a vp_tmpl_t.

Parameters
[out]outwhere to write the retrieved vp.
[in]requestThe current REQUEST.
[in]vptspecifying the VALUE_PAIR type/tag to find. Must be one of the following types:
Returns
  • 0 on success (found matching VALUE_PAIR).
  • -1 if no matching VALUE_PAIR could be found.
  • -2 if list could not be found (doesn't exist in current REQUEST).
  • -3 if context could not be found (no parent REQUEST available).

Definition at line 2224 of file tmpl.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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.

Note
Unlike tmpl_from_attr_substr this function will error out if the entire name string isn't parsed.
The name field is just a copy of the input pointer, if you know that string might be freed before you're done with the vp_tmpl_t use tmpl_afrom_attr_str instead.
Parameters
[out]vptto modify.
[in]nameof attribute including request_refs and pair_lists qualifiers. If only request_refs and pair_lists qualifiers are found, a TMPL_TYPE_LIST vp_tmpl_t will be produced.
[in]request_defThe default REQUEST to set if no request_refs qualifiers are found in name.
[in]list_defThe default list to set if no pair_lists qualifiers are found in name.
[in]allow_unknownIf true attributes in the format accepted by fr_dict_unknown_from_suboid will be allowed, even if they're not in the main dictionaries. If an unknown attribute is found a TMPL_TYPE_ATTR vp_tmpl_t will be produced with the unknown fr_dict_attr_t stored in the unknown.da buffer. This fr_dict_attr_t will have its flags.is_unknown field set to true. If tmpl_from_attr_substr is being called on startup, the vp_tmpl_t may be passed to tmpl_define_unknown_attr to add the unknown attribute to the main dictionary. If the unknown attribute is not added to the main dictionary the vp_tmpl_t cannot be used to search for a VALUE_PAIR in a REQUEST.
[in]allow_undefinedIf true, we don't generate a parse error on unknown attributes. If an unknown attribute is found a TMPL_TYPE_ATTR_UNDEFINED vp_tmpl_t will be produced. A vp_tmpl_t of this type can be passed to tmpl_define_undefined_attr which will add the attribute to the global dictionary, and fixup the vp_tmpl_t, changing it to a TMPL_TYPE_ATTR with a pointer to the new fr_dict_attr_t.
Returns
  • <= 0 on error (parse failure offset as negative integer).
  • > 0 on success (number of bytes parsed).
See Also
REMARKER to produce pretty error markers from the return value.

Definition at line 877 of file tmpl.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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.

Note
The name field is just a copy of the input pointer, if you know that string might be freed before you're done with the vp_tmpl_t use tmpl_afrom_attr_str instead.
Parameters
[out]vptto modify.
[in]nameof attribute including request_refs and pair_lists qualifiers. If only request_refs and pair_lists qualifiers are found, a TMPL_TYPE_LIST vp_tmpl_t will be produced.
[in]request_defThe default REQUEST to set if no request_refs qualifiers are found in name.
[in]list_defThe default list to set if no pair_lists qualifiers are found in name.
[in]allow_unknownIf true attributes in the format accepted by fr_dict_unknown_from_suboid will be allowed, even if they're not in the main dictionaries. If an unknown attribute is found a TMPL_TYPE_ATTR vp_tmpl_t will be produced with the unknown fr_dict_attr_t stored in the unknown.da buffer. This fr_dict_attr_t will have its flags.is_unknown field set to true. If tmpl_from_attr_substr is being called on startup, the vp_tmpl_t may be passed to tmpl_define_unknown_attr to add the unknown attribute to the main dictionary. If the unknown attribute is not added to the main dictionary the vp_tmpl_t cannot be used to search for a VALUE_PAIR in a REQUEST.
[in]allow_undefinedIf true, we don't generate a parse error on unknown attributes. If an unknown attribute is found a TMPL_TYPE_ATTR_UNDEFINED vp_tmpl_t will be produced. A vp_tmpl_t of this type can be passed to tmpl_define_undefined_attr which will add the attribute to the global dictionary, and fixup the vp_tmpl_t, changing it to a TMPL_TYPE_ATTR with a pointer to the new fr_dict_attr_t.
Returns
  • <= 0 on error (parse failure offset as negative integer).
  • > 0 on success (number of bytes parsed).
See Also
REMARKER to produce pretty error markers from the return value.

Definition at line 661 of file tmpl.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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.

Parameters
vptto initialise.
daof VALUE_PAIR type to operate on.
tagMust be one of:
  • A positive integer specifying a specific tag.
  • TAG_ANY - Attribute with no specific tag value.
  • TAG_NONE - No tag.
numSpecific instance, or all instances. Must be one of:
  • A positive integer specifying an instance.
  • NUM_ALL - All instances.
  • NUM_ANY - The first instance found.
  • NUM_LAST - The last instance found.
requestto operate on.
listto operate on.

Definition at line 567 of file tmpl.c.

+ Here is the call graph for this function:

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.

Note
Name is not strdupe'd or memcpy'd so must be available, and must not change for the lifetime of the vp_tmpl_t.
Parameters
[out]vptto initialise.
[in]typeto set in the vp_tmpl_t.
[in]nameof the vp_tmpl_t.
[in]lenThe length of the buffer (or a substring of the buffer) pointed to by name. If < 0 strlen will be used to determine the length.
[in]quoteThe type of quoting around the template name.
Returns
a pointer to the initialised vp_tmpl_t. The same value as vpt.

Definition at line 497 of file tmpl.c.

+ Here is the caller graph for this function:

size_t tmpl_snprint ( char *  out,
size_t  outlen,
vp_tmpl_t const *  vpt,
fr_dict_attr_t const *  values 
)

Print a vp_tmpl_t to a string.

Parameters
[out]outWhere to write the presentation format vp_tmpl_t string.
[in]outlenSize of output buffer.
[in]vptto print.
[in]valuesUsed for TMPL_TYPE_DATA only. fr_dict_attr_t to use when mapping integer values to strings.
Returns
  • The number of bytes written to the out buffer.
  • A number >= outlen if truncation has occurred.

Definition at line 1822 of file tmpl.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Variable Documentation

Map keywords to pair_lists_t values.

Definition at line 53 of file tmpl.c.

const FR_NAME_NUMBER request_refs[]

Map keywords to request_refs_t values.

Definition at line 74 of file tmpl.c.

const FR_NAME_NUMBER tmpl_names[]

Map tmpl_type_t values to descriptive strings.

Definition at line 36 of file tmpl.c.