yumapro
24.10-3
YumaPro SDK
|
Management of a hierarchy of (name, value) pairs. More...
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... | |
Management of a hierarchy of (name, value) pairs.
THe names are NcxIdentifier types and the values are val_value_t structures or strings
typedef ncx_var_t *(* var_getvar_fn_t) (const xmlChar *varname, uint32 varlen, void *cookie, status_t *res) |
Get Variable Callback.
var_getvar_fn_t
Callback function for retrieval of a variable binding within a data template
varname | variable name requested | |
varlen | length of varname string | |
cookie | registered app-specific cookie parameter | |
[out] | res | address of return status
|
enum var_side_t |
enum var_type_t |
different types of variables supported
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.
If so, return the (vartype, name, namelen) tuple that identifies the reference. Also return the total number of chars consumed from the input line.
E.g.,
* $foo = get-config filter=@filter.xml *
rcxt | runstack context to use | |
line | command line string to expand | |
side | TRUE if left hand side of an expression FALSE if right hand side ($1 type vars allowed) | |
[out] | len | address of number chars parsed so far in line
|
[out] | vartype | address of return variable Q type
|
[out] | name | address of string start return val
|
[out] | namelen | address of name length return val
|
[out] | foundval | address of found variable value return val
|
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.
See yangcli documentation for details on the script syntax
rcxt | runstack context to use | |
obj | expected object template NULL and will be set to NCX_BT_STRING for simple types | |
strval | string value to check | |
istop | TRUE if calling from top level assignment An unquoted string is the start of a command FALSE if calling from a parameter parse An unquoted string is just a string | |
handleEscapedCharacters | in a double-quoted string (only!), translate * " \\, \", \n, and \t ". * | |
cbfn | callback function to use | |
[out] | res | address of status result
|
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.
varQ | Q of var structs to free |
vartype | variable type to delete |
void var_clean_varQ | ( | dlq_hdr_t * | varQ | ) |
Clean a Q of ncx_var_t.
varQ | Q of var structs to free |
void var_cvt_generic | ( | dlq_hdr_t * | varQ | ) |
Cleanup after a yangcli session has ended.
varQ | Q of ncx_var_t to cleanup and change to generic object pointers |
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.
rcxt | runstack context to use |
varname | variable name string |
nsid | namespace ID for varname (0 is OK) |
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.
INPUTS:
rcxt | runstack context to use |
varname | variable name string |
namelen | length of name string |
nsid | namespace ID for varname (0 is OK) |
void var_free | ( | ncx_var_t * | var | ) |
Free a ncx_var_t struct.
var | var struct to free |
val_value_t * var_get | ( | runstack_context_t * | rcxt, |
const xmlChar * | name, | ||
var_type_t | vartype | ||
) |
Find a local or global user variable.
rcxt | runstack context to use |
name | var name to set |
vartype | variable type |
ncx_var_t * var_get_first | ( | runstack_context_t * | rcxt, |
boolean | islocal | ||
) |
Find the first local or global variable.
rcxt | runstack context to use |
islocal | TRUE for local variables FALSE for global variables |
var_getvar_fn_t var_get_getvar_cb | ( | void | ) |
Get the getvar callback function used for data templates.
void * var_get_getvar_cb_cookie | ( | void | ) |
Get the cookie parameter for the getvar callback function used for data templates.
val_value_t * var_get_local | ( | runstack_context_t * | rcxt, |
const xmlChar * | name | ||
) |
Find a local user variable.
rcxt | runstack context to use |
name | var name to get |
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.
rcxt | runstack context to use |
name | var name to get |
namelen | legth of name string |
const xmlChar * var_get_name | ( | const ncx_var_t * | curvar | ) |
Get the name string for the specified variable.
curvar | current var to check |
Find the next local or global variable.
curvar | current var to check |
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.
varQ | queue of ncx_var_t to use |
name | var name to get |
nsid | namespace ID for name (0 if not used) |
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.
varQ | queue of ncx_var_t to use |
nsid | namespace ID for name (0 if not used) |
name | var name to get |
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.
See ncxcli.c for details on the script syntax
rcxt | runstack context to use | |
obj | expected type template NULL and will be set to NCX_BT_STRING for simple types | |
val | value to fill in :: val->obj MUST be set NULL to create a new one | |
strval | string value to check | |
istop | TRUE (ISTOP) if calling from top level assignment An unquoted string is the start of a command FALSE (ISPARM) if calling from a parameter parse An unquoted string is just a string | |
[out] | res | address of status result
|
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.
See ncxcli.c for details on the script syntax
rcxt | runstack context to use | |
parentobj | container or list real node parent of 'obj' NULL and will be set to NCX_BT_STRING for simple types | |
obj | expected type template NULL and will be set to NCX_BT_STRING for simple types | |
val | value to fill in :: val->obj MUST be set NULL to create a new one | |
strval | string value to check | |
istop | TRUE (ISTOP) if calling from top level assignment An unquoted string is the start of a command FALSE (ISPARM) if calling from a parameter parse An unquoted string is just a string | |
fillval | value from yangcli, could be NCX_BT_EXTERN; used instead of strval! NULL: not used | |
[out] | res | address of status result
|
val_value_t * var_get_str | ( | runstack_context_t * | rcxt, |
const xmlChar * | name, | ||
uint32 | namelen, | ||
var_type_t | vartype | ||
) |
Find a global user variable.
rcxt | runstack context to use |
name | var name to set |
namelen | length of name string |
vartype | variable type |
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.
varQ | queue of ncx_var_t to use |
name | var name to get |
namelen | length of name |
nsid | namespace ID for name (0 if not used) |
var_type_t var_get_type | ( | runstack_context_t * | rcxt, |
const xmlChar * | name, | ||
boolean | globalonly | ||
) |
Get the var type of a specified var name.
rcxt | runstack context to use |
name | var name to get |
globalonly | TRUE to check only the global Q FALSE to check local, then global Q |
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.
rcxt | runstack context to use |
name | var name to get |
namelen | length of name |
globalonly | TRUE to check only the global Q FALSE to check local, then global Q |
var_type_t var_get_vartype | ( | const ncx_var_t * | curvar | ) |
Get the variable type for the specified variable.
curvar | current var to check |
void var_init | ( | void | ) |
Init the var module.
status_t var_replace_subtree | ( | runstack_context_t * | rcxt, |
val_value_t * | val | ||
) |
Replace all the simple node variable usage with the var value.
rcxt | runstack contect to use |
val | value subtree to check; expecting container or list |
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.
rcxt | runstack context to use to find the var |
name | var name to set |
value | var value to set |
vartype | variable type |
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.
rcxt | runstack context to use to find the var |
name | var name to set |
valstr | value string to set |
vartype | variable type |
void var_set_getvar_cb | ( | var_getvar_fn_t | getcb, |
void * | cookie | ||
) |
Set the getvar callback function used for data templates.
getcb | getvars callback function address |
cookie | cookie parameter to pass to callback |
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.
Use the provided entry which will be freed later This function will not clone the value like var_set
rcxt | runstack context to use to find the var |
name | var name to set |
namelen | length of name string |
vartype | variable type |
value | var value to set (pass off memory, do not clone!) |
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.
varQ | variable binding Q to use instead of runstack |
name | var name to set |
value | == var value to set (pass off memory, do not clone!) |
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.
varQ | variable binding Q to use instead of runstack |
name | var name to set |
value | == var value to set (pass off memory, do not clone!) |
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.
varQ | variable binding Q to use instead of runstack |
name | var name to set |
value | var value to set |
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.
rcxt | runstack context to use to find the var |
name | var name to set |
namelen | length of name |
value | var value to set |
vartype | variable type |
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.
varQ | variable binding Q to use instead of runstack |
name | var name to set |
namelen | length of name |
value | var value to set |
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.
rcxt | runstack context to use to find the var |
name | var name to set |
value | var value to set |
boolean var_string_is_var_expr | ( | const xmlChar * | varstring, |
uint32 | varlen, | ||
boolean * | plainvar | ||
) |
Check if the string is a variable reference.
varstring | string to check | |
varlen | length of varstring to check | |
[out] | plainvar | address of return flag
|
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.
!!! This function does not try global if local fails !!!
rcxt | runstack context to use to find the var |
name | var name to set |
namelen | length of name string |
vartype | variable type |
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.
varQ | Q of ncx_var_t to use |
name | var name to set |
namelen | length of name string |
nsid | namespace ID to check if non-zero |