The FreeRADIUS server  $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
trigger.h
Go to the documentation of this file.
1 #pragma once
2 /*
3  * This program is free software; you can redistribute it and/or modify
4  * it under the terms of the GNU General Public License as published by
5  * the Free Software Foundation; either version 2 of the License, or
6  * (at your option) any later version.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program; if not, write to the Free Software
15  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
16  */
17 
18 /**
19  * $Id: d8b65a15ae0437afcbb8709266207e15944d0577 $
20  *
21  * @file lib/server/trigger.h
22  * @brief Execute scripts when a server event occurs.
23  *
24  * @copyright 2015 The FreeRADIUS server project
25  */
26 RCSIDH(trigger_h, "$Id: d8b65a15ae0437afcbb8709266207e15944d0577 $")
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
32 #include <freeradius-devel/server/cf_util.h>
33 #include <freeradius-devel/server/module.h>
34 #include <freeradius-devel/server/request.h>
35 #include <freeradius-devel/unlang/interpret.h>
36 #include <freeradius-devel/util/pair.h>
37 #include <freeradius-devel/util/talloc.h>
38 
40 
41 xlat_action_t trigger_xlat(TALLOC_CTX *ctx, fr_dcursor_t *out,
42  UNUSED xlat_ctx_t const *xctx,
43  request_t *request, fr_value_box_list_t *in);
44 
45 int trigger_exec_init(CONF_SECTION const *cs);
46 
48  CONF_SECTION const *cs, char const *name, bool rate_limit, fr_pair_list_t *args)
49  CC_HINT(nonnull(3));
50 
51 void trigger_exec_free(void);
52 
53 bool trigger_enabled(void);
54 
55 void trigger_args_afrom_server(TALLOC_CTX *ctx, fr_pair_list_t *list, char const *server, uint16_t port);
56 
57 typedef int (*fr_trigger_worker_t)(request_t *request, module_method_t process, void *ctx);
58 
59 #ifdef __cplusplus
60 }
61 #endif
va_list args
Definition: acutest.h:770
#define RCSIDH(h, id)
Definition: build.h:445
#define UNUSED
Definition: build.h:313
A section grouping multiple CONF_PAIR.
Definition: cf_priv.h:89
static fr_slen_t in
Definition: dict.h:645
unsigned short uint16_t
Definition: merged_model.c:31
static char const * name
unlang_action_t(* module_method_t)(rlm_rcode_t *p_result, module_ctx_t const *mctx, request_t *request)
Module section callback.
Definition: module.h:69
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.
Definition: trigger.c:501
void trigger_exec_free(void)
Free trigger resources.
Definition: trigger.c:173
xlat_arg_parser_t const trigger_xlat_args[]
Definition: trigger.c:56
int trigger_exec_init(CONF_SECTION const *cs)
Set the global trigger section trigger_exec will search in, and register xlats.
Definition: trigger.c:143
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.
Definition: trigger.c:280
int(* fr_trigger_worker_t)(request_t *request, module_method_t process, void *ctx)
Definition: trigger.h:57
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: trigger.c:64
bool trigger_enabled(void)
Return whether triggers are enabled.
Definition: trigger.c:182
xlat_action_t
Definition: xlat.h:35
Definition for a single argument consumend by an xlat function.
Definition: xlat.h:145
int nonnull(2, 5))
static size_t char ** out
Definition: value.h:984
An xlat calling ctx.
Definition: xlat_ctx.h:42