xlat expansion parsing and evaluation API.
More...
#include <freeradius-devel/conffile.h>
Go to the source code of this file.
|
typedef size_t(* | xlat_escape_t )(REQUEST *request, char *out, size_t outlen, char const *in, void *arg) |
|
typedef struct xlat_exp | xlat_exp_t |
|
typedef ssize_t(* | xlat_func_t )(char **out, size_t outlen, void const *mod_inst, void const *xlat_inst, REQUEST *request, char const *fmt) |
| xlat callback function More...
|
|
typedef int(* | xlat_instantiate_t )(void *xlat_inst, void *mod_inst, char const *fmt) |
| Allocate new instance data for an xlat instance. More...
|
|
|
ssize_t ssize_t ssize_t | radius_axlat (char **out, REQUEST *request, char const *fmt, xlat_escape_t escape, void *escape_ctx) CC_HINT(nonnull(1 |
|
ssize_t ssize_t ssize_t ssize_t | radius_axlat_struct (char **out, REQUEST *request, xlat_exp_t const *xlat, xlat_escape_t escape, void *ctx) CC_HINT(nonnull(1 |
|
ssize_t | radius_xlat (char *out, size_t outlen, REQUEST *request, char const *fmt, xlat_escape_t escape, void *escape_ctx) CC_HINT(nonnull(1 |
|
ssize_t ssize_t | radius_xlat_struct (char *out, size_t outlen, REQUEST *request, xlat_exp_t const *xlat, xlat_escape_t escape, void *ctx) CC_HINT(nonnull(1 |
|
ssize_t | xlat_fmt_to_ref (uint8_t const **out, REQUEST *request, char const *fmt) |
| Crappy temporary function to add attribute ref support to xlats. More...
|
|
void | xlat_free (void) |
| De-register all xlat functions, used mainly for debugging. More...
|
|
int | xlat_register (void *mod_inst, char const *name, xlat_func_t func, xlat_escape_t escape, xlat_instantiate_t instantiate, size_t inst_size, size_t buf_len) |
| Register an xlat function. More...
|
|
bool | xlat_register_redundant (CONF_SECTION *cs) |
|
size_t | xlat_snprint (char *buffer, size_t bufsize, xlat_exp_t const *node) |
|
ssize_t ssize_t ssize_t
ssize_t ssize_t | xlat_tokenize (TALLOC_CTX *ctx, char *fmt, xlat_exp_t **head, char const **error) |
|
void | xlat_unregister (void *mod_inst, char const *name, xlat_func_t func) |
|
void | xlat_unregister_module (void *instance) |
|
xlat expansion parsing and evaluation API.
- Id:
- 8b404dad2c9c5805403ee869a985c96689b90a56
- Copyright
- 2015 The FreeRADIUS server project
Definition in file xlat.h.
#define XLAT_DEFAULT_BUF_LEN 2048 |
typedef size_t(* xlat_escape_t)(REQUEST *request, char *out, size_t outlen, char const *in, void *arg) |
typedef ssize_t(* xlat_func_t)(char **out, size_t outlen, void const *mod_inst, void const *xlat_inst, REQUEST *request, char const *fmt) |
xlat callback function
Should write the result of expanding the fmt string to the output buffer.
If a outlen > 0 was provided to xlat_register, out will point to a talloced buffer of that size, which the result should be written to.
If outlen is 0, then the function should allocate its own buffer, in the context of the request.
- Parameters
-
[in,out] | out | Where to write either a pointer to a new buffer, or data to an existing buffer. |
[in] | outlen | Length of pre-allocated buffer, or 0 if function should allocate its own buffer. |
[in] | mod_inst | Instance data provided by the module that registered the xlat. |
[in] | xlat_inst | Instance data created by the xlat instantiation function. |
[in] | request | The current request. |
[in] | fmt | string to expand. |
Definition at line 55 of file xlat.h.
typedef int(* xlat_instantiate_t)(void *xlat_inst, void *mod_inst, char const *fmt) |
Allocate new instance data for an xlat instance.
- Parameters
-
[out] | xlat_inst | Structure to populate. Allocated by map_proc_instantiate. |
[in] | mod_inst | Module instance that registered the xlat_func_t. |
[in] | fmt | string to base instantiation around. |
- Returns
- 0 on success.
- -1 on failure.
Definition at line 68 of file xlat.h.
ssize_t ssize_t ssize_t radius_axlat |
( |
char ** |
out, |
|
|
REQUEST * |
request, |
|
|
char const * |
fmt, |
|
|
xlat_escape_t |
escape, |
|
|
void * |
escape_ctx |
|
) |
| |
ssize_t radius_xlat |
( |
char * |
out, |
|
|
size_t |
outlen, |
|
|
REQUEST * |
request, |
|
|
char const * |
fmt, |
|
|
xlat_escape_t |
escape, |
|
|
void * |
escape_ctx |
|
) |
| |
ssize_t xlat_fmt_to_ref |
( |
uint8_t const ** |
out, |
|
|
REQUEST * |
request, |
|
|
char const * |
fmt |
|
) |
| |
Crappy temporary function to add attribute ref support to xlats.
This needs to die, and hopefully will die, when xlat functions accept xlat node structures.
Provides either a pointer to a buffer which contains the value of the reference VALUE_PAIR in an architecture independent format. Or a pointer to the start of the fmt string.
The pointer is only guaranteed to be valid between calls to xlat_fmt_to_ref, and so long as the source VALUE_PAIR is not freed.
- Parameters
-
out | where to write a pointer to the buffer to the data the xlat function needs to work on. |
request | current request. |
fmt | string. |
- Returns
- The length of the data.
- -1 on failure.
Definition at line 1125 of file xlat.c.
De-register all xlat functions, used mainly for debugging.
Definition at line 1147 of file xlat.c.
Register an xlat function.
- Parameters
-
[in] | mod_inst | Instance of module that's registering the xlat function. |
[in] | name | xlat name. |
[in] | func | xlat function to be called. |
[in] | escape | function to sanitize any sub expansions passed to the xlat function. |
[in] | instantiate | function to pre-parse any xlat specific data. |
[in] | inst_size | sizeof() this xlat's instance data. |
[in] | buf_len | Size of the output buffer to allocate when calling the function. May be 0 if the function allocates its own buffer. |
- Returns
- 0 on success.
- -1 on failure.
Definition at line 717 of file xlat.c.
size_t xlat_snprint |
( |
char * |
buffer, |
|
|
size_t |
bufsize, |
|
|
xlat_exp_t const * |
node |
|
) |
| |
ssize_t ssize_t ssize_t ssize_t ssize_t xlat_tokenize |
( |
TALLOC_CTX * |
ctx, |
|
|
char * |
fmt, |
|
|
xlat_exp_t ** |
head, |
|
|
char const ** |
error |
|
) |
| |
void xlat_unregister |
( |
void * |
mod_inst, |
|
|
char const * |
name, |
|
|
xlat_func_t |
func |
|
) |
| |
void xlat_unregister_module |
( |
void * |
instance | ) |
|