The FreeRADIUS server  $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
parallel_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: 06c615a810e7f062e57a6e2d71aafcb206e264b6 $
20  *
21  * @file unlang/parallel_priv.h
22  * @brief Declarations for the unlang "parallel" keyword
23  *
24  * Should be moved into parallel.c when the parallel stuff is fully extracted
25  * from interpret.c
26  *
27  * @copyright 2006-2019 The FreeRADIUS server project
28  */
29 #include "unlang_priv.h"
30 
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34 
35 /** Parallel child states
36  *
37  */
38 typedef enum {
39  CHILD_INIT = 0, //!< Initial state.
40  CHILD_RUNNABLE, //!< Running/runnable.
41  CHILD_EXITED, //!< Child has exited
42  CHILD_DETACHED, //!< Child has detached.
43  CHILD_CANCELLED, //!< Child was cancelled.
44  CHILD_DONE //!< The child has completed.
46 
47 /** Each parallel child has a state, and an associated request
48  *
49  */
50 typedef struct {
51  int num; //!< The child number.
52 
53  unlang_parallel_child_state_t state; //!< State of the child.
54  request_t *request; //!< Child request.
55  char *name; //!< Cache the request name.
56  unlang_t const *instruction; //!< broken out of g->children
58 
59 typedef struct {
61  int priority;
62 
63  int num_children; //!< How many children are executing.
64  int num_complete; //!< How many children are complete.
65 
66  bool detach; //!< are we creating the child detached
67  bool clone; //!< are the children cloned
68 
69  unlang_parallel_child_t children[]; //!< Array of children.
71 
72 typedef struct {
74  bool detach; //!< are we creating the child detached
75  bool clone;
77 
78 /** Cast a group structure to the parallel keyword extension
79  *
80  */
82 {
83  return talloc_get_type_abort(g, unlang_parallel_t);
84 }
85 
86 /** Cast a parallel keyword extension to a group structure
87  *
88  */
90 {
91  return (unlang_group_t *)parallel;
92 }
93 
94 #ifdef __cplusplus
95 }
96 #endif
bool detach
are we creating the child detached
Definition: parallel_priv.h:66
char * name
Cache the request name.
Definition: parallel_priv.h:55
int num_complete
How many children are complete.
Definition: parallel_priv.h:64
int num_children
How many children are executing.
Definition: parallel_priv.h:63
request_t * request
Child request.
Definition: parallel_priv.h:54
int num
The child number.
Definition: parallel_priv.h:51
bool clone
are the children cloned
Definition: parallel_priv.h:67
static unlang_group_t * unlang_parallel_to_group(unlang_parallel_t *parallel)
Cast a parallel keyword extension to a group structure.
Definition: parallel_priv.h:89
unlang_t const * instruction
broken out of g->children
Definition: parallel_priv.h:56
bool detach
are we creating the child detached
Definition: parallel_priv.h:74
static unlang_parallel_t * unlang_group_to_parallel(unlang_group_t *g)
Cast a group structure to the parallel keyword extension.
Definition: parallel_priv.h:81
unlang_parallel_child_state_t
Parallel child states.
Definition: parallel_priv.h:38
@ CHILD_RUNNABLE
Running/runnable.
Definition: parallel_priv.h:40
@ CHILD_DETACHED
Child has detached.
Definition: parallel_priv.h:42
@ CHILD_INIT
Initial state.
Definition: parallel_priv.h:39
@ CHILD_EXITED
Child has exited.
Definition: parallel_priv.h:41
@ CHILD_CANCELLED
Child was cancelled.
Definition: parallel_priv.h:43
@ CHILD_DONE
The child has completed.
Definition: parallel_priv.h:44
unlang_group_t group
Definition: parallel_priv.h:73
unlang_parallel_child_state_t state
State of the child.
Definition: parallel_priv.h:53
Each parallel child has a state, and an associated request.
Definition: parallel_priv.h:50
static size_t parallel
Definition: radclient-ng.c:79
rlm_rcode_t
Return codes indicating the result of the module call.
Definition: rcode.h:40
Private interpreter structures and functions.
Generic representation of a grouping.
Definition: unlang_priv.h:155
A node in a graph of unlang_op_t (s) that we execute.
Definition: unlang_priv.h:122