The FreeRADIUS server  $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
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: 355147a2ddfbe4f42b8922a104c0106acd186f3c $
19  *
20  * @file unlang/return.c
21  * @brief Unlang "return" keyword evaluation.
22  *
23  * @copyright 2006-2019 The FreeRADIUS server project
24  */
25 RCSID("$Id: 355147a2ddfbe4f42b8922a104c0106acd186f3c $")
26 
27 #include "unlang_priv.h"
28 #include "return_priv.h"
29 
31 {
32  RDEBUG2("%s", unlang_ops[frame->instruction->type].name);
33 
34  *p_result = frame->result;
35 
36  /*
37  * Stop at the next return point, or if we hit
38  * the a top frame.
39  */
40  return unwind_to_return(request->stack);
41 }
42 
44 {
46  &(unlang_op_t){
47  .name = "return",
48  .interpret = unlang_return,
49  });
50 }
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:444
void unlang_register(int type, unlang_op_t *op)
Register an operation with the interpreter.
Definition: base.c:65
unlang_op_t unlang_ops[UNLANG_TYPE_MAX]
Different operations the interpreter can execute.
Definition: base.c:33
#define RDEBUG2(fmt,...)
Definition: radclient.h:54
rlm_rcode_t
Return codes indicating the result of the module call.
Definition: rcode.h:40
unlang_action_t unlang_return(rlm_rcode_t *p_result, request_t *request, unlang_stack_frame_t *frame)
Definition: return.c:30
void unlang_return_init(void)
Definition: return.c:43
Declarations for the "return" keyword, used to implement other keywords.
static unlang_action_t unwind_to_return(unlang_stack_t *stack)
Definition: unlang_priv.h:376
@ UNLANG_TYPE_RETURN
Return statement.
Definition: unlang_priv.h:71
unlang_t const * instruction
The unlang node we're evaluating.
Definition: unlang_priv.h:289
rlm_rcode_t result
The result from executing the instruction.
Definition: unlang_priv.h:308
char const * name
Name of the operation.
Definition: unlang_priv.h:215
unlang_type_t type
The specialisation of this node.
Definition: unlang_priv.h:127
An unlang operation.
Definition: unlang_priv.h:214
Our interpreter stack, as distinct from the C stack.
Definition: unlang_priv.h:288