![]() |
The FreeRADIUS server $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
|
Execute scripts when a server event occurs. More...
#include <freeradius-devel/server/cf_util.h>
#include <freeradius-devel/server/module.h>
#include <freeradius-devel/server/request.h>
#include <freeradius-devel/unlang/interpret.h>
#include <freeradius-devel/util/pair.h>
#include <freeradius-devel/util/talloc.h>
Go to the source code of this file.
Data Structures | |
struct | module_trigger_args_t |
Common values used by modules when building trigger args. More... | |
Typedefs | |
typedef int(* | fr_trigger_worker_t) (request_t *request, module_method_t process, void *ctx) |
Functions | |
int | module_trigger_args_build (TALLOC_CTX *ctx, fr_pair_list_t *list, CONF_SECTION *cs, module_trigger_args_t *args)) |
Build trigger args pair list for modules. | |
int | trigger (unlang_interpret_t *intp, CONF_SECTION const *cs, CONF_PAIR **trigger_cp, char const *name, bool rate_limit, fr_pair_list_t *args)) |
Execute a trigger - call an executable to process an event. | |
void | trigger_args_afrom_server (TALLOC_CTX *ctx, fr_pair_list_t *list, char const *server, uint16_t port) |
Create trigger arguments to describe the server the pool connects to. | |
bool | trigger_enabled (void) |
Return whether triggers are enabled. | |
int | trigger_init (CONF_SECTION const *cs) |
Execute scripts when a server event occurs.
Definition in file trigger.h.
struct module_trigger_args_t |
typedef int(* fr_trigger_worker_t) (request_t *request, module_method_t process, void *ctx) |
int module_trigger_args_build | ( | TALLOC_CTX * | ctx, |
fr_pair_list_t * | list, | ||
CONF_SECTION * | cs, | ||
module_trigger_args_t * | args | ||
) |
Build trigger args pair list for modules.
[in] | ctx | to allocate pairs in. |
[in] | list | to populate. |
[in] | cs | CONF_SECTION to search for a "trigger_args" section |
[in] | args | Common module data which will populate default pairs |
Definition at line 499 of file trigger.c.
int trigger | ( | unlang_interpret_t * | intp, |
CONF_SECTION const * | cs, | ||
CONF_PAIR ** | trigger_cp, | ||
char const * | name, | ||
bool | rate_limit, | ||
fr_pair_list_t * | args | ||
) |
Execute a trigger - call an executable to process an event.
A trigger ties a state change (e.g. connection up) in a module to an action (e.g. send an SNMP trap) defined in raddb/triggers.conf or in the trigger section of a module. There's no setup for triggers, the triggering code just calls this function with the name of the trigger to run, and an optional interpreter if the trigger should run asynchronously.
If no interpreter is passed in, the trigger runs synchronously, which is useful when the server is shutting down and we want to ensure that the trigger has completed before the server exits.
If an interpreter is passed in, the trigger runs asynchronously in that interpreter, allowing the server to continue processing packets while the trigger runs.
The name of each trigger is based on the module or portion of the server which runs the trigger, and is usually taken from the state when the module has a state change.
Triggers are separate from logs, because log messages are generally informational, are not time sensitive, and usually require log files to be parsed and filtered in order to find relevant information.
In contrast, triggers are something specific which the administrator needs to be notified about immediately and can't wait to post-process a log file.
[in] | intp | Interpreter to run the trigger with. If this is NULL the trigger will be executed synchronously. |
[in] | cs | to search for triggers in. If cs is not NULL, the portion after the last '.' in name is used for the trigger. If cs is NULL, the entire name is used to find the trigger in the global trigger section. |
[in,out] | trigger_cp | Optional pointer to a CONF_PAIR pointer. If populated and the pointer is not NULL, this CONF_PAIR will be used rather than searching. If populated, and the pointer is NULL, the search will happen and the pointer will be populated with the found CONF_PAIR. |
[in] | name | the path relative to the global trigger section ending in the trigger name e.g. module.ldap.pool.start. |
[in] | rate_limit | whether to rate limit triggers. |
[in] | args | to populate the trigger's request list with. |
Definition at line 156 of file trigger.c.
void trigger_args_afrom_server | ( | TALLOC_CTX * | ctx, |
fr_pair_list_t * | list, | ||
char const * | server, | ||
uint16_t | port | ||
) |
Create trigger arguments to describe the server the pool connects to.
[in] | ctx | to allocate fr_pair_t s in. |
[out] | list | to append Pool-Server and Pool-Port pairs to |
[in] | server | we're connecting to. |
[in] | port | on that server. |
Definition at line 427 of file trigger.c.
bool trigger_enabled | ( | void | ) |
int trigger_init | ( | CONF_SECTION const * | cs | ) |