The FreeRADIUS server $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
Loading...
Searching...
No Matches
rlm_test.c
Go to the documentation of this file.
1/*
2 * This program is is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License as published by
4 * the Free Software Foundation; either version 2 of the License, or (at
5 * your option) any later version.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software
14 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
15 */
16
17/**
18 * $Id: eccb66f05f93abafb37ab0976679786f3102c624 $
19 * @file rlm_test.c
20 * @brief test module code.
21 *
22 * @copyright 2013 The FreeRADIUS server project
23 * @copyright 2013 your name (email@example.org)
24 */
25RCSID("$Id: eccb66f05f93abafb37ab0976679786f3102c624 $")
26
27#define LOG_PREFIX mctx->mi->name
28
29#include <freeradius-devel/server/base.h>
30#include <freeradius-devel/server/module_rlm.h>
31#include <freeradius-devel/util/debug.h>
32#include <freeradius-devel/unlang/xlat_func.h>
33
34/*
35 * Define a structure for our module configuration.
36 *
37 * These variables do not need to be in a structure, but it's
38 * a lot cleaner to do so, and a pointer to the structure can
39 * be used as the instance handle.
40 */
41typedef struct {
44 char const *string;
45 char const **string_m;
46
47 bool boolean;
48 bool *boolean_m;
49
52
55
58
60
63
66
68
70
73
76
79
81 /*
82 * clang correctly performs type compatibility checks between
83 * arrays with a specific length, but for pointers to pointers
84 * to arrays of specific length
85 * (which is what FR_TYPE_CONF_CHECK receives) the check doesn't
86 * seem to work.
87 *
88 * So the "multi" variants of ethernet and ifid buffers, must
89 * be a **.
90 */
94
96 /*
97 * See above...
98 */
100
101 int32_t int32;
102 int32_t *int32_m;
103
104 uint64_t uint64;
105 uint64_t *uint64_m;
106
109} rlm_test_t;
110
111typedef struct {
113 pthread_t value;
115
116/*
117 * A mapping of configuration file names to internal variables.
118 */
119static const conf_parser_t module_config[] = {
120 { FR_CONF_OFFSET("tmpl", rlm_test_t, tmpl), .dflt = "Tmp-String-0", .quote = T_BARE_WORD },
121 { FR_CONF_OFFSET("tmpl_m", rlm_test_t, tmpl_m), .dflt = "Tmp-String-0", .quote = T_DOUBLE_QUOTED_STRING },
122
123 { FR_CONF_OFFSET("string", rlm_test_t, string) },
124 { FR_CONF_OFFSET("string_m", rlm_test_t, string_m) },
125
126 { FR_CONF_OFFSET("boolean", rlm_test_t, boolean), .dflt = "no" },
127 { FR_CONF_OFFSET("boolean_m", rlm_test_t, boolean_m), .dflt = "no" },
128
129 { FR_CONF_OFFSET("integer", rlm_test_t, integer), .dflt = "1" },
130 { FR_CONF_OFFSET_FLAGS("integer_m" , CONF_FLAG_MULTI, rlm_test_t, integer_m), .dflt = "2" },
131
132 { FR_CONF_OFFSET_TYPE_FLAGS("ipv4_addr", FR_TYPE_IPV4_ADDR, 0, rlm_test_t, ipv4_addr), .dflt = "*" },
133 { FR_CONF_OFFSET_TYPE_FLAGS("ipv4_addr_m", FR_TYPE_IPV4_ADDR, CONF_FLAG_MULTI, rlm_test_t, ipv4_addr_m), .dflt = "*" },
134
135 { FR_CONF_OFFSET_TYPE_FLAGS("ipv4_prefix", FR_TYPE_IPV4_PREFIX, 0, rlm_test_t, ipv4_prefix), .dflt = "192.168.0.1/24" },
136 { FR_CONF_OFFSET_TYPE_FLAGS("ipv4_prefix_m", FR_TYPE_IPV4_PREFIX, CONF_FLAG_MULTI, rlm_test_t, ipv4_prefix_m), .dflt = "192.168.0.1/24" },
137
138 { FR_CONF_OFFSET_TYPE_FLAGS("ipv6_addr", FR_TYPE_IPV6_ADDR, 0, rlm_test_t, ipv6_addr), .dflt = "*" },
139 { FR_CONF_OFFSET_TYPE_FLAGS("ipv6_addr_m", FR_TYPE_IPV6_ADDR, CONF_FLAG_MULTI, rlm_test_t, ipv6_addr_m), .dflt = "*" },
140
141 { FR_CONF_OFFSET_TYPE_FLAGS("ipv6_prefix", FR_TYPE_IPV6_PREFIX, 0, rlm_test_t, ipv6_prefix), .dflt = "::1/128" },
142 { FR_CONF_OFFSET_TYPE_FLAGS("ipv6_prefix_m", FR_TYPE_IPV6_PREFIX, CONF_FLAG_MULTI, rlm_test_t, ipv6_prefix_m), .dflt = "::1/128" },
143
144 { FR_CONF_OFFSET_TYPE_FLAGS("combo", FR_TYPE_COMBO_IP_ADDR, 0, rlm_test_t, combo_ipaddr), .dflt = "::1/128" },
145 { FR_CONF_OFFSET_TYPE_FLAGS("combo_m", FR_TYPE_COMBO_IP_ADDR, CONF_FLAG_MULTI, rlm_test_t, combo_ipaddr_m), .dflt = "::1/128" },
146
147 { FR_CONF_OFFSET("date", rlm_test_t, date) },
148 { FR_CONF_OFFSET("date_m", rlm_test_t, date_m) },
149
150 { FR_CONF_OFFSET("octets", rlm_test_t, octets) },
151 { FR_CONF_OFFSET("octets_m", rlm_test_t, octets_m) },
152
153 { FR_CONF_OFFSET("bytes", rlm_test_t, byte) },
154 { FR_CONF_OFFSET("bytes_m", rlm_test_t, byte_m) },
155
156 { FR_CONF_OFFSET("ifid", rlm_test_t, ifid) },
157 { FR_CONF_OFFSET("ifid_m", rlm_test_t, ifid_m) },
158
159 { FR_CONF_OFFSET("short", rlm_test_t, shortint) },
160 { FR_CONF_OFFSET("short_m", rlm_test_t, shortint_m) },
161
162 { FR_CONF_OFFSET("ethernet", rlm_test_t, ethernet) },
163 { FR_CONF_OFFSET("ethernet_m", rlm_test_t, ethernet_m) },
164
165 { FR_CONF_OFFSET("signed", rlm_test_t, int32) },
166 { FR_CONF_OFFSET("signed_m", rlm_test_t, int32_m) },
167
168 { FR_CONF_OFFSET("uint64", rlm_test_t, uint64) },
169 { FR_CONF_OFFSET("uint64_m", rlm_test_t, uint64_m) },
170
171 { FR_CONF_OFFSET("time_delta", rlm_test_t, time_delta) },
172 { FR_CONF_OFFSET("time_delta_t", rlm_test_t, time_delta_m) },
173
175};
176
177static fr_dict_t const *dict_radius;
178
181 { .out = &dict_radius, .proto = "radius" },
183};
184
186
189 { .out = &attr_user_name, .name = "User-Name", .type = FR_TYPE_STRING, .dict = &dict_radius },
191};
192
193/*
194 * Find the named user in this modules database. Create the set
195 * of attribute-value pairs to check and reply with for this user
196 * from the database. The authentication code only needs to check
197 * the password, the rest is done here.
198 */
199static unlang_action_t CC_HINT(nonnull) mod_authorize(unlang_result_t *p_result, module_ctx_t const *mctx, request_t *request)
200{
201 rlm_test_thread_t *t = mctx->thread;
202
203 RINFO("RINFO message");
204 RDEBUG("RDEBUG message");
205 RDEBUG2("RDEBUG2 message");
206
207 RWARN("RWARN message");
208 RWDEBUG("RWDEBUG message");
209 RWDEBUG("RWDEBUG2 message");
210
211 /*
212 * Should appear wavy
213 */
214 RERROR("RERROR error message");
215 RINDENT();
216 REDEBUG("RDEBUG error message");
217 REXDENT();
218 REDEBUG2("RDEBUG2 error message");
219 RINDENT();
220 REDEBUG3("RDEBUG3 error message");
221 REXDENT();
222 REDEBUG4("RDEBUG4 error message");
223
224 if (!fr_cond_assert(t->value == pthread_self())) RETURN_UNLANG_FAIL;
225
227}
228
229/*
230 * Authenticate the user with the given password.
231 */
232static unlang_action_t CC_HINT(nonnull) mod_authenticate(unlang_result_t *p_result, module_ctx_t const *mctx, UNUSED request_t *request)
233{
234 rlm_test_thread_t *t = mctx->thread;
235
236 if (!fr_cond_assert(t->value == pthread_self())) RETURN_UNLANG_FAIL;
237
239}
240
241/*
242 * Massage the request before recording it or proxying it
243 */
244static unlang_action_t CC_HINT(nonnull) mod_preacct(unlang_result_t *p_result, module_ctx_t const *mctx, UNUSED request_t *request)
245{
246 rlm_test_thread_t *t = mctx->thread;
247
248 if (!fr_cond_assert(t->value == pthread_self())) RETURN_UNLANG_FAIL;
249
251}
252
253/*
254 * Write accounting information to this modules database.
255 */
256static unlang_action_t CC_HINT(nonnull) mod_accounting(unlang_result_t *p_result, module_ctx_t const *mctx, UNUSED request_t *request)
257{
258 rlm_test_thread_t *t = mctx->thread;
259
260 if (!fr_cond_assert(t->value == pthread_self())) RETURN_UNLANG_FAIL;
261
263}
264
265/*
266 * Write accounting information to this modules database.
267 */
268static unlang_action_t CC_HINT(nonnull) mod_return(unlang_result_t *p_result, UNUSED module_ctx_t const *mctx, UNUSED request_t *request)
269{
271}
272
273static void mod_retry_signal(module_ctx_t const *mctx, request_t *request, fr_signal_t action);
274
275/** Continue after marked runnable
276 *
277 */
279{
280 RDEBUG("Test called main retry handler - that's a failure");
281
283}
284
285/** Continue after FR_SIGNAL_RETRY
286 *
287 */
289{
290 RDEBUG("Test retry");
291
292 return unlang_module_yield(request, mod_retry_resume, mod_retry_signal, 0, NULL);
293}
294
295/** Continue after FR_SIGNAL_TIMEOUT
296 *
297 */
299{
300 RDEBUG("Test timed out as expected");
301
303}
304
305static void mod_retry_signal(UNUSED module_ctx_t const *mctx, request_t *request, fr_signal_t action)
306{
307 switch (action) {
308 case FR_SIGNAL_RETRY:
309 RDEBUG("Test retry");
312 break;
313
315 RDEBUG("Test timeout");
318 break;
319
320 /*
321 * Ignore all other signals.
322 */
323 default:
324 break;
325 }
326
327}
328
329/*
330 * Test retries
331 */
332static unlang_action_t CC_HINT(nonnull) mod_retry(UNUSED unlang_result_t *p_result, UNUSED module_ctx_t const *mctx, request_t *request)
333{
334 return unlang_module_yield(request, mod_retry_resume, mod_retry_signal, 0, NULL);
335}
336
337
339 { .required = true, .single = true, .type = FR_TYPE_STRING },
341};
342
343
344/** Run a trigger (useful for testing)
345 *
346 */
348 UNUSED xlat_ctx_t const *xctx, request_t *request,
349 fr_value_box_list_t *in)
350{
351 fr_value_box_t *in_head = fr_value_box_list_head(in);
352 fr_value_box_t *vb;
353
354 if (trigger(unlang_interpret_get(request), NULL, NULL, in_head->vb_strvalue, false, NULL) < 0) {
355 RPEDEBUG("Running trigger failed");
356 return XLAT_ACTION_FAIL;
357 }
358
359 MEM(vb = fr_value_box_alloc(ctx, FR_TYPE_BOOL, NULL));
361 vb->vb_bool = true;
362
363 return XLAT_ACTION_DONE;
364}
365
366
368 { .required = true, .concat = true, .type = FR_TYPE_STRING },
369 { .variadic = XLAT_ARG_VARIADIC_EMPTY_KEEP, .concat = true, .type = FR_TYPE_STRING },
371};
372
373
374/** Run a generic xlat (useful for testing)
375 *
376 * This just copies the input to the output.
377 */
379 UNUSED xlat_ctx_t const *xctx, UNUSED request_t *request,
380 fr_value_box_list_t *in)
381{
382 fr_value_box_t *vb;
383
385 MEM(vb = fr_value_box_alloc(ctx, FR_TYPE_STRING, NULL));
386
387 if (unlikely(fr_value_box_copy(vb, vb, vb_p) < 0)) {
388 talloc_free(vb);
389 return XLAT_ACTION_FAIL;
390 }
391
393 }
394
395 return XLAT_ACTION_DONE;
396}
397
398
400 { .required = false, .concat = true, .type = FR_TYPE_STRING },
402};
403
404
405/** Always return XLAT_ACTION_FAIL
406 */
408 UNUSED xlat_ctx_t const *xctx, UNUSED request_t *request,
409 UNUSED fr_value_box_list_t *in)
410{
411 return XLAT_ACTION_FAIL;
412}
413
414
415/** Always return a NULL value-box
416 */
418 UNUSED xlat_ctx_t const *xctx, UNUSED request_t *request,
419 UNUSED fr_value_box_list_t *in)
420{
421 fr_value_box_t *vb;
422
423 MEM(vb = fr_value_box_alloc(ctx, FR_TYPE_NULL, NULL));
425
426 return XLAT_ACTION_DONE;
427}
428
430{
431 rlm_test_t *inst = talloc_get_type_abort(mctx->mi->data, rlm_test_t);
432 rlm_test_thread_t *t = talloc_get_type_abort(mctx->thread, rlm_test_thread_t);
433
434 t->inst = inst;
435 t->value = pthread_self();
436 INFO("Performing instantiation for thread %p (ctx %p)", (void *)t->value, t);
437
438 return 0;
439}
440
442{
443 rlm_test_thread_t *t = talloc_get_type_abort(mctx->thread, rlm_test_thread_t);
444
445 INFO("Performing detach for thread %p", (void *)t->value);
446
447 if (!fr_cond_assert(t->value == pthread_self())) return -1;
448
449 return 0;
450}
451
452/*
453 * Do any per-module bootstrapping that is separate to each
454 * configured instance of the module. e.g. set up connections
455 * to external databases, read configuration files, set up
456 * dictionary entries, etc.
457 *
458 * If configuration information is given in the config section
459 * that must be referenced in later calls, store a handle to it
460 * in *instance otherwise put a null pointer there.
461 */
462static int mod_bootstrap(module_inst_ctx_t const *mctx)
463{
464 rlm_test_t const *inst = talloc_get_type_abort(mctx->mi->data, rlm_test_t);
465 xlat_t *xlat;
466
467 /*
468 * Log some messages
469 */
470 INFO("Informational message");
471 WARN("Warning message");
472 ERROR("Error message");
473 DEBUG("Debug message");
474 DEBUG2("Debug2 message");
475 DEBUG3("Debug3 message");
476 DEBUG4("Debug4 message");
477
478 /*
479 * Output parsed tmpls
480 */
481 if (inst->tmpl) {
482 INFO("%s", inst->tmpl->name);
483 } else {
484 INFO("inst->tmpl is NULL");
485 }
486
487 if (inst->tmpl_m) {
488 talloc_foreach(inst->tmpl_m, item) INFO("%s", item->name);
489 } else {
490 INFO("inst->tmpl_m is NULL");
491 }
492
493 if (!(xlat = module_rlm_xlat_register(mctx->mi->boot, mctx, "passthrough", test_xlat_passthrough, FR_TYPE_VOID))) return -1;
495
496 if (!(xlat = module_rlm_xlat_register(mctx->mi->boot, mctx, "fail", test_xlat_fail, FR_TYPE_VOID))) return -1;
498
499 if (!module_rlm_xlat_register(mctx->mi->boot, mctx, "null", test_xlat_null, FR_TYPE_VOID)) return -1;
500
501 return 0;
502}
503
504static int mod_load(void)
505{
506 xlat_t *xlat;
507
508 if (!(xlat = xlat_func_register(NULL, "test_trigger", trigger_test_xlat, FR_TYPE_BOOL))) return -1;
510
511 return 0;
512}
513
514static void mod_unload(void)
515{
516 xlat_func_unregister("test_trigger");
517}
518
519/*
520 * The module name should be the only globally exported symbol.
521 * That is, everything else should be 'static'.
522 *
523 * If the module needs to temporarily modify it's instantiation
524 * data, the type should be changed to MODULE_TYPE_THREAD_UNSAFE.
525 * The server will then take care of ensuring that the module
526 * is single-threaded.
527 */
530 .common = {
531 .magic = MODULE_MAGIC_INIT,
532 .name = "test",
534 .inst_size = sizeof(rlm_test_t),
535 .thread_inst_size = sizeof(rlm_test_thread_t),
536 .config = module_config,
537 .bootstrap = mod_bootstrap,
538 .onload = mod_load,
539 .unload = mod_unload,
540 .thread_instantiate = mod_thread_instantiate,
541 .thread_detach = mod_thread_detach
542 },
543 .method_group = {
544 .bindings = (module_method_binding_t[]){
545 { .section = SECTION_NAME("accounting", CF_IDENT_ANY), .method = mod_accounting },
546 { .section = SECTION_NAME("authenticate", CF_IDENT_ANY), .method = mod_authenticate },
547 { .section = SECTION_NAME("authorize", CF_IDENT_ANY), .method = mod_authorize },
548
549 { .section = SECTION_NAME("name1_null", NULL), .method = mod_return },
550
551 { .section = SECTION_NAME("recv", "Access-Challenge"), .method = mod_return },
552 { .section = SECTION_NAME("recv", "Accounting-Request"), .method = mod_preacct },
553 { .section = SECTION_NAME("recv", CF_IDENT_ANY), .method = mod_authorize },
554
555 { .section = SECTION_NAME("retry", NULL), .method = mod_retry },
556 { .section = SECTION_NAME("send", CF_IDENT_ANY), .method = mod_return },
557
559 }
560 }
561};
unlang_action_t
Returned by unlang_op_t calls, determine the next action of the interpreter.
Definition action.h:35
#define RCSID(id)
Definition build.h:506
#define unlikely(_x)
Definition build.h:402
#define UNUSED
Definition build.h:336
#define CONF_PARSER_TERMINATOR
Definition cf_parse.h:657
#define FR_CONF_OFFSET(_name, _struct, _field)
conf_parser_t which parses a single CONF_PAIR, writing the result to a field in a struct
Definition cf_parse.h:280
fr_token_t quote
Quoting around the default value. Only used for templates.
Definition cf_parse.h:649
#define FR_CONF_OFFSET_FLAGS(_name, _flags, _struct, _field)
conf_parser_t which parses a single CONF_PAIR, writing the result to a field in a struct
Definition cf_parse.h:268
@ CONF_FLAG_MULTI
CONF_PAIR can have multiple copies.
Definition cf_parse.h:446
#define FR_CONF_OFFSET_TYPE_FLAGS(_name, _type, _flags, _struct, _field)
conf_parser_t which parses a single CONF_PAIR, writing the result to a field in a struct
Definition cf_parse.h:238
Defines a CONF_PAIR to C data type mapping.
Definition cf_parse.h:594
#define CF_IDENT_ANY
Definition cf_util.h:75
static int fr_dcursor_append(fr_dcursor_t *cursor, void *v)
Insert a single item at the end of the list.
Definition dcursor.h:406
#define fr_cond_assert(_x)
Calls panic_action ifndef NDEBUG, else logs error and evaluates to value of _x.
Definition debug.h:141
#define MEM(x)
Definition debug.h:46
#define ERROR(fmt,...)
Definition dhcpclient.c:40
#define DEBUG(fmt,...)
Definition dhcpclient.c:38
fr_dict_attr_t const ** out
Where to write a pointer to the resolved fr_dict_attr_t.
Definition dict.h:292
fr_dict_t const ** out
Where to write a pointer to the loaded/resolved fr_dict_t.
Definition dict.h:305
#define DICT_AUTOLOAD_TERMINATOR
Definition dict.h:311
static fr_slen_t in
Definition dict.h:882
Specifies an attribute which must be present for the module to function.
Definition dict.h:291
Specifies a dictionary which must be loaded/loadable for the module to function.
Definition dict.h:304
#define MODULE_MAGIC_INIT
Stop people using different module/library/server versions together.
Definition dl_module.h:63
talloc_free(hp)
Struct to represent an ethernet address.
Definition inet.h:44
Struct to represent an interface id.
Definition inet.h:53
IPv4/6 prefix.
unlang_interpret_t * unlang_interpret_get(request_t *request)
Get the interpreter set for a request.
Definition interpret.c:2043
void unlang_interpret_mark_runnable(request_t *request)
Mark a request as resumable.
Definition interpret.c:1636
#define REXDENT()
Exdent (unindent) R* messages by one level.
Definition log.h:455
#define DEBUG3(_fmt,...)
Definition log.h:266
#define RWDEBUG(fmt,...)
Definition log.h:373
#define REDEBUG3(fmt,...)
Definition log.h:385
#define RWARN(fmt,...)
Definition log.h:309
#define RERROR(fmt,...)
Definition log.h:310
#define DEBUG4(_fmt,...)
Definition log.h:267
#define RINFO(fmt,...)
Definition log.h:308
#define RPEDEBUG(fmt,...)
Definition log.h:388
#define REDEBUG2(fmt,...)
Definition log.h:384
#define REDEBUG4(fmt,...)
Definition log.h:386
#define RINDENT()
Indent R* messages by one level.
Definition log.h:442
static void * item(fr_lst_t const *lst, fr_lst_index_t idx)
Definition lst.c:121
unsigned short uint16_t
@ FR_TYPE_IPV4_ADDR
32 Bit IPv4 Address.
@ FR_TYPE_IPV6_PREFIX
IPv6 Prefix.
@ FR_TYPE_STRING
String of printable characters.
@ FR_TYPE_NULL
Invalid (uninitialised) attribute type.
@ FR_TYPE_IPV6_ADDR
128 Bit IPv6 Address.
@ FR_TYPE_IPV4_PREFIX
IPv4 Prefix.
@ FR_TYPE_VOID
User data.
@ FR_TYPE_BOOL
A truth value.
@ FR_TYPE_COMBO_IP_ADDR
IPv4 or IPv6 address depending on length.
unsigned int uint32_t
unsigned char uint8_t
void * thread
Thread specific instance data.
Definition module_ctx.h:43
void * thread
Thread instance data.
Definition module_ctx.h:67
module_instance_t const * mi
Instance of the module being instantiated.
Definition module_ctx.h:64
module_instance_t * mi
Instance of the module being instantiated.
Definition module_ctx.h:51
Temporary structure to hold arguments for module calls.
Definition module_ctx.h:41
Temporary structure to hold arguments for instantiation calls.
Definition module_ctx.h:50
Temporary structure to hold arguments for thread_instantiation calls.
Definition module_ctx.h:63
xlat_t * module_rlm_xlat_register(TALLOC_CTX *ctx, module_inst_ctx_t const *mctx, char const *name, xlat_func_t func, fr_type_t return_type)
Definition module_rlm.c:247
module_t common
Common fields presented by all modules.
Definition module_rlm.h:39
#define REDEBUG(fmt,...)
#define RDEBUG2(fmt,...)
#define RDEBUG(fmt,...)
#define DEBUG2(fmt,...)
#define WARN(fmt,...)
#define INFO(fmt,...)
Definition radict.c:63
#define RETURN_UNLANG_FAIL
Definition rcode.h:63
#define RETURN_UNLANG_OK
Definition rcode.h:64
static xlat_arg_parser_t const test_xlat_fail_args[]
Definition rlm_test.c:399
static int mod_load(void)
Definition rlm_test.c:504
int32_t int32
Definition rlm_test.c:101
static unlang_action_t mod_preacct(unlang_result_t *p_result, module_ctx_t const *mctx, UNUSED request_t *request)
Definition rlm_test.c:244
tmpl_t * tmpl
Definition rlm_test.c:42
static void mod_retry_signal(module_ctx_t const *mctx, request_t *request, fr_signal_t action)
fr_time_delta_t time_delta
Definition rlm_test.c:107
fr_ipaddr_t * ipv4_addr_m
Definition rlm_test.c:61
static xlat_action_t trigger_test_xlat(TALLOC_CTX *ctx, fr_dcursor_t *out, UNUSED xlat_ctx_t const *xctx, request_t *request, fr_value_box_list_t *in)
Run a trigger (useful for testing)
Definition rlm_test.c:347
fr_ipaddr_t * ipv4_prefix_m
Definition rlm_test.c:62
fr_ipaddr_t ipv6_addr
Definition rlm_test.c:56
fr_time_t * date_m
Definition rlm_test.c:72
fr_ipaddr_t ipaddr
Definition rlm_test.c:69
fr_ipaddr_t * ipv6_addr_m
Definition rlm_test.c:64
fr_ifid_t ifid
Definition rlm_test.c:80
fr_ipaddr_t * combo_ipaddr_m
Definition rlm_test.c:67
fr_ipaddr_t ipv4_addr
Definition rlm_test.c:53
fr_time_delta_t * time_delta_m
Definition rlm_test.c:108
fr_ipaddr_t ipv6_prefix
Definition rlm_test.c:57
static xlat_arg_parser_t const test_xlat_passthrough_args[]
Definition rlm_test.c:367
uint8_t byte
Definition rlm_test.c:77
static fr_dict_t const * dict_radius
Definition rlm_test.c:177
static xlat_arg_parser_t const trigger_test_xlat_args[]
Definition rlm_test.c:338
fr_ipaddr_t combo_ipaddr
Definition rlm_test.c:59
static int mod_bootstrap(module_inst_ctx_t const *mctx)
Definition rlm_test.c:462
static xlat_action_t test_xlat_passthrough(TALLOC_CTX *ctx, fr_dcursor_t *out, UNUSED xlat_ctx_t const *xctx, UNUSED request_t *request, fr_value_box_list_t *in)
Run a generic xlat (useful for testing)
Definition rlm_test.c:378
static unlang_action_t mod_retry(UNUSED unlang_result_t *p_result, UNUSED module_ctx_t const *mctx, request_t *request)
Definition rlm_test.c:332
static unlang_action_t mod_authorize(unlang_result_t *p_result, module_ctx_t const *mctx, request_t *request)
Definition rlm_test.c:199
uint8_t const * octets
Definition rlm_test.c:74
static void mod_unload(void)
Definition rlm_test.c:514
fr_ethernet_t ethernet
Definition rlm_test.c:95
uint32_t integer
Definition rlm_test.c:50
bool * boolean_m
Definition rlm_test.c:48
static unlang_action_t mod_accounting(unlang_result_t *p_result, module_ctx_t const *mctx, UNUSED request_t *request)
Definition rlm_test.c:256
uint8_t * byte_m
Definition rlm_test.c:78
pthread_t value
Definition rlm_test.c:113
char const ** string_m
Definition rlm_test.c:45
fr_dict_autoload_t rlm_test_dict[]
Definition rlm_test.c:180
tmpl_t ** tmpl_m
Definition rlm_test.c:43
bool boolean
Definition rlm_test.c:47
module_rlm_t rlm_test
Definition rlm_test.c:529
uint16_t * shortint_m
Definition rlm_test.c:93
rlm_test_t * inst
Definition rlm_test.c:112
static int mod_thread_instantiate(module_thread_inst_ctx_t const *mctx)
Definition rlm_test.c:429
uint64_t * uint64_m
Definition rlm_test.c:105
fr_ethernet_t * ethernet_m
Definition rlm_test.c:99
fr_dict_attr_autoload_t rlm_test_dict_attr[]
Definition rlm_test.c:188
fr_ifid_t * ifid_m
Definition rlm_test.c:91
fr_ipaddr_t * ipv6_prefix_m
Definition rlm_test.c:65
fr_time_t date
Definition rlm_test.c:71
uint8_t const ** octets_m
Definition rlm_test.c:75
int32_t * int32_m
Definition rlm_test.c:102
char const * string
Definition rlm_test.c:44
static unlang_action_t mod_return(unlang_result_t *p_result, UNUSED module_ctx_t const *mctx, UNUSED request_t *request)
Definition rlm_test.c:268
static fr_dict_attr_t const * attr_user_name
Definition rlm_test.c:185
uint64_t uint64
Definition rlm_test.c:104
static unlang_action_t mod_retry_resume_retry(UNUSED unlang_result_t *p_result, UNUSED module_ctx_t const *mctx, request_t *request)
Continue after FR_SIGNAL_RETRY.
Definition rlm_test.c:288
static xlat_action_t test_xlat_null(TALLOC_CTX *ctx, fr_dcursor_t *out, UNUSED xlat_ctx_t const *xctx, UNUSED request_t *request, UNUSED fr_value_box_list_t *in)
Always return a NULL value-box.
Definition rlm_test.c:417
static const conf_parser_t module_config[]
Definition rlm_test.c:119
static xlat_action_t test_xlat_fail(UNUSED TALLOC_CTX *ctx, UNUSED fr_dcursor_t *out, UNUSED xlat_ctx_t const *xctx, UNUSED request_t *request, UNUSED fr_value_box_list_t *in)
Always return XLAT_ACTION_FAIL.
Definition rlm_test.c:407
uint32_t * integer_m
Definition rlm_test.c:51
fr_ipaddr_t ipv4_prefix
Definition rlm_test.c:54
static int mod_thread_detach(module_thread_inst_ctx_t const *mctx)
Definition rlm_test.c:441
static unlang_action_t mod_retry_resume(unlang_result_t *p_result, UNUSED module_ctx_t const *mctx, request_t *request)
Continue after marked runnable.
Definition rlm_test.c:278
uint16_t shortint
Definition rlm_test.c:92
static unlang_action_t mod_retry_resume_timeout(unlang_result_t *p_result, UNUSED module_ctx_t const *mctx, request_t *request)
Continue after FR_SIGNAL_TIMEOUT.
Definition rlm_test.c:298
static unlang_action_t mod_authenticate(unlang_result_t *p_result, module_ctx_t const *mctx, UNUSED request_t *request)
Definition rlm_test.c:232
#define SECTION_NAME(_name1, _name2)
Define a section name consisting of a verb and a noun.
Definition section.h:39
@ MODULE_TYPE_RETRY
can handle retries
Definition module.h:51
module_flags_t flags
Flags that control how a module starts up and how a module is called.
Definition module.h:236
void * data
Module's instance data.
Definition module.h:293
void * boot
Data allocated during the boostrap phase.
Definition module.h:296
#define MODULE_BINDING_TERMINATOR
Terminate a module binding list.
Definition module.h:152
Named methods exported by a module.
Definition module.h:174
fr_signal_t
Signals that can be generated/processed by request signal handlers.
Definition signal.h:38
@ FR_SIGNAL_RETRY
a retry timer has hit
Definition signal.h:46
@ FR_SIGNAL_TIMEOUT
a retry timeout or max count has hit
Definition signal.h:47
int unlang_module_set_resume(request_t *request, module_method_t resume)
Change the resume function of a module.
Definition module.c:116
unlang_action_t unlang_module_yield(request_t *request, module_method_t resume, unlang_module_signal_t signal, fr_signal_t sigmask, void *rctx)
Yield a request back to the interpreter from within a module.
Definition module.c:431
eap_aka_sim_process_conf_t * inst
#define talloc_foreach(_array, _iter)
Iterate over a talloced array of elements.
Definition talloc.h:72
A time delta, a difference in time measured in nanoseconds.
Definition time.h:80
"server local" time.
Definition time.h:69
@ T_BARE_WORD
Definition token.h:118
@ T_DOUBLE_QUOTED_STRING
Definition token.h:119
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:155
@ XLAT_ARG_VARIADIC_EMPTY_KEEP
Empty argument groups are left alone, and either passed through as empty groups or null boxes.
Definition xlat.h:137
unsigned int required
Argument must be present, and non-empty.
Definition xlat.h:146
#define XLAT_ARG_PARSER_TERMINATOR
Definition xlat.h:170
xlat_action_t
Definition xlat.h:37
@ XLAT_ACTION_FAIL
An xlat function failed.
Definition xlat.h:44
@ XLAT_ACTION_DONE
We're done evaluating this level of nesting.
Definition xlat.h:43
Definition for a single argument consumed by an xlat function.
Definition xlat.h:145
int fr_value_box_copy(TALLOC_CTX *ctx, fr_value_box_t *dst, const fr_value_box_t *src)
Copy value data verbatim duplicating any buffers.
Definition value.c:4379
#define fr_value_box_alloc(_ctx, _type, _enumv)
Allocate a value box of a specific type.
Definition value.h:644
int nonnull(2, 5))
#define fr_value_box_list_foreach(_list_head, _iter)
Definition value.h:224
static size_t char ** out
Definition value.h:1030
An xlat calling ctx.
Definition xlat_ctx.h:49
int xlat_func_args_set(xlat_t *x, xlat_arg_parser_t const args[])
Register the arguments of an xlat.
Definition xlat_func.c:363
xlat_t * xlat_func_register(TALLOC_CTX *ctx, char const *name, xlat_func_t func, fr_type_t return_type)
Register an xlat function.
Definition xlat_func.c:216
void xlat_func_unregister(char const *name)
Unregister an xlat function.
Definition xlat_func.c:516