yumapro  20.10-12
YumaPro SDK
var.h File Reference

NCX Variable Support. Used within a runstack by a CLI user or script. More...

#include <xmlstring.h>
#include "cli.h"
#include "dlq.h"
#include "ncxtypes.h"
#include "obj.h"
#include "val.h"
#include "runstack.h"
Include dependency graph for var.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  ncx_var_t_
 struct of NCX user variable mapping for yangcli More...
 

Typedefs

typedef ncx_var_t *(* var_getvar_fn_t) (const xmlChar *varname, uint32 varlen, void *cookie, status_t *res)
 Get Variable Callback. More...
 

Enumerations

enum  var_type_t_ {
  VAR_TYP_NONE,
  VAR_TYP_LOCAL,
  VAR_TYP_CONFIG,
  VAR_TYP_GLOBAL,
  VAR_TYP_SYSTEM,
  VAR_TYP_QUEUE
}
 different types of variables supported More...
 
enum  var_side_t_ {
  ISRIGHT,
  ISLEFT
}
 values for isleft parameter in var_check_ref More...
 

Functions

void var_free (ncx_var_t *var)
 Free a ncx_var_t struct. More...
 
void var_clean_varQ (dlq_hdr_t *varQ)
 Clean a Q of ncx_var_t. More...
 
void var_clean_type_from_varQ (dlq_hdr_t *varQ, var_type_t vartype)
 Clean all entries of one type from a Q of ncx_var_t. More...
 
status_t var_set_str (runstack_context_t *rcxt, const xmlChar *name, uint32 namelen, const val_value_t *value, var_type_t vartype)
 Find and set (or create a new) global user variable. More...
 
status_t var_set (runstack_context_t *rcxt, const xmlChar *name, const val_value_t *value, var_type_t vartype)
 Find and set (or create a new) global user variable. More...
 
status_t var_set_str_que (dlq_hdr_t *varQ, const xmlChar *name, uint32 namelen, const val_value_t *value)
 Find and set (or create a new) global user variable. More...
 
status_t var_set_que (dlq_hdr_t *varQ, const xmlChar *name, const val_value_t *value)
 Find and set (or create a new) Q-based user variable. More...
 
status_t var_set_move_que (dlq_hdr_t *varQ, const xmlChar *name, val_value_t *value)
 Find or create and set a Q-based user variable. More...
 
status_t var_set_move_que_global (dlq_hdr_t *varQ, const xmlChar *name, val_value_t *value)
 Find or create and set a Q-based user variable. More...
 
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. More...
 
status_t var_set_sys (runstack_context_t *rcxt, const xmlChar *name, const val_value_t *value)
 Find and set (or create a new) global system variable. More...
 
status_t var_set_from_string (runstack_context_t *rcxt, const xmlChar *name, const xmlChar *valstr, var_type_t vartype)
 Find and set (or create a new) global user variable from a string value instead of a val_value_t struct. More...
 
status_t var_unset (runstack_context_t *rcxt, const xmlChar *name, uint32 namelen, var_type_t vartype)
 Find and remove a local or global user variable. More...
 
status_t var_unset_que (dlq_hdr_t *varQ, const xmlChar *name, uint32 namelen, xmlns_id_t nsid)
 Find and remove a Q-based user variable. More...
 
val_value_t * var_get_str (runstack_context_t *rcxt, const xmlChar *name, uint32 namelen, var_type_t vartype)
 Find a global user variable. More...
 
val_value_t * var_get (runstack_context_t *rcxt, const xmlChar *name, var_type_t vartype)
 Find a local or global user variable. More...
 
var_type_t var_get_type_str (runstack_context_t *rcxt, const xmlChar *name, uint32 namelen, boolean globalonly)
 Find a user variable; get its var type. More...
 
var_type_t var_get_type (runstack_context_t *rcxt, const xmlChar *name, boolean globalonly)
 Get the var type of a specified var name. More...
 
val_value_t * var_get_str_que (dlq_hdr_t *varQ, const xmlChar *name, uint32 namelen, xmlns_id_t nsid)
 Find a global user variable in a varQ. More...
 
val_value_t * var_get_que (dlq_hdr_t *varQ, const xmlChar *name, xmlns_id_t nsid)
 Find a Q-based user variable in q varQ. More...
 
ncx_var_t * var_get_que_raw (dlq_hdr_t *varQ, xmlns_id_t nsid, const xmlChar *name)
 Find a Q-based user variable; return the var struct instead of just the value. More...
 
val_value_t * var_get_local (runstack_context_t *rcxt, const xmlChar *name)
 Find a local user variable. More...
 
val_value_t * var_get_local_str (runstack_context_t *rcxt, const xmlChar *name, uint32 namelen)
 Find a local user variable, count-based name string. More...
 
status_t var_check_ref (runstack_context_t *rcxt, const xmlChar *line, var_side_t side, uint32 *len, var_type_t *vartype, const xmlChar **name, uint32 *namelen, val_value_t **foundval)
 Check if the immediate command sub-string is a variable reference. More...
 
val_value_t * var_get_script_val (runstack_context_t *rcxt, obj_template_t *obj, val_value_t *val, const xmlChar *strval, boolean istop, status_t *res)
 Create or fill in a val_value_t struct for a parameter assignment within the script processing mode. More...
 
val_value_t * var_get_script_val_ex (runstack_context_t *rcxt, obj_template_t *parentobj, obj_template_t *obj, val_value_t *val, const xmlChar *strval, boolean istop, val_value_t *fillval, status_t *res)
 Create or fill in a val_value_t struct for a parameter assignment within the script processing mode Allow external values. More...
 
val_value_t * var_check_script_val (runstack_context_t *rcxt, obj_template_t *obj, const xmlChar *strval, boolean istop, boolean handleEscapedCharacters, cli_xml_buffer_fn_t cbfn, status_t *res)
 Create a val_value_t struct for a parameter assignment within the script processing mode, if a var ref is found. More...
 
void var_cvt_generic (dlq_hdr_t *varQ)
 Cleanup after a yangcli session has ended. More...
 
ncx_var_t * var_find (runstack_context_t *rcxt, const xmlChar *varname, xmlns_id_t nsid)
 Find a complete var struct for use with XPath. More...
 
ncx_var_t * var_find_global (runstack_context_t *rcxt, const xmlChar *varname, uint32 namelen, xmlns_id_t nsid)
 Find a complete var struct for use with XPath or data templates. More...
 
ncx_var_t * var_get_first (runstack_context_t *rcxt, boolean islocal)
 Find the first local or global variable. More...
 
ncx_var_t * var_get_next (ncx_var_t *curvar)
 Find the next local or global variable. More...
 
const xmlChar * var_get_name (const ncx_var_t *curvar)
 Get the name string for the specified variable. More...
 
var_type_t var_get_vartype (const ncx_var_t *curvar)
 Get the variable type for the specified variable. More...
 
void var_init (void)
 Init the var module. More...
 
void var_set_getvar_cb (var_getvar_fn_t getcb, void *cookie)
 Set the getvar callback function used for data templates. More...
 
void * var_get_getvar_cb_cookie (void)
 Get the cookie parameter for the getvar callback function used for data templates. More...
 
var_getvar_fn_t var_get_getvar_cb (void)
 Get the getvar callback function used for data templates. More...
 
boolean var_string_is_var_expr (const xmlChar *varstring, uint32 varlen, boolean *plainvar)
 Check if the string is a variable reference. More...
 
status_t var_replace_subtree (runstack_context_t *rcxt, val_value_t *val)
 Replace all the simple node variable usage with the var value. More...
 

Detailed Description

NCX Variable Support. Used within a runstack by a CLI user or script.