The FreeRADIUS server $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
Loading...
Searching...
No Matches
return.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: ae05160c089f63c657858195fb31a9572e26b645 $
19 *
20 * @file unlang/return.c
21 * @brief Unlang "return" keyword evaluation.
22 *
23 * @copyright 2006-2019 The FreeRADIUS server project
24 */
25RCSID("$Id: ae05160c089f63c657858195fb31a9572e26b645 $")
26
27#include "unlang_priv.h"
28#include "return_priv.h"
29
31{
32 RDEBUG2("%s", unlang_ops[frame->instruction->type].name);
33
34 /*
35 * As we're unwinding intermediary frames we
36 * won't be taking their rcodes or priorities
37 * into account. We do however want to record
38 * the current section rcode.
39 */
40 *p_result = frame->section_result;
41
42 /*
43 * Stop at the next return point, or if we hit
44 * the a top frame.
45 */
46 return unwind_to_op_flag(NULL, request->stack, UNLANG_OP_FLAG_RETURN_POINT);
47}
48
50{
52 &(unlang_op_t){
53 .name = "return",
54 .interpret = unlang_return,
55 });
56}
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
void unlang_register(int type, unlang_op_t *op)
Register an operation with the interpreter.
Definition base.c:63
unlang_op_t unlang_ops[UNLANG_TYPE_MAX]
Different operations the interpreter can execute.
Definition base.c:31
#define RDEBUG2(fmt,...)
Definition radclient.h:54
void unlang_return_init(void)
Definition return.c:49
unlang_action_t unlang_return(unlang_result_t *p_result, request_t *request, unlang_stack_frame_t *frame)
Definition return.c:30
Declarations for the "return" keyword, used to implement other keywords.
unlang_result_t section_result
The aggregate result of executing all siblings in this section.
static unlang_action_t unwind_to_op_flag(unsigned int *depth_p, unlang_stack_t *stack, unlang_op_flag_t flag)
Mark the entire stack as cancelled.
@ UNLANG_TYPE_RETURN
Return statement.
Definition unlang_priv.h:63
unlang_t const * instruction
The unlang node we're evaluating.
char const * name
Name of the operation.
@ UNLANG_OP_FLAG_RETURN_POINT
Return point.
unlang_type_t type
The specialisation of this node.
An unlang operation.
Our interpreter stack, as distinct from the C stack.