The FreeRADIUS server
$Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
|
Create instance data for xlat function calls. More...
#include "lib/unlang/call_env.h"
#include <freeradius-devel/io/schedule.h>
#include <freeradius-devel/server/base.h>
#include <freeradius-devel/unlang/xlat_priv.h>
#include <freeradius-devel/util/debug.h>
#include <freeradius-devel/util/heap.h>
Go to the source code of this file.
Functions | |
static int8_t | _xlat_inst_cmp (void const *one, void const *two) |
Compare two xlat instances based on node pointer. More... | |
static int | _xlat_inst_detach (xlat_inst_t *xi) |
Destructor for xlat_inst_t. More... | |
static int | _xlat_inst_walker (xlat_exp_t *node, UNUSED void *uctx) |
static int | _xlat_instantiate_ephemeral_walker (xlat_exp_t *node, void *uctx) |
Callback for creating "ephemeral" instance data for a xlat_exp_t. More... | |
static int8_t | _xlat_thread_inst_cmp (void const *one, void const *two) |
Compare two thread instances based on node pointer. More... | |
static int | _xlat_thread_inst_detach (xlat_thread_inst_t *xt) |
Destructor for xlat_thread_inst_t. More... | |
int | xlat_finalize (xlat_exp_head_t *head, fr_event_list_t *runtime_el) |
Bootstrap static xlats, or instantiate ephemeral ones. More... | |
static xlat_inst_t * | xlat_inst_alloc (xlat_exp_t *node) |
Allocate instance data for an xlat expansion. More... | |
static int | xlat_instance_register (xlat_exp_head_t *head) |
Create instance data for "permanent" xlats. More... | |
int | xlat_instance_register_func (xlat_exp_t *node) |
Callback for creating "permanent" instance data for a xlat_exp_t. More... | |
int | xlat_instance_unregister_func (xlat_exp_t *node) |
Remove a node from the list of xlat instance data. More... | |
void | xlat_instances_free (void) |
Walk over all registered instance data and free them explicitly. More... | |
int | xlat_instantiate (void) |
Call instantiation functions for all registered, "permanent" xlats. More... | |
static int | xlat_instantiate_ephemeral (xlat_exp_head_t *head, fr_event_list_t *el) |
Create instance data for "ephemeral" xlats. More... | |
static int | xlat_instantiate_init (void) |
Initialise the xlat instance data code. More... | |
void | xlat_thread_detach (void) |
Destroy any thread specific xlat instances. More... | |
static xlat_thread_inst_t * | xlat_thread_inst_alloc (TALLOC_CTX *ctx, fr_event_list_t *el, xlat_inst_t *xi) |
Create thread instances where needed. More... | |
xlat_thread_inst_t * | xlat_thread_instance_find (xlat_exp_t const *node) |
Retrieve xlat/thread specific instance data. More... | |
int | xlat_thread_instantiate (TALLOC_CTX *ctx, fr_event_list_t *el) |
Create thread specific instance tree and create thread instances. More... | |
Variables | |
return | |
static fr_heap_t * | xlat_inst_tree |
Holds instance data created by xlat_instantiate. More... | |
static _Thread_local fr_heap_t * | xlat_thread_inst_tree |
Holds thread specific instance data created by xlat_instantiate. More... | |
Create instance data for xlat function calls.
Definition in file xlat_inst.c.
|
static |
Compare two xlat instances based on node pointer.
[in] | one | First xlat expansion instance. |
[in] | two | Second xlat expansion instance. |
Definition at line 49 of file xlat_inst.c.
|
static |
Destructor for xlat_inst_t.
Calls detach method if provided by xlat expansion
Definition at line 180 of file xlat_inst.c.
|
static |
Definition at line 631 of file xlat_inst.c.
|
static |
Callback for creating "ephemeral" instance data for a xlat_exp_t.
[in] | node | to create "ephemeral" instance data for. |
[in] | uctx | event list passed to xlat thread instantiation functions. |
Definition at line 300 of file xlat_inst.c.
|
static |
Compare two thread instances based on node pointer.
[in] | one | First thread specific xlat expansion instance. |
[in] | two | Second thread specific xlat expansion instance. |
Definition at line 62 of file xlat_inst.c.
|
static |
Destructor for xlat_thread_inst_t.
Calls thread_detach method if provided by xlat expansion
Definition at line 77 of file xlat_inst.c.
int xlat_finalize | ( | xlat_exp_head_t * | head, |
fr_event_list_t * | runtime_el | ||
) |
Bootstrap static xlats, or instantiate ephemeral ones.
[in] | head | of xlat tree to create instance data for. |
[in] | runtime_el | determines whether we do ephemeral or static instantiation. If NULL, we perform static instantiation, otherwise will perform ephemeral instantiation passing the el to the instantiation functions. |
Definition at line 695 of file xlat_inst.c.
|
static |
Allocate instance data for an xlat expansion.
[in] | node | to allocate instance data for. |
Definition at line 214 of file xlat_inst.c.
|
inlinestatic |
Create instance data for "permanent" xlats.
[in] | head | of xlat tree to create instance data for. Will walk the entire tree registering all the xlat function calls for later instantiation. |
Definition at line 656 of file xlat_inst.c.
int xlat_instance_register_func | ( | xlat_exp_t * | node | ) |
Callback for creating "permanent" instance data for a xlat_exp_t.
This function records the xlat_exp_t requiring instantiation but does not call the instantiation function. This is to allow for a clear separation between the module instantiation phase and the xlat instantiation phase.
[in] | node | to create "permanent" instance data for. |
Definition at line 595 of file xlat_inst.c.
int xlat_instance_unregister_func | ( | xlat_exp_t * | node | ) |
Remove a node from the list of xlat instance data.
[in] | node | to remove instance data for. |
Definition at line 550 of file xlat_inst.c.
void xlat_instances_free | ( | void | ) |
Walk over all registered instance data and free them explicitly.
This must be called before any modules or xlats are deregistered/unloaded and before the mainconfig is freed, as the xlat_t need to still exist in order to call the detach functions within them.
Definition at line 709 of file xlat_inst.c.
int xlat_instantiate | ( | void | ) |
Call instantiation functions for all registered, "permanent" xlats.
Should be called after all the permanent xlats have been tokenised/bootstrapped.
Definition at line 513 of file xlat_inst.c.
|
inlinestatic |
Create instance data for "ephemeral" xlats.
[in] | head | of xlat tree to create instance data for. |
[in] | el | event list used to run any instantiate data |
Definition at line 377 of file xlat_inst.c.
|
static |
Initialise the xlat instance data code.
Definition at line 499 of file xlat_inst.c.
void xlat_thread_detach | ( | void | ) |
Destroy any thread specific xlat instances.
Definition at line 489 of file xlat_inst.c.
|
static |
Create thread instances where needed.
[in] | ctx | to allocate thread instance data in. |
[in] | el | event list to register I/O handlers against. |
[in] | xi | to allocate thread-instance data for. |
Definition at line 105 of file xlat_inst.c.
xlat_thread_inst_t* xlat_thread_instance_find | ( | xlat_exp_t const * | node | ) |
Retrieve xlat/thread specific instance data.
[in] | node | to find thread specific data for. |
Definition at line 407 of file xlat_inst.c.
int xlat_thread_instantiate | ( | TALLOC_CTX * | ctx, |
fr_event_list_t * | el | ||
) |
Create thread specific instance tree and create thread instances.
This should be called directly after the modules_thread_instantiate() function.
Memory will be freed automatically when the thread exits.
[in] | ctx | to bind instance tree lifetime to. Must not be shared between multiple threads. |
[in] | el | Event list to pass to all thread instantiation functions. |
Definition at line 444 of file xlat_inst.c.
return |
Definition at line 483 of file xlat_inst.c.
|
static |
Holds instance data created by xlat_instantiate.
Definition at line 37 of file xlat_inst.c.
|
static |
Holds thread specific instance data created by xlat_instantiate.
Definition at line 41 of file xlat_inst.c.