The FreeRADIUS server $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
Loading...
Searching...
No Matches
group.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: ee000c5b2885557a10899caa60e23720a148f551 $
19 *
20 * @file unlang/group.c
21 * @brief Unlang "group" keyword evaluation.
22 *
23 * @copyright 2006-2019 The FreeRADIUS server project
24 */
25RCSID("$Id: ee000c5b2885557a10899caa60e23720a148f551 $")
26
27#include <freeradius-devel/server/rcode.h>
28#include "unlang_priv.h"
29#include "group_priv.h"
30
35
37{
38 return unlang_group(result, request, frame);
39}
40
41
48
50{
52
53 if (!cf_item_next(cs, NULL)) return UNLANG_IGNORE;
54
56 return NULL;
57 }
58
59 if (cf_section_name2(cs) != NULL) {
60 cf_log_warn(cs, "Ignoring name for 'redundant' section");
61 }
62
64}
65
66
68{
70 .name = "group",
71 .type = UNLANG_TYPE_GROUP,
73
74 .compile = unlang_compile_group,
75 .interpret = unlang_group,
76
77 .unlang_size = sizeof(unlang_group_t),
78 .unlang_name = "unlang_group_t",
79 });
80
82 .name = "redundant",
85
86 .compile = unlang_compile_redundant,
87 .interpret = unlang_group,
88
89 .unlang_size = sizeof(unlang_group_t),
90 .unlang_name = "unlang_group_t",
91 });
92
94 .name = "policy",
95 .type = UNLANG_TYPE_POLICY,
97
98 .interpret = unlang_policy,
99
100 .unlang_size = sizeof(unlang_group_t),
101 .unlang_name = "unlang_group_t",
102 });
103}
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:485
#define UNUSED
Definition build.h:317
Common header for all CONF_* types.
Definition cf_priv.h:49
A section grouping multiple CONF_PAIR.
Definition cf_priv.h:101
char const * cf_section_name2(CONF_SECTION const *cs)
Return the second identifier of a CONF_SECTION.
Definition cf_util.c:1184
char const * cf_section_name1(CONF_SECTION const *cs)
Return the second identifier of a CONF_SECTION.
Definition cf_util.c:1170
CONF_SECTION * cf_item_to_section(CONF_ITEM const *ci)
Cast a CONF_ITEM to a CONF_SECTION.
Definition cf_util.c:683
#define cf_item_next(_parent, _curr)
Definition cf_util.h:92
#define cf_log_warn(_cf, _fmt,...)
Definition cf_util.h:290
unlang_t * unlang_compile_section(unlang_t *parent, unlang_compile_ctx_t *unlang_ctx, CONF_SECTION *cs, unlang_type_t type)
Definition compile.c:1547
bool unlang_compile_limit_subsection(CONF_SECTION *cs, char const *name)
Definition compile.c:1627
static unlang_t * unlang_compile_redundant(unlang_t *parent, unlang_compile_ctx_t *unlang_ctx, CONF_ITEM const *ci)
Definition group.c:49
static unlang_t * unlang_compile_group(unlang_t *parent, unlang_compile_ctx_t *unlang_ctx, CONF_ITEM const *ci)
Definition group.c:42
unlang_action_t unlang_group(UNUSED unlang_result_t *p_result, request_t *request, UNUSED unlang_stack_frame_t *frame)
Definition group.c:31
void unlang_group_init(void)
Definition group.c:67
static unlang_action_t unlang_policy(unlang_result_t *result, request_t *request, unlang_stack_frame_t *frame)
Definition group.c:36
Declarations for the "group" keyword.
unlang_action_t unlang_interpret_push_children(unlang_result_t *p_result, request_t *request, rlm_rcode_t default_rcode, bool do_next_sibling)
Push the children of the current frame onto a new frame onto the stack.
Definition interpret.c:389
static TALLOC_CTX * unlang_ctx
Definition base.c:71
void unlang_register(unlang_op_t *op)
Register an operation with the interpreter.
Definition base.c:56
@ RLM_MODULE_NOT_SET
Error resolving rcode (should not be returned by modules).
Definition rcode.h:52
Private interpreter structures and functions.
#define UNLANG_NEXT_SIBLING
Definition unlang_priv.h:98
#define UNLANG_IGNORE
@ UNLANG_TYPE_GROUP
Grouping section.
Definition unlang_priv.h:49
@ UNLANG_TYPE_POLICY
Policy section.
Definition unlang_priv.h:78
@ UNLANG_TYPE_REDUNDANT
exactly like group, but with different default return codes
Definition unlang_priv.h:50
@ UNLANG_OP_FLAG_RETURN_POINT
Return point.
@ UNLANG_OP_FLAG_DEBUG_BRACES
Print debug braces.
@ UNLANG_OP_FLAG_INTERNAL
it's not a real keyword
Generic representation of a grouping.
An unlang operation.
A node in a graph of unlang_op_t (s) that we execute.
Our interpreter stack, as distinct from the C stack.
static fr_slen_t parent
Definition pair.h:839