The FreeRADIUS server $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
Loading...
Searching...
No Matches
child_request_priv.h
Go to the documentation of this file.
1#pragma once
2/*
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2, or (at your option)
6 * any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software Foundation,
15 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 */
17
18/**
19 * $Id: b7b89dc455086274fe556521b946b50826afd80d $
20 *
21 * @file unlang/subrequest_child_priv.h
22 *
23 * @copyright 2021 Arran Cudbard-Bell (a.cudbardb@freeradius.org)
24 */
25#include <freeradius-devel/server/request.h>
26
27#ifdef __cplusplus
28extern "C" {
29#endif
30
31
32/** Parallel child states
33 *
34 */
35typedef enum {
36 CHILD_INIT = 0, //!< Initial state, has no request allocated.
37
38 CHILD_RUNNABLE, //!< Running/runnable. The request is currently
39 ///< running, or is yielded but runnable.
40 CHILD_EXITED, //!< Child has run to completion, and is waiting
41 ///< to be reaped.
42 CHILD_DETACHED, //!< Child has detached, we can't signal it or
43 ///< communicate with it anymore. It will be freed
44 ///< by the interpreter when it completes.
45 CHILD_CANCELLED, //!< Child was cancelled. The request is still
46 ///< available, but the result from it should not
47 ///< be used and it should be free by the parent.
48 CHILD_DONE, //!< The child has been processed by the parent
49 ///< the request should still exist, and should be freed.
50
51 CHILD_FREED //!< The child has been freed. The request is no
52 ///< longer available, and should not be used.
53 ///< this is mostly for debugging purposes.
55
58
59/** Each child has a state, a number, a request, and a count of their siblings
60 */
61typedef struct {
62 char const *name; //!< Cache the request name.
63 int num; //!< The child number.
64 request_t *request; //!< Child request. The actual request the child will run.
65
66 unlang_child_request_state_t state; //!< State of the child.
67
68 unsigned int *sibling_count; //!< Number of siblings.
69 ///< as a child completes, it decrements this number.
70 ///< once it reaches zero, the parent is signalled
71 ///< to resume.
72
73 struct {
74 void const *session_unique_ptr; //!< Session unique ptr identifier. If not NULL, the child's
75 ///< session data will be stored in the parent, and be restored
76 ///< during a later request.
77 bool free_child;
79
80 struct {
81 rlm_rcode_t rcode; //!< Where to store the result of the child.
82 rlm_rcode_t *p_result; //!< If not NULL, write the rcode here too.
83 int priority; //!< Priority of the highest frame on the stack of the child.
84 } result;
86
88 rlm_rcode_t *p_result, unsigned int *sibling_count, void const *unique_session_ptr, bool free_child);
89
91
92#ifdef __cplusplus
93}
94#endif
request_t * request
Child request. The actual request the child will run.
int unlang_child_request_op_init(void)
fr_table_num_ordered_t const unlang_child_states_table[]
char const * name
Cache the request name.
unlang_child_request_state_t state
State of the child.
unsigned int * sibling_count
Number of siblings.
unlang_child_request_state_t
Parallel child states.
@ CHILD_RUNNABLE
Running/runnable.
@ CHILD_DETACHED
Child has detached, we can't signal it or communicate with it anymore.
@ CHILD_INIT
Initial state, has no request allocated.
@ CHILD_EXITED
Child has run to completion, and is waiting to be reaped.
@ CHILD_CANCELLED
Child was cancelled.
@ CHILD_FREED
The child has been freed.
@ CHILD_DONE
The child has been processed by the parent the request should still exist, and should be freed.
int unlang_child_request_init(TALLOC_CTX *ctx, unlang_child_request_t *out, request_t *child, rlm_rcode_t *p_result, unsigned int *sibling_count, void const *unique_session_ptr, bool free_child)
Initialize a child request.
int num
The child number.
size_t unlang_child_states_table_len
Each child has a state, a number, a request, and a count of their siblings.
static const conf_parser_t config[]
Definition base.c:183
rlm_rcode_t
Return codes indicating the result of the module call.
Definition rcode.h:40
An element in an arbitrarily ordered array of name to num mappings.
Definition table.h:57
static size_t char ** out
Definition value.h:1020