The FreeRADIUS server $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
Loading...
Searching...
No Matches
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: c2602112ad32b10db4063b129bcf0e1cc5321559 $
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 */
26RCSIDH(trigger_h, "$Id: c2602112ad32b10db4063b129bcf0e1cc5321559 $")
27
28#ifdef __cplusplus
29extern "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
39/** Common values used by modules when building trigger args
40 *
41 */
42typedef struct {
43 char const *module; //!< Module name
44 char const *name; //!< Instance name
45 char const *server; //!< Server name / IP
46 uint16_t port; //!< Server port
48
49int trigger_init(CONF_SECTION const *cs);
50
51int trigger(unlang_interpret_t *intp, CONF_SECTION const *cs, CONF_PAIR **trigger_cp,
52 char const *name, bool rate_limit, fr_pair_list_t *args) CC_HINT(nonnull(4));
53
54bool trigger_enabled(void);
55
56void trigger_args_afrom_server(TALLOC_CTX *ctx, fr_pair_list_t *list, char const *server, uint16_t port);
57
58int module_trigger_args_build(TALLOC_CTX *ctx, fr_pair_list_t *list, CONF_SECTION *cs,
59 module_trigger_args_t *args) CC_HINT(nonnull(1,2,4));
60
61typedef int (*fr_trigger_worker_t)(request_t *request, module_method_t process, void *ctx);
62
63#ifdef __cplusplus
64}
65#endif
va_list args
Definition acutest.h:770
#define RCSIDH(h, id)
Definition build.h:486
Configuration AVP similar to a fr_pair_t.
Definition cf_priv.h:70
A section grouping multiple CONF_PAIR.
Definition cf_priv.h:101
unsigned short uint16_t
static char const * name
unlang_action_t(* module_method_t)(unlang_result_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:421
int trigger_init(CONF_SECTION const *cs)
Definition trigger.c:613
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.
Definition trigger.c:493
int(* fr_trigger_worker_t)(request_t *request, module_method_t process, void *ctx)
Definition trigger.h:61
char const *char const * name
< Module name
Definition trigger.h:44
uint16_t port
Server port.
Definition trigger.h:46
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.
Definition trigger.c:150
char const * server
Server name / IP.
Definition trigger.h:45
bool trigger_enabled(void)
Return whether triggers are enabled.
Definition trigger.c:95
Common values used by modules when building trigger args.
Definition trigger.h:42
int nonnull(2, 5))