The FreeRADIUS server  $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
try.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: 434fc14ffc6fc50064d63b9394de81246444547f $
19  *
20  * @file unlang/try.c
21  * @brief Unlang "try" keyword evaluation.
22  *
23  * @copyright 2023 Network RADIUS SAS (legal@networkradius.com)
24  */
25 RCSID("$Id: 434fc14ffc6fc50064d63b9394de81246444547f $")
26 
27 #include "unlang_priv.h"
28 #include "catch_priv.h"
29 
31 {
32  /*
33  * When this frame finishes, jump ahead to the appropriate "catch".
34  *
35  * All of the magic is done in the compile phase.
36  */
38 
39  return unlang_interpret_push_children(p_result, request, frame->result, UNLANG_NEXT_SIBLING);
40 }
41 
42 void unlang_try_init(void)
43 {
45  &(unlang_op_t){
46  .name = "try",
47  .interpret = unlang_try,
48  .debug_braces = true
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
unlang_action_t unlang_interpret_skip_to_catch(rlm_rcode_t *p_result, request_t *request, unlang_stack_frame_t *frame)
Skip ahead to a particular "catch" instruction.
Definition: catch.c:87
Declarations for the "catch" keyword.
unlang_action_t unlang_interpret_push_children(rlm_rcode_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:243
void unlang_register(int type, unlang_op_t *op)
Register an operation with the interpreter.
Definition: base.c:65
rlm_rcode_t
Return codes indicating the result of the module call.
Definition: rcode.h:40
static unlang_action_t unlang_try(rlm_rcode_t *p_result, request_t *request, unlang_stack_frame_t *frame)
Definition: try.c:30
void unlang_try_init(void)
Definition: try.c:42
#define UNLANG_NEXT_SIBLING
Definition: unlang_priv.h:103
@ UNLANG_TYPE_TRY
try / catch blocks
Definition: unlang_priv.h:81
static void frame_repeat(unlang_stack_frame_t *frame, unlang_process_t process)
Mark the current stack frame up for repeat, and set a new process function.
Definition: unlang_priv.h:526
rlm_rcode_t result
The result from executing the instruction.
Definition: unlang_priv.h:308
An unlang operation.
Definition: unlang_priv.h:214
Our interpreter stack, as distinct from the C stack.
Definition: unlang_priv.h:288