yumapro
24.10-2
YumaPro SDK
|
Bootstrap CLI based on name/value pairs Used to setup the basics as soon as possible. More...
Data Structures | |
struct | cli_rawparm_t |
used for bootstrap CLI parms only, no validation More... | |
Typedefs | |
typedef val_value_t *(* | cli_xml_buffer_fn_t) (const xmlChar *xmlbuff, obj_template_t *targetobj, status_t *res) |
Read an XML buffer and convert it into a real data structure. More... | |
typedef status_t(* | cli_var_replace_fn_t) (runstack_context_t *rcxt, val_value_t *val) |
Check a val_value_t for variable usage to be replaced by the variable value. More... | |
Enumerations | |
enum | cli_mode_t { CLI_MODE_NONE , CLI_MODE_PROGRAM , CLI_MODE_COMMAND } |
CLI parsing modes. More... | |
Functions | |
cli_rawparm_t * | cli_new_rawparm (const xmlChar *name, boolean xsdlist) |
bootstrap CLI support Malloc and init a raw parm entry More... | |
cli_rawparm_t * | cli_new_empty_rawparm (const xmlChar *name) |
Malloc and init a raw parm entry that has no value (NCX_BT_EMPTY) More... | |
void | cli_free_rawparm (cli_rawparm_t *parm) |
Clean and free a raw parm entry. More... | |
void | cli_clean_rawparmQ (dlq_hdr_t *parmQ) |
Clean and free a Q of raw parm entries. More... | |
cli_rawparm_t * | cli_find_rawparm (const xmlChar *name, dlq_hdr_t *parmQ) |
Find the specified raw parm entry. More... | |
status_t | cli_parse_raw (int argc, char *argv[], dlq_hdr_t *rawparmQ) |
Generate N sets of variable/value pairs for the specified boot-strap CLI parameters. More... | |
val_value_t * | cli_parse (runstack_context_t *rcxt, int argc, char *argv[], obj_template_t *obj, boolean valonly, boolean script, boolean autocomp, cli_mode_t mode, status_t *status) |
schema based CLI support More... | |
val_value_t * | cli_parse_inline (runstack_context_t *rcxt, int argc, char *argv[], obj_template_t *obj, boolean valonly, boolean script, boolean autocomp, boolean rawxml, cli_mode_t mode, status_t *status, cli_xml_buffer_fn_t cbfn, cli_var_replace_fn_t cbfn2) |
schema based CLI support More... | |
status_t | cli_parse_parm (runstack_context_t *rcxt, val_value_t *val, obj_template_t *obj, const xmlChar *strval, boolean script) |
Create a val_value_t struct for the specified parm value, and insert it into the parent container value. More... | |
status_t | cli_parse_parm_ret (runstack_context_t *rcxt, val_value_t *val, obj_template_t *obj, const xmlChar *strval, boolean script, val_value_t **retval) |
Create a val_value_t struct for the specified parm value, and insert it into the parent container value. More... | |
status_t | cli_parse_parm_binary (runstack_context_t *rcxt, val_value_t *val, obj_template_t *obj, const xmlChar *strval, boolean script, val_value_t **retval) |
Create a val_value_t struct for the specified parm value, and insert it into the value set Extended. More... | |
status_t | cli_parse_parm_ex (runstack_context_t *rcxt, val_value_t *val, obj_template_t *obj, const xmlChar *strval, boolean script, ncx_bad_data_t bad_data) |
Create a val_value_t struct for the specified parm value, and insert it into the parent container value Allow different bad data error handling vioa parameter. More... | |
status_t | conf_parse_val_from_filespec (const xmlChar *filespec, val_value_t *val, boolean keepvals, boolean fileerr) |
Parse a file as an NCX text config file against a specific parmset definition. More... | |
status_t | conf_parse_val_from_filespec_ex (const xmlChar *filespec, const xmlChar *banner_object, val_value_t *val, boolean keepvals, boolean fileerr, boolean *fileopened) |
Parse a file as an NCX text config file against a specific parmset definition. More... | |
Bootstrap CLI based on name/value pairs Used to setup the basics as soon as possible.
Configuration File using YANG container object for the schema.
YANG CLI available after all YANG modules loaded Uses an obj_template_t to specify the schema for the value set
typedef status_t(* cli_var_replace_fn_t) (runstack_context_t *rcxt, val_value_t *val) |
Check a val_value_t for variable usage to be replaced by the variable value.
All descendant nodes of 'val' are checked
rcxt | runtime context to find variables | |
[in,out] | val | value node to check for variable replacements Expected to be complex type (container or list) val descendants may have values replaced |
typedef val_value_t *(* cli_xml_buffer_fn_t) (const xmlChar *xmlbuff, obj_template_t *targetobj, status_t *res) |
Read an XML buffer and convert it into a real data structure.
xmlbuff | XML buffer to load | |
targetobj | template to use to validate XML and encode as this object !! must not be ncx:root!! == NULL to use OBJ_TYP_ANYXML as the target object template | |
[out] | res | address of return status; *res return status |
enum cli_mode_t |
void cli_clean_rawparmQ | ( | dlq_hdr_t * | parmQ | ) |
Clean and free a Q of raw parm entries.
parmQ | Q of raw parm entry to free |
cli_rawparm_t * cli_find_rawparm | ( | const xmlChar * | name, |
dlq_hdr_t * | parmQ | ||
) |
Find the specified raw parm entry.
name | object name to really use |
parmQ | Q of cli_rawparm_t |
void cli_free_rawparm | ( | cli_rawparm_t * | parm | ) |
Clean and free a raw parm entry.
parm | raw parm entry to free |
cli_rawparm_t * cli_new_empty_rawparm | ( | const xmlChar * | name | ) |
Malloc and init a raw parm entry that has no value (NCX_BT_EMPTY)
name | name of parm (static const string) |
cli_rawparm_t * cli_new_rawparm | ( | const xmlChar * | name, |
boolean | xsdlist | ||
) |
bootstrap CLI support Malloc and init a raw parm entry
name | name of parm (static const string) |
xsdlist | whether parm list is structured as XSDLIST |
val_value_t * cli_parse | ( | runstack_context_t * | rcxt, |
int | argc, | ||
char * | argv[], | ||
obj_template_t * | obj, | ||
boolean | valonly, | ||
boolean | script, | ||
boolean | autocomp, | ||
cli_mode_t | mode, | ||
status_t * | status | ||
) |
schema based CLI support
Generate 1 val_value_t struct from a Unix Command Line, which should conform to the specified obj_template_t definition.
For CLI interfaces, only one container object can be specified at this time.
@param rcxt runstack context to use @param argc number of strings passed in 'argv' @param argv array of command line argument strings @param obj obj_template_t of the container that should be used to validate the input against the child nodes of this container @param valonly TRUE if only the values presented should be checked, no defaults, missing parms (Step 1 & 2 only)\n FALSE if all the tests and procedures should be done @param autocomp TRUE if parameter auto-completion should be tried if any specified parameters are not matches for the specified parmset\n FALSE if exact match only is desired @param mode CLI_MODE_PROGRAM if calling with real (argc, argv) parameters; these may need some prep work\n CLI_MODE_COMMAND if calling from yangcli or some other internal command parser. These strings will not be preped at all @param[out] status pointer to status_t to get the return value\n *status the final function return status\n
Just as the NETCONF parser does, the CLI parser will not add a parameter to the val_value_t if any errors occur related to the initial parsing.
val_value_t * cli_parse_inline | ( | runstack_context_t * | rcxt, |
int | argc, | ||
char * | argv[], | ||
obj_template_t * | obj, | ||
boolean | valonly, | ||
boolean | script, | ||
boolean | autocomp, | ||
boolean | rawxml, | ||
cli_mode_t | mode, | ||
status_t * | status, | ||
cli_xml_buffer_fn_t | cbfn, | ||
cli_var_replace_fn_t | cbfn2 | ||
) |
schema based CLI support
Generate 1 val_value_t struct from a Unix Command Line, which should conform to the specified obj_template_t definition.
For CLI interfaces, only one container object can be specified at this time.
Just as the NETCONF parser does, the CLI parser will not add a parameter to the val_value_t if any errors occur related to the initial parsing.
rcxt | runstack context to use | |
argc | number of strings passed in 'argv' | |
argv | array of command line argument strings | |
obj | obj_template_t of the container that should be used to validate the input against the child nodes of this container | |
valonly | TRUE if only the values presented should be checked, no defaults, missing parms (Step 1 & 2 only) FALSE if all the tests and procedures should be done | |
script | TRUE if calling from a script; FALSE if interactive | |
autocomp | TRUE if parameter auto-completion should be tried if any specified parameters are not matches for the specified parmset FALSE if exact match only is desired | |
rawxml | XML parsing mode
| |
mode | CLI_MODE_PROGRAM if calling with real (argc, argv) parameters; these may need some prep work CLI_MODE_COMMAND if calling from yangcli or some other internal command parser. These strings will not be preped at all | |
[out] | status | pointer to status_t to get the return value
|
cbfn | inline XML data only: callback for XML buffer parsing | |
cbfn2 | inline data variable replacement callback function |
status_t cli_parse_parm | ( | runstack_context_t * | rcxt, |
val_value_t * | val, | ||
obj_template_t * | obj, | ||
const xmlChar * | strval, | ||
boolean | script | ||
) |
Create a val_value_t struct for the specified parm value, and insert it into the parent container value.
ONLY CALLED FROM CLI PARSING FUNCTIONS IN ncxcli.c ALLOWS SCRIPT EXTENSIONS TO BE PRESENT
A new val_value_t will be inserted in the val->v.childQ as required to fill in the parm.
rcxt | runstack context to use |
val | parent value struct to adjust |
obj | obj_template_t descriptor for the missing parm |
strval | string representation of the parm value (may be NULL if parm btype is NCX_BT_EMPTY |
script | TRUE if CLI script mode FALSE if CLI plain mode |
status_t cli_parse_parm_binary | ( | runstack_context_t * | rcxt, |
val_value_t * | val, | ||
obj_template_t * | obj, | ||
const xmlChar * | strval, | ||
boolean | script, | ||
val_value_t ** | retval | ||
) |
Create a val_value_t struct for the specified parm value, and insert it into the value set Extended.
This function is specially called for the binary leaf/ leaf-list with default value.
If the specified parm is mandatory w/defval defined, then a new val_value_t will be inserted in the val->v.childQ as required to fill in the value set.
rcxt | runstack context to use | |
val | complex val_value_t to add the parsed parm into | |
obj | obj_template_t descriptor for the missing parm | |
strval | string representation of the object value (may be NULL if obj btype is NCX_BT_EMPTY | |
script | TRUE if parsing a script (in the manager) FALSE if parsing XML or CLI | |
[out] | retval | address of return parm; *retval created parm |
status_t cli_parse_parm_ex | ( | runstack_context_t * | rcxt, |
val_value_t * | val, | ||
obj_template_t * | obj, | ||
const xmlChar * | strval, | ||
boolean | script, | ||
ncx_bad_data_t | bad_data | ||
) |
Create a val_value_t struct for the specified parm value, and insert it into the parent container value Allow different bad data error handling vioa parameter.
ONLY CALLED FROM CLI PARSING FUNCTIONS IN ncxcli.c ALLOWS SCRIPT EXTENSIONS TO BE PRESENT
A new val_value_t will be inserted in the val->v.childQ as required to fill in the parm.
rcxt | runstack context to use |
val | parent value struct to adjust |
obj | obj_template_t descriptor for the missing parm |
strval | string representation of the parm value (may be NULL if parm btype is NCX_BT_EMPTY |
script | TRUE if CLI script mode FALSE if CLI plain mode |
bad_data | enum defining how bad data should be handled |
status_t cli_parse_parm_ret | ( | runstack_context_t * | rcxt, |
val_value_t * | val, | ||
obj_template_t * | obj, | ||
const xmlChar * | strval, | ||
boolean | script, | ||
val_value_t ** | retval | ||
) |
Create a val_value_t struct for the specified parm value, and insert it into the parent container value.
Return the new parm ONLY CALLED FROM CLI PARSING FUNCTIONS IN ncxcli.c ALLOWS SCRIPT EXTENSIONS TO BE PRESENT
A new val_value_t will be inserted in the val->v.childQ as required to fill in the parm.
rcxt | runstack context to use | |
val | parent value struct to adjust | |
obj | obj_template_t descriptor for the missing parm | |
strval | string representation of the parm value (may be NULL if parm btype is NCX_BT_EMPTY | |
script | TRUE if CLI script mode FALSE if CLI plain mode | |
[out] | retval | address of return parm; *retval created parm |
status_t cli_parse_raw | ( | int | argc, |
char * | argv[], | ||
dlq_hdr_t * | rawparmQ | ||
) |
Generate N sets of variable/value pairs for the specified boot-strap CLI parameters.
There are no modules loaded yet, and nothing has been initialized, not even logging This function is almost the first thing done by the application
* CLI Syntax Supported * * [prefix] parmname * * [prefix] parmname=value * * prefix == 0 to 2 dashes foo -foo --foo * parmname == any valid NCX identifier string * value == string * * No spaces are allowed after 'parmname' if 'value' is entered * Each parameter is allowed to occur zero or one times. * If multiple instances of a parameter are entered, then * the last one entered will win. * The 'autocomp' parameter is set to TRUE * * The 'value' string cannot be split across multiple argv segments. * Use quotation chars within the CLI shell to pass a string * containing whitespace to the CLI parser: * * --foo="quoted string if whitespace needed" * --foo="quoted string if setting a variable \ * as a top-level assignment" * --foo=unquoted-string-without-whitespace * * - There are no 1-char aliases for CLI parameters. * - Position-dependent, unnamed parameters are not supported *
argc | number of strings passed in 'argv' | |
argv | array of command line argument strings | |
[out] | rawparmQ | Q of cli_rawparm_t entries that should be used to validate the CLI input and store the results *rawparmQ (rawparm within parmQ):
|
status_t conf_parse_val_from_filespec | ( | const xmlChar * | filespec, |
val_value_t * | val, | ||
boolean | keepvals, | ||
boolean | fileerr | ||
) |
Parse a file as an NCX text config file against a specific parmset definition.
Fill in an initialized parmset (and could be partially filled in)
Error messages are printed by this function!!
If a value is already set, and only one value is allowed then the 'keepvals' parameter will control whether that value will be kept or overwitten
filespec | absolute path or relative path This string is used as-is without adjustment. |
val | value struct to fill in, must be initialized already with val_new_value or val_init_value |
keepvals | == TRUE if old values should always be kept FALSE if old vals should be overwritten |
fileerr | TRUE to generate a missing file error FALSE to return NO_ERR instead, if file not found |
status_t conf_parse_val_from_filespec_ex | ( | const xmlChar * | filespec, |
const xmlChar * | banner_object, | ||
val_value_t * | val, | ||
boolean | keepvals, | ||
boolean | fileerr, | ||
boolean * | fileopened | ||
) |
Parse a file as an NCX text config file against a specific parmset definition.
Fill in an initialized parmset (and could be partially filled in)
Error messages are printed by this function!!
If a value is already set, and only one value is allowed then the 'keepvals' parameter will control whether that value will be kept or overwitten
filespec | absolute path or relative path This string is used as-is without adjustment. | |
banner_object | string to display in debug-stmt about what is being loaded | |
val | value struct to fill in, must be initialized already with val_new_value or val_init_value | |
keepvals | TRUE if old values should always be kept FALSE if old vals should be overwritten | |
fileerr | TRUE to generate a missing file error FALSE to return NO_ERR instead, if file not found | |
[out] | fileopened | address of return file opened status
|