The FreeRADIUS server
$Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
|
#include <freeradius-devel/server/tmpl.h>
#include <freeradius-devel/util/dcursor.h>
Go to the source code of this file.
Data Structures | |
struct | tmpl_dcursor_ctx_s |
Maintains state between cursor calls. More... | |
struct | tmpl_dcursor_nested_s |
State for traversing an attribute reference. More... | |
Macros | |
#define | tmpl_dcursor_build_init(_err, _ctx, _cc, _cursor, _request, _vpt, _build, _uctx) _tmpl_dcursor_init(_err, _ctx, _cc, _cursor, _request, _vpt, _build, _uctx) |
#define | tmpl_dcursor_init(_err, _ctx, _cc, _cursor, _request, _vpt) _tmpl_dcursor_init(_err, _ctx, _cc, _cursor, _request, _vpt, NULL, NULL) |
Typedefs | |
typedef fr_pair_t *(* | tmpl_dcursor_build_t) (fr_pair_t *parent, fr_dcursor_t *cursor, fr_dict_attr_t const *da, void *uctx) |
Callback function for populating missing pair. More... | |
typedef struct tmpl_dcursor_ctx_s | tmpl_dcursor_ctx_t |
typedef struct tmpl_dcursor_nested_s | tmpl_dcursor_nested_t |
Functions | |
fr_pair_t * | _tmpl_dcursor_init (int *err, TALLOC_CTX *ctx, tmpl_dcursor_ctx_t *cc, fr_dcursor_t *cursor, request_t *request, tmpl_t const *vpt, tmpl_dcursor_build_t build, void *uctx) |
Initialise a fr_dcursor_t to the fr_pair_t specified by a tmpl_t. More... | |
void | tmpl_dcursor_clear (tmpl_dcursor_ctx_t *cc) |
Clear any temporary state allocations. More... | |
fr_pair_t * | tmpl_dcursor_init_relative (int *err, TALLOC_CTX *ctx, tmpl_dcursor_ctx_t *cc, fr_dcursor_t *cursor, request_t *request, fr_pair_t *list, tmpl_t const *vpt, tmpl_dcursor_build_t build, void *uctx) |
Initialise a fr_dcursor_t at the specified point in a pair tree. More... | |
fr_pair_t * | tmpl_dcursor_pair_build (fr_pair_t *parent, fr_dcursor_t *cursor, fr_dict_attr_t const *da, UNUSED void *uctx) |
Simple pair building callback for use with tmpl_dcursors. More... | |
ssize_t | tmpl_dcursor_print (fr_sbuff_t *out, tmpl_dcursor_ctx_t const *cc) |
struct tmpl_dcursor_ctx_s |
Maintains state between cursor calls.
Definition at line 62 of file tmpl_dcursor.h.
Data Fields | ||
---|---|---|
tmpl_dcursor_build_t | build | Callback to build missing pairs. |
TALLOC_CTX * | ctx | Temporary allocations go here. |
tmpl_dcursor_nested_t | leaf |
Pre-allocated leaf state. We always need one of these so it doesn't make sense to allocate it later. |
fr_pair_list_t * | list | List within the request. |
fr_dlist_head_t | nested |
Nested state. These are allocated when we need to maintain state between multiple cursor calls for a particular attribute reference. This forms a stack of tmpl_dcursor_nested_t and tracks where we are in evaluation at all levels. |
TALLOC_CTX * | pool | Temporary pool. |
request_t * | request | Result of following the request references. |
void * | uctx | Context for building new pairs. |
tmpl_t const * | vpt | tmpl we're evaluating. |
struct tmpl_dcursor_nested_s |
State for traversing an attribute reference.
Definition at line 44 of file tmpl_dcursor.h.
Data Fields | ||
---|---|---|
tmpl_attr_t const * | ar |
Attribute reference this state entry is associated with. Mainly for debugging. |
fr_dcursor_t | cursor | Cursor to track where we are in the list in case we're doing counts. |
fr_dlist_t | entry | Entry in the dlist that forms the evaluation stack. |
TALLOC_CTX * | list_ctx | Track where we should be allocating attributes. |
size_t | num | which attribute number we are looking at |
bool | seen |
Whether we've seen an attribute at this level of evaluation already. This is mainly used where the build cursor is used. |
#define tmpl_dcursor_build_init | ( | _err, | |
_ctx, | |||
_cc, | |||
_cursor, | |||
_request, | |||
_vpt, | |||
_build, | |||
_uctx | |||
) | _tmpl_dcursor_init(_err, _ctx, _cc, _cursor, _request, _vpt, _build, _uctx) |
Definition at line 103 of file tmpl_dcursor.h.
#define tmpl_dcursor_init | ( | _err, | |
_ctx, | |||
_cc, | |||
_cursor, | |||
_request, | |||
_vpt | |||
) | _tmpl_dcursor_init(_err, _ctx, _cc, _cursor, _request, _vpt, NULL, NULL) |
Definition at line 100 of file tmpl_dcursor.h.
typedef fr_pair_t*(* tmpl_dcursor_build_t) (fr_pair_t *parent, fr_dcursor_t *cursor, fr_dict_attr_t const *da, void *uctx) |
Callback function for populating missing pair.
[in] | parent | to allocate the new pair in. |
[in] | cursor | to append the pair to. |
[in] | da | of the attribute to create. |
[in] | uctx | context data. |
Definition at line 39 of file tmpl_dcursor.h.
typedef struct tmpl_dcursor_ctx_s tmpl_dcursor_ctx_t |
Definition at line 1 of file tmpl_dcursor.h.
typedef struct tmpl_dcursor_nested_s tmpl_dcursor_nested_t |
Definition at line 1 of file tmpl_dcursor.h.
fr_pair_t* _tmpl_dcursor_init | ( | int * | err, |
TALLOC_CTX * | ctx, | ||
tmpl_dcursor_ctx_t * | cc, | ||
fr_dcursor_t * | cursor, | ||
request_t * | request, | ||
tmpl_t const * | vpt, | ||
tmpl_dcursor_build_t | build, | ||
void * | uctx | ||
) |
Initialise a fr_dcursor_t to the fr_pair_t specified by a tmpl_t.
This makes iterating over the one or more fr_pair_t specified by a tmpl_t significantly easier.
[out] | err | May be NULL if no error code is required. Will be set to: |
[in] | ctx | to make temporary allocations under. |
[in] | cc | to initialise. Tracks evaluation state. Must be explicitly cleared with tmpl_cursor_state_clear otherwise we will leak memory. |
[in] | cursor | to store iterator position. |
[in] | request | The current request_t. |
[in] | vpt | specifying the fr_pair_t type or list to iterate over. |
[in] | build | Callback to build missing pairs. |
[in] | uctx | for building new pairs. |
Definition at line 469 of file tmpl_dcursor.c.
void tmpl_dcursor_clear | ( | tmpl_dcursor_ctx_t * | cc | ) |
Clear any temporary state allocations.
Definition at line 495 of file tmpl_dcursor.c.
fr_pair_t* tmpl_dcursor_init_relative | ( | int * | err, |
TALLOC_CTX * | ctx, | ||
tmpl_dcursor_ctx_t * | cc, | ||
fr_dcursor_t * | cursor, | ||
request_t * | request, | ||
fr_pair_t * | list, | ||
tmpl_t const * | vpt, | ||
tmpl_dcursor_build_t | build, | ||
void * | uctx | ||
) |
Initialise a fr_dcursor_t at the specified point in a pair tree.
This makes iterating over the one or more fr_pair_t specified by a tmpl_t significantly easier.
[out] | err | May be NULL if no error code is required. Will be set to: |
[in] | ctx | to make temporary allocations under. |
[in] | cc | to initialise. Tracks evaluation state. Must be explicitly cleared with tmpl_cursor_state_clear otherwise we will leak memory. |
[in] | cursor | to store iterator position. |
[in] | request | the current request. |
[in] | list | a nested list to start evaluating from. May be the child list of a pair in the request's pair tree. |
[in] | vpt | specifying the fr_pair_t type or list to iterate over. |
[in] | build | Callback to build missing pairs. |
[in] | uctx | to pass to build. |
Definition at line 385 of file tmpl_dcursor.c.
fr_pair_t* tmpl_dcursor_pair_build | ( | fr_pair_t * | parent, |
fr_dcursor_t * | cursor, | ||
fr_dict_attr_t const * | da, | ||
UNUSED void * | uctx | ||
) |
Simple pair building callback for use with tmpl_dcursors.
Which always appends the new pair to the tail of the list since it is only called when no matching pairs were found when walking the list.
[in] | parent | to allocate new pair within. |
[in,out] | cursor | to append new pair to. |
[in] | da | of new pair. |
[in] | uctx | unused. |
Definition at line 523 of file tmpl_dcursor.c.
ssize_t tmpl_dcursor_print | ( | fr_sbuff_t * | out, |
tmpl_dcursor_ctx_t const * | cc | ||
) |
Definition at line 781 of file tmpl_dcursor.c.