The FreeRADIUS server  $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
detach.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: 8f69e1813622c059c62a4b5db59ec9eda6f70461 $
19  *
20  * @file unlang/detach.c
21  * @brief Unlang detach keyword
22  *
23  * @copyright 2021 Arran Cudbard-Bell (a.cudbardb@freeradius.org)
24  */
25 RCSID("$Id: 8f69e1813622c059c62a4b5db59ec9eda6f70461 $")
26 
27 #include "unlang_priv.h"
28 
29 /** Signal a child to detach
30  *
31  */
33 {
34  /*
35  * Signal all frames in the child's stack
36  * that it's time to detach.
37  */
38  unlang_interpret_signal(request, FR_SIGNAL_DETACH);
39 
40  /*
41  * Detach failed...
42  */
43  if (unlikely(request->parent != NULL)) {
44  *p_result = RLM_MODULE_FAIL;
46  }
47 
49 }
50 
51 /** Initialise subrequest ops
52  *
53  */
55 {
57  &(unlang_op_t){
58  .name = "detach",
59  .interpret = unlang_detach,
60  });
61 }
unlang_action_t
Returned by unlang_op_t calls, determine the next action of the interpreter.
Definition: action.h:35
@ UNLANG_ACTION_CALCULATE_RESULT
Calculate a new section rlm_rcode_t value.
Definition: action.h:37
#define RCSID(id)
Definition: build.h:444
#define unlikely(_x)
Definition: build.h:378
#define UNUSED
Definition: build.h:313
void unlang_detach_init(void)
Initialise subrequest ops.
Definition: detach.c:54
static unlang_action_t unlang_detach(rlm_rcode_t *p_result, request_t *request, UNUSED unlang_stack_frame_t *frame)
Signal a child to detach.
Definition: detach.c:32
void unlang_interpret_signal(request_t *request, fr_signal_t action)
Send a signal (usually stop) to a request.
Definition: interpret.c:1184
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
@ RLM_MODULE_FAIL
Module failed, don't reply.
Definition: rcode.h:42
@ UNLANG_TYPE_DETACH
detach a child
Definition: unlang_priv.h:75
An unlang operation.
Definition: unlang_priv.h:214
Our interpreter stack, as distinct from the C stack.
Definition: unlang_priv.h:288