yumapro  20.10-12
YumaPro SDK
runstack.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2008 - 2012, Andy Bierman, All Rights Reserved.
3  * Copyright (c) 2012 - 2021, YumaWorks, Inc., All Rights Reserved.
4  *
5  * Unless required by applicable law or agreed to in writing,
6  * software distributed under the License is distributed on an
7  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
8  * KIND, either express or implied. See the License for the
9  * specific language governing permissions and limitations
10  * under the License.
11  */
12 #ifndef _H_runstack
13 #define _H_runstack
14 
15 /* FILE: runstack.h
16 *********************************************************************
17 * *
18 * P U R P O S E *
19 * *
20 *********************************************************************/
21 
28 /*********************************************************************
29 * *
30 * C H A N G E H I S T O R Y *
31 * *
32 *********************************************************************
33 
34 date init comment
35 ----------------------------------------------------------------------
36 22-aug-07 abb Begun; split from ncxcli.c
37 24-apr-10 abb Redesign to use dynamic memory,
38  allow recursion, and support multiple
39  concurrent contexts
40 26-apr-10 abb added conditional cmd and loop support
41 */
42 
43 #ifndef _H_dlq
44 #include "dlq.h"
45 #endif
46 
47 #ifndef _H_status
48 #include "status.h"
49 #endif
50 
51 #ifndef _H_val
52 #include "val.h"
53 #endif
54 
55 #ifdef __cplusplus
56 extern "C" {
57 #endif
58 
59 /********************************************************************
60 * *
61 * C O N S T A N T S *
62 * *
63 *********************************************************************/
64 
65 
78 #define RUNSTACK_MAX_PARMS 9
79 
80 
84 #define RUNSTACK_MAX_NEST 512
85 
89 #define RUNSTACK_MAX_LOOP 65535
90 
91 
92 /********************************************************************
93 * *
94 * T Y P E S *
95 * *
96 *********************************************************************/
97 
99 typedef enum runstack_src_t_ {
104 } runstack_src_t;
105 
106 
108 typedef enum runstack_condtype_t_ {
112 } runstack_condtype_t;
113 
114 
116 typedef enum runstack_ifstate_t_ {
121 } runstack_ifstate_t;
122 
123 
125 typedef enum runstack_loopstate_t_ {
129 } runstack_loopstate_t;
130 
131 
139 } runstack_queue_type_t;
140 
141 
143 typedef struct runstack_ifcb_t_ {
144  runstack_ifstate_t ifstate;
145  boolean parentcond;
146  boolean startcond;
147  boolean curcond;
148  boolean ifused;
149 } runstack_ifcb_t;
150 
151 
153 typedef struct runstack_line_t_ {
154  dlq_hdr_t qhdr;
155  xmlChar *line;
156 } runstack_line_t;
157 
158 
160 typedef struct runstack_loopcb_t_ {
162  uint32 maxloops;
163 
165  uint32 loop_count;
166 
168  runstack_loopstate_t loop_state;
169 
171  boolean startcond;
172 
175 
177  val_value_t *docroot;
178 
183 
189  runstack_line_t *first_line;
190 
192  runstack_line_t *cur_line;
193 
195  runstack_line_t *last_line;
196 
198  boolean empty_block;
199 
201  dlq_hdr_t lineQ;
202 } runstack_loopcb_t;
203 
204 
206 typedef struct runstack_condcb_t_ {
208  dlq_hdr_t qhdr;
209 
211  runstack_condtype_t cond_type;
212 
214  union u_ {
215  runstack_loopcb_t loopcb;
216  runstack_ifcb_t ifcb;
217  } u;
218 } runstack_condcb_t;
219 
220 
226 typedef struct runstack_entry_t_ {
227  dlq_hdr_t qhdr;
230  uint32 level;
231 
233  FILE *fp;
234 
236  xmlChar *source;
237 
239  xmlChar *buff;
240 
242  int bufflen;
243 
245  uint32 linenum;
246  dlq_hdr_t parmQ;
247  dlq_hdr_t varQ;
248  dlq_hdr_t condcbQ;
249 } runstack_entry_t;
250 
251 
256 typedef struct runstack_context_t_ {
258  boolean cond_state;
259 
261  boolean script_cancel;
262 
264  uint32 script_level;
265 
268 
270  runstack_src_t cur_src;
271 
273  dlq_hdr_t runstackQ;
276  dlq_hdr_t globalQ;
279  dlq_hdr_t zeroQ;
282  dlq_hdr_t zero_condcbQ;
285  dlq_hdr_t *sessionQ;
288  dlq_hdr_t *groupQ;
289 } runstack_context_t;
290 
291 
292 /********************************************************************
293 * *
294 * F U N C T I O N S *
295 * *
296 *********************************************************************/
297 
298 
305 extern uint32
306  runstack_level (runstack_context_t *rcxt);
307 
308 
323 extern status_t
324  runstack_push (runstack_context_t *rcxt,
325  const xmlChar *source,
326  FILE *fp);
327 
334 extern void
335  runstack_pop (runstack_context_t *rcxt);
336 
337 
353 extern xmlChar *
354  runstack_get_cmd (runstack_context_t *rcxt,
355  status_t *res);
356 
357 
363 extern void
364  runstack_cancel (runstack_context_t *rcxt);
365 
366 
372 extern void
373  runstack_clear_cancel (runstack_context_t *rcxt);
374 
375 
384 extern dlq_hdr_t *
385  runstack_get_que (runstack_context_t *rcxt,
386  runstack_queue_type_t quetype);
387 
388 
395 extern dlq_hdr_t *
396  runstack_get_parm_que (runstack_context_t *rcxt);
397 
398 
404 extern void
405  runstack_init (void);
406 
407 
413 extern void
414  runstack_cleanup (void);
415 
416 
422 extern void
423  runstack_clean_context (runstack_context_t *rcxt);
424 
425 
431 extern void
432  runstack_free_context (runstack_context_t *rcxt);
433 
434 
440 extern void
441  runstack_init_context (runstack_context_t *rcxt);
442 
443 
449 extern runstack_context_t *
450  runstack_new_context (void);
451 
452 
458 extern void
459  runstack_session_cleanup (runstack_context_t *rcxt);
460 
461 
467 extern runstack_src_t
468  runstack_get_source (runstack_context_t *rcxt);
469 
470 
478 extern status_t
479  runstack_save_line (runstack_context_t *rcxt,
480  const xmlChar *line);
481 
482 
501 extern xmlChar *
502  runstack_get_loop_cmd (runstack_context_t *rcxt,
503  status_t *res);
504 
505 
513 extern boolean
514  runstack_get_cond_state (runstack_context_t *rcxt);
515 
516 
540 extern status_t
541  runstack_handle_while (runstack_context_t *rcxt,
542  uint32 maxloops,
543  struct xpath_pcb_t_ *xpathpcb,
544  val_value_t *docroot);
545 
546 
556 extern status_t
557  runstack_handle_if (runstack_context_t *rcxt,
558  boolean startcond);
559 
560 
570 extern status_t
571  runstack_handle_elif (runstack_context_t *rcxt,
572  boolean startcond);
573 
574 
581 extern status_t
582  runstack_handle_else (runstack_context_t *rcxt);
583 
584 
591 extern status_t
592  runstack_handle_end (runstack_context_t *rcxt);
593 
594 
603 extern boolean
604  runstack_get_if_used (runstack_context_t *rcxt);
605 
606 
614 extern void
615  runstack_set_sessionQ (runstack_context_t *rcxt,
616  dlq_hdr_t *sessionQ);
617 
618 
626 extern void
627  runstack_set_groupQ (runstack_context_t *rcxt,
628  dlq_hdr_t *groupQ);
629 
630 
634 #ifdef __cplusplus
635 } /* end extern 'C' */
636 #endif
637 
638 #endif /* _H_runstack */
runstack_set_groupQ
void runstack_set_groupQ(runstack_context_t *rcxt, dlq_hdr_t *groupQ)
Set the current group-specific variable Q.
Definition: runstack.c:1967
runstack_context_t_::cur_src
runstack_src_t cur_src
current input source
Definition: runstack.h:270
runstack_ifstate_t_
runstack_ifstate_t_
keep track of the if,elif,else,end sequence
Definition: runstack.h:116
xml_strlen
uint32 xml_strlen(const xmlChar *str)
Get the String len for xmlChar.
Definition: xml_util.c:1406
runstack_loopcb_t_::last_line
runstack_line_t * last_line
last line for loop processing
Definition: runstack.h:195
RUNSTACK_IF_IF
@ RUNSTACK_IF_IF
if state
Definition: runstack.h:118
runstack_get_if_used
boolean runstack_get_if_used(runstack_context_t *rcxt)
Check if the run context, which should be inside an if-stmt now, has used the 'true' block already.
Definition: runstack.c:1913
RUNSTACK_MAX_NEST
#define RUNSTACK_MAX_NEST
this is an arbitrary max to limit resources and run-away scripts that are called recursively
Definition: runstack.h:84
var_set_move
status_t var_set_move(runstack_context_t *rcxt, const xmlChar *name, uint32 namelen, var_type_t vartype, val_value_t *value)
Find and set (or create a new) global user variable.
Definition: var.c:1416
runstack_context_t_::sessionQ
dlq_hdr_t * sessionQ
session variables for this runstack
Definition: runstack.h:285
xpath_free_pcb
void xpath_free_pcb(xpath_pcb_t *pcb)
Free a malloced XPath parser control block.
Definition: xpath.c:2963
runstack_queue_type_t_
runstack_queue_type_t_
different queues of variables for que selection
Definition: runstack.h:133
xml_strdup
xmlChar * xml_strdup(const xmlChar *copyFrom)
String duplicate for xmlChar.
Definition: xml_util.c:1553
runstack_new_context
runstack_context_t * runstack_new_context(void)
Malloc and init a new runstack context.
Definition: runstack.c:1131
runstack_loopcb_t_::cur_line
runstack_line_t * cur_line
current line for loop processing
Definition: runstack.h:192
runstack_src_t_
runstack_src_t_
identify the runstack input source
Definition: runstack.h:99
runstack_entry_t_::source
xmlChar * source
filespec for input
Definition: runstack.h:236
runstack_loopstate_t_
runstack_loopstate_t_
keep track of the while,end sequence
Definition: runstack.h:125
runstack_loopcb_t_::empty_block
boolean empty_block
true if empty command block
Definition: runstack.h:198
RUNSTACK_QUE_LOCAL
@ RUNSTACK_QUE_LOCAL
local variables
Definition: runstack.h:135
log_error
void log_error(const char *fstr,...) __attribute__((format(printf
Generate a new LOG_DEBUG_ERROR log entry.
RUNSTACK_LOOP_COLLECTING
@ RUNSTACK_LOOP_COLLECTING
collecting loop commands
Definition: runstack.h:127
val.h
Value Node Basic Support.
xml_util.h
XML Utilities.
runstack_handle_if
status_t runstack_handle_if(runstack_context_t *rcxt, boolean startcond)
Handle the if command for the specific runstack context.
Definition: runstack.c:1628
RUNSTACK_IF_ELIF
@ RUNSTACK_IF_ELIF
elif state
Definition: runstack.h:119
var_free
void var_free(ncx_var_t *var)
Free a ncx_var_t struct.
Definition: var.c:1148
var_cvt_generic
void var_cvt_generic(dlq_hdr_t *varQ)
Cleanup after a yangcli session has ended.
Definition: var.c:2683
xpath_cvt_boolean
boolean xpath_cvt_boolean(const xpath_result_t *result)
Convert an XPath result to a boolean answer.
Definition: xpath.c:3630
runstack_loopcb_t_::docroot
val_value_t * docroot
document root for XPath expression
Definition: runstack.h:177
runstack_init
void runstack_init(void)
Initialize this module.
Definition: runstack.c:1000
runstack_ifcb_t_::parentcond
boolean parentcond
parent condition
Definition: runstack.h:145
runstack.h
CLI run stack manager.
runstack_get_loop_cmd
xmlChar * runstack_get_loop_cmd(runstack_context_t *rcxt, status_t *res)
Get the next command during loop processing.
Definition: runstack.c:1294
runstack_context_t_::groupQ
dlq_hdr_t * groupQ
group variables for this runstack
Definition: runstack.h:288
ERR_NCX_READ_FAILED
@ ERR_NCX_READ_FAILED
240
Definition: status_enum.h:279
runstack_entry_t_::parmQ
dlq_hdr_t parmQ
Q of ncx_var_t.
Definition: runstack.h:246
runstack_cancel
void runstack_cancel(runstack_context_t *rcxt)
Cancel all running scripts.
Definition: runstack.c:873
dlq_lastEntry
#define dlq_lastEntry(listP)
get the last entry in the queue list
Definition: dlq.h:352
ncxconst.h
Contains NCX constants.
runstack_entry_t_
one script run level context entry each time a 'run script' command is encountered,...
Definition: runstack.h:226
runstack_cleanup
void runstack_cleanup(void)
Cleanup this module.
Definition: runstack.c:1016
runstack_entry_t_::buff
xmlChar * buff
buffer to store input
Definition: runstack.h:239
RUNSTACK_QUE_GROUP
@ RUNSTACK_QUE_GROUP
group variables
Definition: runstack.h:137
runstack_context_t_::zero_condcbQ
dlq_hdr_t zero_condcbQ
conditions for level zero in the runstack
Definition: runstack.h:282
log_info
void void void void void log_info(const char *fstr,...) __attribute__((format(printf
Generate a new LOG_DEBUG_INFO log entry.
log_debug2
void void void void void void void void void log_debug2(const char *fstr,...) __attribute__((format(printf
Generate a new LOG_DEBUG_DEBUG2 log entry.
runstack_ifcb_t_::curcond
boolean curcond
current condition
Definition: runstack.h:147
xpath1.h
XPath 1.0 expression support.
runstack_get_cond_state
boolean runstack_get_cond_state(runstack_context_t *rcxt)
Get the current conditional code state for the context.
Definition: runstack.c:1506
NO_ERR
@ NO_ERR
000
Definition: status_enum.h:188
xpath.h
Schema and data model Xpath search support.
runstack_context_t_::cond_state
boolean cond_state
current conditional state
Definition: runstack.h:258
runstack_handle_else
status_t runstack_handle_else(runstack_context_t *rcxt)
Handle the elsecommand for the specific runstack context.
Definition: runstack.c:1757
LOGDEBUG2
#define LOGDEBUG2
Check if at least log-level=debug2.
Definition: log.h:292
xpath_free_result
void xpath_free_result(xpath_result_t *result)
Free a malloced XPath result struct.
Definition: xpath.c:3107
dlq_createSQue
void dlq_createSQue(dlq_hdrT *queAddr)
create a static queue header
Definition: dlq.c:177
log_warn
void void void log_warn(const char *fstr,...) __attribute__((format(printf
Generate a new LOG_DEBUG_WARN log entry.
ERR_INTERNAL_VAL
@ ERR_INTERNAL_VAL
004
Definition: status_enum.h:194
runstack_push
status_t runstack_push(runstack_context_t *rcxt, const xmlChar *source, FILE *fp)
Add a script nest level context to the stack.
Definition: runstack.c:544
runstack_get_parm_que
dlq_hdr_t * runstack_get_parm_que(runstack_context_t *rcxt)
Get the parameter queue for the current stack level.
Definition: runstack.c:970
dlq_remove
void dlq_remove(void *nodeP)
remove the queue entry from its queue list entry MUST have been enqueued somehow before this function...
Definition: dlq.c:519
xpath1_eval_expr
xpath_result_t * xpath1_eval_expr(xpath_pcb_t *pcb, val_value_t *val, val_value_t *docroot, boolean logerrors, boolean configonly, status_t *res)
Evaluate an XPath expression use if the prefixes are YANG: must/when.
Definition: xpath1.c:5293
runstack_entry_t_::linenum
uint32 linenum
current line number
Definition: runstack.h:245
runstack_condcb_t_::u_::loopcb
runstack_loopcb_t loopcb
loop control block
Definition: runstack.h:215
ERR_NCX_INVALID_VALUE
@ ERR_NCX_INVALID_VALUE
258
Definition: status_enum.h:299
runstack_ifcb_t_::ifstate
runstack_ifstate_t ifstate
if state
Definition: runstack.h:144
runstack_context_t_
Main runstact context control block used by yangcli to process script input loops and conditional sta...
Definition: runstack.h:256
RUNSTACK_IF_NONE
@ RUNSTACK_IF_NONE
not set
Definition: runstack.h:117
log_debug_append
void void void void void void void void log_debug_append(const char *fstr,...) __attribute__((format(printf
Append to a LOG_DEBUG_DEBUG log entry.
RUNSTACK_COND_IF
@ RUNSTACK_COND_IF
if-stmt condition
Definition: runstack.h:110
ERR_INTERNAL_MEM
@ ERR_INTERNAL_MEM
003
Definition: status_enum.h:193
runstack_loopcb_t_
control the looping for 1 while - end sequence
Definition: runstack.h:160
ERR_INTERNAL_PTR
@ ERR_INTERNAL_PTR
002
Definition: status_enum.h:192
runstack_get_cmd
xmlChar * runstack_get_cmd(runstack_context_t *rcxt, status_t *res)
Read the current runstack context and construct a command string for processing by do_run_script.
Definition: runstack.c:704
log_debug
void void void void void void void log_debug(const char *fstr,...) __attribute__((format(printf
Generate a new LOG_DEBUG_DEBUG log entry.
runstack_clear_cancel
void runstack_clear_cancel(runstack_context_t *rcxt)
Clear the cancel flags.
Definition: runstack.c:893
runstack_loopcb_t_::maxloops
uint32 maxloops
max number of loops allowed
Definition: runstack.h:162
val_all_whitespace
boolean val_all_whitespace(const xmlChar *str)
Check if a string is all whitespace.
Definition: val.c:11719
RUNSTACK_SRC_LOOP
@ RUNSTACK_SRC_LOOP
source is captured from a loop
Definition: runstack.h:107
runstack_entry_t_::condcbQ
dlq_hdr_t condcbQ
Q of runstack_condcb_t.
Definition: runstack.h:248
dlq_prevEntry
#define dlq_prevEntry(nodeP)
get the previous queue entry before the current entry
Definition: dlq.h:280
runstack_entry_t_::fp
FILE * fp
file open for input
Definition: runstack.h:233
ERR_NCX_EOF
@ ERR_NCX_EOF
244
Definition: status_enum.h:283
LOGINFO
#define LOGINFO
Check if at least log-level=info.
Definition: log.h:279
dlq_nextEntry
#define dlq_nextEntry(nodeP)
get the next queue entry after the current entry
Definition: dlq.h:265
runstack_condcb_t_::u_::ifcb
runstack_ifcb_t ifcb
if control block
Definition: runstack.h:216
ERR_NCX_RESOURCE_DENIED
@ ERR_NCX_RESOURCE_DENIED
269
Definition: status_enum.h:310
runstack_save_line
status_t runstack_save_line(runstack_context_t *rcxt, const xmlChar *line)
Save the current line if needed if a loop is active.
Definition: runstack.c:1210
runstack_context_t_::runstackQ
dlq_hdr_t runstackQ
each stack level has an entry
Definition: runstack.h:273
runstack_handle_end
status_t runstack_handle_end(runstack_context_t *rcxt)
Handle the end command for the specific runstack context.
Definition: runstack.c:1825
RUNSTACK_COND_LOOP
@ RUNSTACK_COND_LOOP
while loop condition
Definition: runstack.h:111
runstack_handle_elif
status_t runstack_handle_elif(runstack_context_t *rcxt, boolean startcond)
Handle the elif command for the specific runstack context.
Definition: runstack.c:1675
RUNSTACK_SRC_SCRIPT
@ RUNSTACK_SRC_SCRIPT
source is a yangcli script
Definition: runstack.h:106
RUNSTACK_QUE_NONE
@ RUNSTACK_QUE_NONE
not set
Definition: runstack.h:134
RUNSTACK_SRC_USER
@ RUNSTACK_SRC_USER
source is interactive input
Definition: runstack.h:105
runstack_context_t_::globalQ
dlq_hdr_t globalQ
global variables for this runstack context
Definition: runstack.h:276
runstack_ifcb_t_::startcond
boolean startcond
start condition
Definition: runstack.h:146
ERR_NCX_CANCELED
@ ERR_NCX_CANCELED
2002
Definition: status_enum.h:552
runstack_line_t_
save 1 line for looping purposes
Definition: runstack.h:153
ncx_check_inline_data_state
boolean ncx_check_inline_data_state(const xmlChar *line, boolean curstate)
Check the input line for Start or End of data tags.
Definition: ncx.c:14431
runstack_context_t_::max_script_level
uint32 max_script_level
maximum script depth level
Definition: runstack.h:267
runstack_condtype_t_
runstack_condtype_t_
identify the runstack conditional control block type
Definition: runstack.h:108
runstack_ifcb_t_::ifused
boolean ifused
T already used up.
Definition: runstack.h:148
RUNSTACK_IF_ELSE
@ RUNSTACK_IF_ELSE
else state
Definition: runstack.h:120
runstack_line_t_::line
xmlChar * line
malloced line of text
Definition: runstack.h:155
VAR_TYP_LOCAL
@ VAR_TYP_LOCAL
local variables have one dollar sign like $foo They exist only in the current runstack frame and get ...
Definition: var.h:108
runstack_entry_t_::qhdr
dlq_hdr_t qhdr
queue header
Definition: runstack.h:227
log.h
NCX System Logging Manager.
ERR_BUFF_OVFL
@ ERR_BUFF_OVFL
106
Definition: status_enum.h:218
ncxtypes.h
YANG module data structures Many internal representations of YANG module constructs.
RUNSTACK_COND_NONE
@ RUNSTACK_COND_NONE
not set
Definition: runstack.h:109
runstack_loopcb_t_::first_line
runstack_line_t * first_line
these may point to entries in this lineQ or the collector's lineQ; only the commands that are part of...
Definition: runstack.h:189
LOGDEBUG
#define LOGDEBUG
Check if at least log-level=debug.
Definition: log.h:287
runstack_handle_while
status_t runstack_handle_while(runstack_context_t *rcxt, uint32 maxloops, struct xpath_pcb_t_ *xpathpcb, val_value_t *docroot)
Process the current command, which is a 'while' command.
runstack_line_t_::qhdr
dlq_hdr_t qhdr
queue header
Definition: runstack.h:154
xpath_pcb_t_
XPath parser control block.
Definition: xpath.h:668
runstack_clean_context
void runstack_clean_context(runstack_context_t *rcxt)
Clean the runstack context.
Definition: runstack.c:1033
runstack_get_source
runstack_src_t runstack_get_source(runstack_context_t *rcxt)
Get the current input source for the runstack context.
Definition: runstack.c:1186
val_set_string
status_t val_set_string(val_value_t *val, const xmlChar *valname, const xmlChar *valstr)
set a generic string using the builtin string typdef Set an initialized val_value_t as a simple type ...
Definition: val.c:6622
runstack_loopcb_t_::collector
struct runstack_loopcb_t_ * collector
if the collector is non-NULL, then save lines in this outer while loop
Definition: runstack.h:182
RUNSTACK_SRC_NONE
@ RUNSTACK_SRC_NONE
not set
Definition: runstack.h:104
runstack_session_cleanup
void runstack_session_cleanup(runstack_context_t *rcxt)
Cleanup after a yangcli session has ended.
Definition: runstack.c:1155
dlq_deque
void * dlq_deque(dlq_hdrT *listP)
remove the first queue node from the queue list
Definition: dlq.c:286
runstack_context_t_::zeroQ
dlq_hdr_t zeroQ
local variables for level 0 in the runstack
Definition: runstack.h:279
runstack_context_t_::script_cancel
boolean script_cancel
script cancel requested
Definition: runstack.h:261
runstack_condcb_t_::u_
loop or if-stmt condition used but not both
Definition: runstack.h:214
dlq_empty
#define dlq_empty(listP)
check if queue list is empty
Definition: dlq.h:367
runstack_loopcb_t_::startcond
boolean startcond
start condition state
Definition: runstack.h:171
runstack_get_que
dlq_hdr_t * runstack_get_que(runstack_context_t *rcxt, runstack_queue_type_t quetype)
Read the current runstack context and figure out which queue to get.
Definition: runstack.c:921
runstack_entry_t_::varQ
dlq_hdr_t varQ
Q of ncx_var_t.
Definition: runstack.h:247
dlq_firstEntry
#define dlq_firstEntry(listP)
get the first entry in the queue list
Definition: dlq.h:337
val_new_value
val_value_t * val_new_value(void)
Malloc and initialize the fields in a val_value_t.
Definition: val.c:2697
RUNSTACK_LOOP_NONE
@ RUNSTACK_LOOP_NONE
not set
Definition: runstack.h:126
runstack_free_context
void runstack_free_context(runstack_context_t *rcxt)
Clean and free the runstack context.
Definition: runstack.c:1075
ncx.h
YANG module utility functions.
runstack_condcb_t_
control the looping for 1 while - end sequence
Definition: runstack.h:206
runstack_loopcb_t_::loop_state
runstack_loopstate_t loop_state
current loop state
Definition: runstack.h:168
runstack_condcb_t_::cond_type
runstack_condtype_t cond_type
condition type
Definition: runstack.h:211
runstack_loopcb_t_::loop_count
uint32 loop_count
current loop count
Definition: runstack.h:165
runstack_entry_t_::level
uint32 level
current runsack level
Definition: runstack.h:230
runstack_context_t_::script_level
uint32 script_level
current script depth devel
Definition: runstack.h:264
ncx_file_close
void ncx_file_close(FILE *fp)
Close a file; check result.
Definition: ncx.c:13235
RUNSTACK_QUE_GLOBAL
@ RUNSTACK_QUE_GLOBAL
global variables
Definition: runstack.h:138
runstack_loopcb_t_::xpathpcb
struct xpath_pcb_t_ * xpathpcb
condition to evaluate before each loop iteration
Definition: runstack.h:174
dlq_enque
void dlq_enque(REG void *newP, REG dlq_hdrT *listP)
add a queue node to the end of a queue list Add newP to listP
Definition: dlq.c:246
ERR_NCX_LOOP_ENDED
@ ERR_NCX_LOOP_ENDED
2003
Definition: status_enum.h:553
RUNSTACK_QUE_SESSION
@ RUNSTACK_QUE_SESSION
session variables
Definition: runstack.h:136
runstack_set_sessionQ
void runstack_set_sessionQ(runstack_context_t *rcxt, dlq_hdr_t *sessionQ)
Set the current session-specific variable Q.
Definition: runstack.c:1947
runstack_pop
void runstack_pop(runstack_context_t *rcxt)
Remove a script nest level context from the stack Call just after script is completed.
Definition: runstack.c:635
runstack_ifcb_t_
control the conditional state for 1 if...end sequence
Definition: runstack.h:143
SET_ERROR
#define SET_ERROR(E)
macro SET_ERROR
Definition: status_enum.h:103
runstack_entry_t_::bufflen
int bufflen
length of buffer
Definition: runstack.h:242
runstack_condcb_t_::qhdr
dlq_hdr_t qhdr
queue header
Definition: runstack.h:208
val_free_value
void val_free_value(val_value_t *val)
Scrub the memory in a val_value_t by freeing all the sub-fields and then freeing the entire struct it...
Definition: val.c:2842
runstack_init_context
void runstack_init_context(runstack_context_t *rcxt)
Initialize a pre-malloced runstack context.
Definition: runstack.c:1100
status.h
Global error messages for status code enumerations.
dlq.h
dlq provides general double-linked list and queue support:
var.h
NCX Variable Support. Used within a runstack by a CLI user or script.
runstack_level
uint32 runstack_level(runstack_context_t *rcxt)
Get the current stack level.
Definition: runstack.c:515
RUNSTACK_LOOP_LOOPING
@ RUNSTACK_LOOP_LOOPING
playing loop commands
Definition: runstack.h:128
runstack_loopcb_t_::lineQ
dlq_hdr_t lineQ
this Q will only be used if collector is NULL
Definition: runstack.h:201