The FreeRADIUS server
$Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
|
Registration API for xlat functions. More...
#include <freeradius-devel/unlang/xlat.h>
Go to the source code of this file.
Macros | |
#define | xlat_func_instantiate_set(_xlat, _instantiate, _inst_struct, _detach, _uctx) _xlat_func_instantiate_set(_xlat, _instantiate, #_inst_struct, sizeof(_inst_struct), _detach, _uctx) |
Set a callback for global instantiation of xlat functions. More... | |
#define | xlat_func_safe_for_set(_xlat, _escaped) _xlat_func_safe_for_set(_xlat, (uintptr_t) (_escaped)) |
Set the escaped values for output boxes. More... | |
#define | xlat_func_thread_instantiate_set(_xlat, _instantiate, _inst_struct, _detach, _uctx) _xlat_func_thread_instantiate_set(_xlat, _instantiate, #_inst_struct, sizeof(_inst_struct), _detach, _uctx) |
Set a callback for thread-specific instantiation of xlat functions. More... | |
Typedefs | |
typedef fr_slen_t(* | xlat_print_t) (fr_sbuff_t *in, xlat_exp_t const *self, void *inst, fr_sbuff_escape_rules_t const *e_rules) |
Custom function to print xlat debug. More... | |
typedef int(* | xlat_purify_t) (xlat_exp_t *xlat, void *inst, request_t *request) |
Custom function purify the result of an xlat function. More... | |
typedef int(* | xlat_resolve_t) (xlat_exp_t *xlat, void *inst, xlat_res_rules_t const *xr_rules) |
Custom function to perform resolution of arguments. More... | |
Enumerations | |
enum | xlat_func_flags_t { XLAT_FUNC_FLAG_NONE = 0x00 , XLAT_FUNC_FLAG_PURE = 0x01 , XLAT_FUNC_FLAG_INTERNAL = 0x02 } |
Functions | |
void | _xlat_func_instantiate_set (xlat_t const *xlat, xlat_instantiate_t instantiate, char const *inst_type, size_t inst_size, xlat_detach_t detach, void *uctx) |
Set global instantiation/detach callbacks. More... | |
void | _xlat_func_safe_for_set (xlat_t *xlat, uintptr_t escaped) |
Set the escaped values for output boxes. More... | |
void | _xlat_func_thread_instantiate_set (xlat_t const *xlat, xlat_thread_instantiate_t thread_instantiate, char const *thread_inst_type, size_t thread_inst_size, xlat_thread_detach_t thread_detach, void *uctx) |
Register an async xlat. More... | |
int | xlat_func_args_set (xlat_t *xlat, xlat_arg_parser_t const args[]) |
Register the arguments of an xlat. More... | |
void | xlat_func_call_env_set (xlat_t *x, call_env_method_t const *env) |
Register call environment of an xlat. More... | |
int8_t | xlat_func_cmp (void const *one, void const *two) |
Compare two xlat_t by the underlying function. More... | |
xlat_t * | xlat_func_find_module (module_inst_ctx_t const *mctx, char const *name) |
void | xlat_func_flags_set (xlat_t *x, xlat_func_flags_t flags) |
Specify flags that alter the xlat's behaviour. More... | |
void | xlat_func_free (void) |
int | xlat_func_init (void) |
void | xlat_func_print_set (xlat_t *xlat, xlat_print_t func) |
Set a print routine for an xlat function. More... | |
xlat_t * | xlat_func_register (TALLOC_CTX *ctx, char const *name, xlat_func_t func, fr_type_t return_type)) |
Register an xlat function. More... | |
void | xlat_func_resolve_set (xlat_t *xlat, xlat_resolve_t func) |
Set a resolve routine for an xlat function. More... | |
void | xlat_func_unregister (char const *name) |
Unregister an xlat function. More... | |
void | xlat_func_unregister_module (module_instance_t const *inst) |
void | xlat_mctx_set (xlat_t *x, module_inst_ctx_t const *mctx) |
Associate a module calling ctx with the xlat. More... | |
void | xlat_purify_func_set (xlat_t *xlat, xlat_purify_t func) |
Set a resolve routine for an xlat function. More... | |
Registration API for xlat functions.
Definition in file xlat_func.h.
#define xlat_func_instantiate_set | ( | _xlat, | |
_instantiate, | |||
_inst_struct, | |||
_detach, | |||
_uctx | |||
) | _xlat_func_instantiate_set(_xlat, _instantiate, #_inst_struct, sizeof(_inst_struct), _detach, _uctx) |
Set a callback for global instantiation of xlat functions.
[in] | _xlat | function to set the callback for (as returned by xlat_register). |
[in] | _instantiate | A instantiation callback. |
[in] | _inst_struct | The instance struct to pre-allocate. |
[in] | _detach | A destructor callback. |
[in] | _uctx | to pass to _instantiate and _detach callbacks. |
Definition at line 93 of file xlat_func.h.
#define xlat_func_safe_for_set | ( | _xlat, | |
_escaped | |||
) | _xlat_func_safe_for_set(_xlat, (uintptr_t) (_escaped)) |
Set the escaped values for output boxes.
Any boxes output by the xlat function will have their values marked as safe for something.
[in] | _xlat | function to set the escaped value for (as returned by xlat_register). |
[in] | _escaped | escaped value to write to output boxes. |
Definition at line 82 of file xlat_func.h.
#define xlat_func_thread_instantiate_set | ( | _xlat, | |
_instantiate, | |||
_inst_struct, | |||
_detach, | |||
_uctx | |||
) | _xlat_func_thread_instantiate_set(_xlat, _instantiate, #_inst_struct, sizeof(_inst_struct), _detach, _uctx) |
Set a callback for thread-specific instantiation of xlat functions.
[in] | _xlat | function to set the callback for (as returned by xlat_register). |
[in] | _instantiate | A instantiation callback. |
[in] | _inst_struct | The instance struct to pre-allocate. |
[in] | _detach | A destructor callback. |
[in] | _uctx | to pass to _instantiate and _detach callbacks. |
Definition at line 108 of file xlat_func.h.
typedef fr_slen_t(* xlat_print_t) (fr_sbuff_t *in, xlat_exp_t const *self, void *inst, fr_sbuff_escape_rules_t const *e_rules) |
Custom function to print xlat debug.
Definition at line 45 of file xlat_func.h.
typedef int(* xlat_purify_t) (xlat_exp_t *xlat, void *inst, request_t *request) |
Custom function purify the result of an xlat function.
Definition at line 53 of file xlat_func.h.
typedef int(* xlat_resolve_t) (xlat_exp_t *xlat, void *inst, xlat_res_rules_t const *xr_rules) |
Custom function to perform resolution of arguments.
Definition at line 49 of file xlat_func.h.
enum xlat_func_flags_t |
Enumerator | |
---|---|
XLAT_FUNC_FLAG_NONE | |
XLAT_FUNC_FLAG_PURE | |
XLAT_FUNC_FLAG_INTERNAL |
Definition at line 36 of file xlat_func.h.
void _xlat_func_instantiate_set | ( | xlat_t const * | xlat, |
xlat_instantiate_t | instantiate, | ||
char const * | inst_type, | ||
size_t | inst_size, | ||
xlat_detach_t | detach, | ||
void * | uctx | ||
) |
Set global instantiation/detach callbacks.
[in] | xlat | to set instantiation callbacks for. |
[in] | instantiate | Instantiation function. Called whenever a xlat is compiled. |
[in] | inst_type | Name of the instance structure. |
[in] | inst_size | The size of the instance struct. Pre-allocated for use by the instantiate function. If 0, no memory will be allocated. |
[in] | detach | Called when an xlat_exp_t is freed. |
[in] | uctx | Passed to the instantiation function. |
Definition at line 461 of file xlat_func.c.
void _xlat_func_safe_for_set | ( | xlat_t * | xlat, |
fr_value_box_safe_for_t | safe_for | ||
) |
Set the escaped values for output boxes.
[in] | xlat | function to set the escaped value for (as returned by xlat_register). |
[in] | safe_for | escaped value to write to output boxes. |
Definition at line 444 of file xlat_func.c.
void _xlat_func_thread_instantiate_set | ( | xlat_t const * | xlat, |
xlat_thread_instantiate_t | thread_instantiate, | ||
char const * | thread_inst_type, | ||
size_t | thread_inst_size, | ||
xlat_thread_detach_t | thread_detach, | ||
void * | uctx | ||
) |
Register an async xlat.
All functions registered must be !pure
[in] | xlat | to set instantiation callbacks for. |
[in] | thread_instantiate | Instantiation function. Called for every compiled xlat every time a thread is started. |
[in] | thread_inst_type | Name of the thread instance structure. |
[in] | thread_inst_size | The size of the thread instance struct. Pre-allocated for use by the instantiate function. If 0, no memory will be allocated. |
[in] | thread_detach | Called when the thread is freed. |
[in] | uctx | Passed to the thread instantiate function. |
Definition at line 489 of file xlat_func.c.
int xlat_func_args_set | ( | xlat_t * | x, |
xlat_arg_parser_t const | args[] | ||
) |
Register the arguments of an xlat.
For xlats that take multiple arguments
[in,out] | x | to have it's arguments registered |
[in] | args | to be registered |
Definition at line 365 of file xlat_func.c.
void xlat_func_call_env_set | ( | xlat_t * | x, |
call_env_method_t const * | env_method | ||
) |
Register call environment of an xlat.
[in,out] | x | to have it's module method env registered. |
[in] | env_method | to be registered. |
Definition at line 392 of file xlat_func.c.
int8_t xlat_func_cmp | ( | void const * | one, |
void const * | two | ||
) |
Compare two xlat_t by the underlying function.
[in] | one | First xlat_t to compare. |
[in] | two | Second xlat_t to compare. |
Definition at line 69 of file xlat_func.c.
xlat_t* xlat_func_find_module | ( | module_inst_ctx_t const * | mctx, |
char const * | name | ||
) |
void xlat_func_flags_set | ( | xlat_t * | x, |
xlat_func_flags_t | flags | ||
) |
Specify flags that alter the xlat's behaviour.
[in] | x | xlat to set flags for. |
[in] | flags | to set. |
Definition at line 402 of file xlat_func.c.
void xlat_func_free | ( | void | ) |
Definition at line 566 of file xlat_func.c.
int xlat_func_init | ( | void | ) |
Definition at line 550 of file xlat_func.c.
void xlat_func_print_set | ( | xlat_t * | xlat, |
xlat_print_t | func | ||
) |
Set a print routine for an xlat function.
[in] | xlat | to set |
[in] | func | for printing |
Definition at line 414 of file xlat_func.c.
xlat_t* xlat_func_register | ( | TALLOC_CTX * | ctx, |
char const * | name, | ||
xlat_func_t | func, | ||
fr_type_t | return_type | ||
) |
Register an xlat function.
[in] | ctx | Used to automate deregistration of the xlat function. |
[in] | name | of the xlat. |
[in] | func | to register. |
[in] | return_type | what type of output the xlat function will produce. |
Definition at line 218 of file xlat_func.c.
void xlat_func_resolve_set | ( | xlat_t * | xlat, |
xlat_resolve_t | func | ||
) |
Set a resolve routine for an xlat function.
[in] | xlat | to set |
[in] | func | to resolve xlat. |
Definition at line 424 of file xlat_func.c.
void xlat_func_unregister | ( | char const * | name | ) |
Unregister an xlat function.
We can only have one function to call per name, so the passing of "func" here is extraneous.
[in] | name | xlat to unregister. |
Definition at line 519 of file xlat_func.c.
void xlat_func_unregister_module | ( | module_instance_t const * | inst | ) |
Definition at line 533 of file xlat_func.c.
void xlat_mctx_set | ( | xlat_t * | x, |
module_inst_ctx_t const * | mctx | ||
) |
Associate a module calling ctx with the xlat.
[in] | x | to set the mctx for. |
[in] | mctx | Is duplicated and about to the lifetime of the xlat. |
Definition at line 299 of file xlat_func.c.
void xlat_purify_func_set | ( | xlat_t * | xlat, |
xlat_purify_t | func | ||
) |
Set a resolve routine for an xlat function.
[in] | xlat | to set |
[in] | func | to purify xlat |
Definition at line 434 of file xlat_func.c.