The FreeRADIUS server $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
Loading...
Searching...
No Matches
Typedefs | Functions | Variables
trigger.h File Reference

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>
+ Include dependency graph for trigger.h:

Go to the source code of this file.

Typedefs

typedef int(* fr_trigger_worker_t) (request_t *request, module_method_t process, void *ctx)
 

Functions

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_exec (unlang_interpret_t *intp, CONF_SECTION const *cs, char const *name, bool rate_limit, fr_pair_list_t *args))
 Execute a trigger - call an executable to process an event.
 
int trigger_exec_init (CONF_SECTION const *cs)
 
xlat_action_t trigger_xlat (TALLOC_CTX *ctx, fr_dcursor_t *out, UNUSED xlat_ctx_t const *xctx, request_t *request, fr_value_box_list_t *in)
 Retrieve attributes from a special trigger list.
 

Variables

xlat_arg_parser_t const trigger_xlat_args []
 

Detailed Description

Execute scripts when a server event occurs.

Id
5756656992b38b8e2fafae15a4c98e3fabf0d82f

Definition in file trigger.h.

Typedef Documentation

◆ fr_trigger_worker_t

typedef int(* fr_trigger_worker_t) (request_t *request, module_method_t process, void *ctx)

Definition at line 55 of file trigger.h.

Function Documentation

◆ trigger_args_afrom_server()

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.

Note
trigger_exec_init must be called before calling this function, else it will return NULL.
Parameters
[in]ctxto allocate fr_pair_t s in.
[out]listto append Pool-Server and Pool-Port pairs to
[in]serverwe're connecting to.
[in]porton that server.

Definition at line 466 of file trigger.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ trigger_enabled()

bool trigger_enabled ( void  )

Return whether triggers are enabled.

Definition at line 130 of file trigger.c.

+ Here is the caller graph for this function:

◆ trigger_exec()

int trigger_exec ( unlang_interpret_t intp,
CONF_SECTION const *  cs,
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 raqddb/triggers.conf or in the trigger section of a module, and can be created with one call to trigger_exec().

The trigger_exec function expands the configuration item, and runs the given function (exec, sql insert, etc.) asynchronously, allowing the server to keep processing packets while the action is being taken.

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.

Note
Calls to this function will be ignored if trigger_exec_init has not been called.
Parameters
[in]intpInterpreter to run the trigger with. If this is NULL the trigger will be executed synchronously.
[in]csto 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]namethe path relative to the global trigger section ending in the trigger name e.g. module.ldap.pool.start.
[in]rate_limitwhether to rate limit triggers.
[in]argsto make available via the
%trigger(<arg>) 
xlat.
Returns
  • 0 on success.
  • -1 on failure.

Definition at line 179 of file trigger.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ trigger_exec_init()

int trigger_exec_init ( CONF_SECTION const *  cs)

Definition at line 549 of file trigger.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ trigger_xlat()

xlat_action_t trigger_xlat ( TALLOC_CTX *  ctx,
fr_dcursor_t out,
UNUSED xlat_ctx_t const *  xctx,
request_t request,
fr_value_box_list_t *  in 
)

Retrieve attributes from a special trigger list.

Definition at line 69 of file trigger.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ trigger_xlat_args

xlat_arg_parser_t const trigger_xlat_args[]
extern

Definition at line 61 of file trigger.c.