The FreeRADIUS server  $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
caller.c
Go to the documentation of this file.
1 /*
2  * This program 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
5  * (at 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: d9b3394996f080906142045c97e9db864f90bdb4 $
19  *
20  * @file unlang/caller.c
21  * @brief Unlang "caller" keyword evaluation. Used for setting allowed parent protocols
22  *
23  * @copyright 2020 The FreeRADIUS server project
24  * @copyright 2021 Arran Cudbard-Bell <a.cudbardb@freeradius.org>
25  */
26 RCSID("$Id: d9b3394996f080906142045c97e9db864f90bdb4 $")
27 
28 #include <freeradius-devel/server/state.h>
29 
30 #include "caller_priv.h"
31 #include "group_priv.h"
32 
34 {
37 
38  fr_assert(g->num_children > 0); /* otherwise the compilation is broken */
39 
40  /*
41  * No parent, or the dictionaries don't match. Ignore it.
42  */
43  if (!request->parent || (request->parent->dict != gext->dict)) {
44  RDEBUG2("...");
46  }
47 
48  /*
49  * The dictionary matches. Go recurse into its' children.
50  */
51  return unlang_group(p_result, request, frame);
52 }
53 
54 
56 {
58  &(unlang_op_t){
59  .name = "caller",
60  .interpret = unlang_caller,
61  .debug_braces = true
62  });
63 }
unlang_action_t
Returned by unlang_op_t calls, determine the next action of the interpreter.
Definition: action.h:35
@ UNLANG_ACTION_EXECUTE_NEXT
Execute the next unlang_t.
Definition: action.h:38
#define RCSID(id)
Definition: build.h:444
static unlang_action_t unlang_caller(rlm_rcode_t *p_result, request_t *request, unlang_stack_frame_t *frame)
Definition: caller.c:33
void unlang_caller_init(void)
Definition: caller.c:55
fr_dict_t const * dict
Definition: caller_priv.h:34
static unlang_caller_t * unlang_group_to_caller(unlang_group_t *g)
Cast a group structure to the caller keyword extension.
Definition: caller_priv.h:40
unlang_action_t unlang_group(rlm_rcode_t *p_result, request_t *request, unlang_stack_frame_t *frame)
Definition: group.c:30
Declarations for the "group" keyword.
void unlang_register(int type, unlang_op_t *op)
Register an operation with the interpreter.
Definition: base.c:65
#define RDEBUG2(fmt,...)
Definition: radclient.h:54
rlm_rcode_t
Return codes indicating the result of the module call.
Definition: rcode.h:40
fr_assert(0)
static unlang_group_t * unlang_generic_to_group(unlang_t const *p)
Definition: unlang_priv.h:539
@ UNLANG_TYPE_CALLER
conditionally check parent dictionary type
Definition: unlang_priv.h:77
unlang_t const * instruction
The unlang node we're evaluating.
Definition: unlang_priv.h:289
Generic representation of a grouping.
Definition: unlang_priv.h:155
An unlang operation.
Definition: unlang_priv.h:214
Our interpreter stack, as distinct from the C stack.
Definition: unlang_priv.h:288