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

xlat expansion parsing and evaluation API. More...

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

Go to the source code of this file.

Macros

#define XLAT_DEFAULT_BUF_LEN   2048
 

Typedefs

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

Functions

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)
 

Detailed Description

xlat expansion parsing and evaluation API.

Id:
8b404dad2c9c5805403ee869a985c96689b90a56

Definition in file xlat.h.

Macro Definition Documentation

#define XLAT_DEFAULT_BUF_LEN   2048

Definition at line 89 of file xlat.h.

Typedef Documentation

typedef size_t(* xlat_escape_t)(REQUEST *request, char *out, size_t outlen, char const *in, void *arg)

Definition at line 36 of file xlat.h.

typedef struct xlat_exp xlat_exp_t

Definition at line 34 of file xlat.h.

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]outWhere to write either a pointer to a new buffer, or data to an existing buffer.
[in]outlenLength of pre-allocated buffer, or 0 if function should allocate its own buffer.
[in]mod_instInstance data provided by the module that registered the xlat.
[in]xlat_instInstance data created by the xlat instantiation function.
[in]requestThe current request.
[in]fmtstring 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_instStructure to populate. Allocated by map_proc_instantiate.
[in]mod_instModule instance that registered the xlat_func_t.
[in]fmtstring to base instantiation around.
Returns
  • 0 on success.
  • -1 on failure.

Definition at line 68 of file xlat.h.

Function Documentation

ssize_t ssize_t ssize_t radius_axlat ( char **  out,
REQUEST request,
char const *  fmt,
xlat_escape_t  escape,
void *  escape_ctx 
)

+ Here is the caller graph for this function:

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 
)

+ Here is the caller graph for this function:

ssize_t radius_xlat ( char *  out,
size_t  outlen,
REQUEST request,
char const *  fmt,
xlat_escape_t  escape,
void *  escape_ctx 
)

+ Here is the caller graph for this function:

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 
)

+ Here is the caller graph for this function:

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
outwhere to write a pointer to the buffer to the data the xlat function needs to work on.
requestcurrent request.
fmtstring.
Returns
  • The length of the data.
  • -1 on failure.

Definition at line 1125 of file xlat.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void xlat_free ( void  )

De-register all xlat functions, used mainly for debugging.

Definition at line 1147 of file xlat.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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.

Parameters
[in]mod_instInstance of module that's registering the xlat function.
[in]namexlat name.
[in]funcxlat function to be called.
[in]escapefunction to sanitize any sub expansions passed to the xlat function.
[in]instantiatefunction to pre-parse any xlat specific data.
[in]inst_sizesizeof() this xlat's instance data.
[in]buf_lenSize 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.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool xlat_register_redundant ( CONF_SECTION cs)

Definition at line 1041 of file xlat.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

size_t xlat_snprint ( char *  buffer,
size_t  bufsize,
xlat_exp_t const *  node 
)

Definition at line 1659 of file xlat.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ssize_t ssize_t ssize_t ssize_t ssize_t xlat_tokenize ( TALLOC_CTX *  ctx,
char *  fmt,
xlat_exp_t **  head,
char const **  error 
)

Definition at line 1784 of file xlat.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void xlat_unregister ( void *  mod_inst,
char const *  name,
xlat_func_t  func 
)

+ Here is the caller graph for this function:

void xlat_unregister_module ( void *  instance)

Definition at line 877 of file xlat.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function: