yumapro
24.10-3
YumaPro SDK
|
YANG modules are loaded into the client and server. More...
Data Structures | |
struct | ncxmod_temp_progcb_t |
program-level temp dir control block More... | |
struct | ncxmod_temp_sescb_t |
session-level temp-dir control block More... | |
struct | ncxmod_temp_filcb_t |
temporary file control block More... | |
struct | ncxmod_search_result_t |
struct for storing YANG file search results this is used by yangcli for schema auto-load also for finding newest version, or all versions within the module path More... | |
Macros | |
#define | ncxmod_is_pschar(ch) ((ch) == NCXMOD_PSCHAR) |
Check if the char is a path separator char. More... | |
Typedefs | |
typedef status_t(* | ncxmod_callback_fn_t) (const char *fullspec, void *cookie) |
user function callback template to process a module during a subtree traversal More... | |
typedef status_t(* | ncxmod_backup_cbfn_t) (const char *fullspec, const xmlChar *mtime, void *cookie) |
user function callback template to process a backup file during a subtree traversal More... | |
typedef status_t(* | ncxmod_conf_cbfn_t) (const xmlChar *fullspec, void *cookie) |
internal .conf file handler Read all the foo.conf files in the specified directory Call the cbfn for each file found More... | |
typedef void(* | search_dumpfn_t) (log_debug_t level, const char *fstr,...) |
Callback to do log dump function for show searchpath. More... | |
Functions | |
status_t | ncxmod_init (void) |
Initialize the ncxmod module. More... | |
void | ncxmod_log_env (void) |
Report the environment variables used by the running system. More... | |
void | ncxmod_cleanup (void) |
Cleanup the ncxmod module. More... | |
status_t | ncxmod_load_module (const xmlChar *modname, const xmlChar *revision, dlq_hdr_t *savedevQ, ncx_module_t **retmod) |
Determine the location of the specified module and then load it into the system, if not already loaded Main API for this module. More... | |
status_t | ncxmod_load_module_loadpath (const xmlChar *modname, const xmlChar *revision, dlq_hdr_t *savedevQ, boolean is_loadpath, ncx_module_t **retmod) |
Determine the location of the specified module and then load it into the system, if not already loaded Allows all modules in the path to be loaded. More... | |
status_t | ncxmod_autoload_module (const xmlChar *modname, const xmlChar *revision, dlq_hdr_t *savedevQ, dlq_hdr_t *savemodQ, dlq_hdr_t *topfailedQ, ncx_module_t **retmod) |
Load a YANG Module (Used by yangcli-pro) More... | |
ncxmod_search_result_t * | ncxmod_find_module (const xmlChar *modname, const xmlChar *revision) |
Find a YANG module and generate a search result. More... | |
status_t | ncxmod_find_all_modules (dlq_hdr_t *resultQ) |
Find all modules in the path and create a Q of search results. More... | |
status_t | ncxmod_find_all_modules_ycli_cache (dlq_hdr_t *resultQ) |
Find all modules in the search path for the yangcli cache. More... | |
status_t | ncxmod_load_deviation (const xmlChar *deviname, dlq_hdr_t *deviationQ) |
Load a deviation module (special handling by compiler) More... | |
status_t | ncxmod_load_annotation (const xmlChar *deviname, dlq_hdr_t *deviationQ) |
Load an annotation module (special compiler processing) More... | |
status_t | ncxmod_load_imodule (const xmlChar *modname, const xmlChar *revision, yang_pcb_t *pcb, yang_parsetype_t ptyp, ncx_module_t *parent, ncx_module_t **retmod) |
Load an import module (special compiler processing) More... | |
yang_pcb_t * | ncxmod_load_module_ex (const xmlChar *modname, const xmlChar *revision, boolean with_submods, boolean savetkc, boolean keepmode, boolean docmode, dlq_hdr_t *savedevQ, status_t *res) |
Load a YANG module (extended) More... | |
yang_pcb_t * | ncxmod_load_module_diff (const xmlChar *modname, const xmlChar *revision, boolean with_submods, const xmlChar *modpath, dlq_hdr_t *savedevQ, status_t *res) |
Load a module (special yangdiff-pro handling) More... | |
xmlChar * | ncxmod_find_data_file (const xmlChar *fname, boolean generrors, boolean backup_file, status_t *res) |
Determine the location of the specified data file. More... | |
xmlChar * | ncxmod_find_server_data_file (const xmlChar *fname, boolean fileloc_fhs, boolean generrors, boolean backup_file, boolean keep_result, status_t *res) |
Find a server data file. More... | |
xmlChar * | ncxmod_find_sil_file (const xmlChar *fname, boolean generrors, status_t *res) |
Determine the location of the specified server instrumentation library file. More... | |
xmlChar * | ncxmod_make_data_filespec (const xmlChar *fname, boolean backup_file, status_t *res) |
Determine a suitable path location for the specified data file name. More... | |
xmlChar * | ncxmod_make_server_data_filespec (const xmlChar *fname, boolean fileloc_fhs, boolean backup_file, status_t *res) |
Determine a suitable path location for the specified data file name. More... | |
xmlChar * | ncxmod_make_data_filespec_from_src (const xmlChar *srcspec, const xmlChar *fname, status_t *res) |
Determine the directory path portion of the specified source_url and change the filename to the specified filename in a new copy of the complete filespec. More... | |
xmlChar * | ncxmod_find_script_file (const xmlChar *fname, status_t *res) |
Determine the location of the specified script file. More... | |
xmlChar * | ncxmod_find_test_suite_file (const xmlChar *fname, status_t *res) |
Determine the location of the specified test-suite file. More... | |
status_t | ncxmod_set_home (const xmlChar *home) |
Override the HOME env var with the home CLI var. More... | |
const xmlChar * | ncxmod_get_home (void) |
Get the HOME or –home parameter value, whichever is in effect, if any. More... | |
status_t | ncxmod_set_yuma_home (const xmlChar *yumahome) |
Override the YUMAPRO_HOME env var with the yuma-home CLI var. More... | |
const xmlChar * | ncxmod_get_yuma_home (void) |
Get the YUMAPRO_HOME or –yuma-home parameter value, whichever is in effect, if any. More... | |
const xmlChar * | ncxmod_get_yuma_install (void) |
Get the YUMAPRO_INSTALL or default install parameter value, whichever is in effect. More... | |
void | ncxmod_set_modpath (const xmlChar *modpath) |
Override the YUMAPRO_MODPATH env var with the modpath CLI var. More... | |
void | ncxmod_set_loadpath (const xmlChar *loadpath) |
Override the YUMAPRO_LOADPATH env var with the loadpath CLI var. More... | |
void | ncxmod_set_datapath (const xmlChar *datapath) |
Override the YUMA_DATAPATH env var with the datapath CLI var. More... | |
void | ncxmod_set_runpath (const xmlChar *runpath) |
Override the YUMAPRO_RUNPATH env var with the runpath CLI var. More... | |
void | ncxmod_set_subdirs (boolean usesubdirs) |
Set the subdirs flag to FALSE if the no-subdirs CLI param is set. More... | |
const xmlChar * | ncxmod_get_yumadir (void) |
Get the yuma directory being used. More... | |
status_t | ncxmod_process_subtree (const char *startspec, ncxmod_callback_fn_t callback, void *cookie) |
Search the entire specified subtree, looking for YANG modules. More... | |
boolean | ncxmod_test_subdir (const xmlChar *dirspec) |
Check if the specified string is a directory. More... | |
const xmlChar * | ncxmod_get_userhome (const xmlChar *user, uint32 userlen) |
Get the user home dir from the passwd file. More... | |
const xmlChar * | ncxmod_get_envvar (const xmlChar *name, uint32 namelen) |
Get the specified shell environment variable. More... | |
void | ncxmod_set_altpath (const xmlChar *altpath) |
Set the alternate path that should be used first (for yangdiff) More... | |
void | ncxmod_clear_altpath (void) |
Clear the alternate path so none is used (for yangdiff) More... | |
status_t | ncxmod_list_data_files (help_mode_t helpmode, boolean logstdout) |
List the available data files found in the data search parh. More... | |
status_t | ncxmod_list_script_files (help_mode_t helpmode, boolean logstdout) |
List the available script files found in the 'run' search parh. More... | |
status_t | ncxmod_list_yang_files (help_mode_t helpmode, boolean logstdout) |
List the available YANG files found in the 'mod' search parh. More... | |
status_t | ncxmod_setup_yumadir (void) |
Setup the ~/.yumapro directory if it does not exist. More... | |
status_t | ncxmod_setup_yumadir_srid (const xmlChar *srid) |
Setup the ~/.yumapro/SRID directory if it does not exist. More... | |
status_t | ncxmod_setup_backup_dir (const xmlChar *backup_dir) |
Setup the ~/.yumapro/backups directory if it does not exist. More... | |
status_t | ncxmod_setup_fhs_dirs (void) |
Setup the following FHS location server directories if they do not already exist. More... | |
status_t | ncxmod_setup_fhs_srid_dirs (const xmlChar *server_root) |
Setup the following FHS SRID subdir location. More... | |
status_t | ncxmod_setup_tempdir (void) |
Setup the ~/.yuma/tmp directory if it does not exist. More... | |
status_t | ncxmod_setup_yumadir_force (const xmlChar *path) |
Setup the ~/.yumapro directory if it does not exist. More... | |
status_t | ncxmod_setup_recordtest_dir (void) |
Setup the ~/.yuma/recordtest directory if it does not exist. More... | |
status_t | ncxmod_setup_yangcli_cache_dir (const xmlChar *cache_dir) |
Setup the ~/.yumapro/.yangcli_cache directory if it does not exist. More... | |
ncxmod_temp_progcb_t * | ncxmod_new_program_tempdir (status_t *res) |
Setup a program instance temp files directory. More... | |
void | ncxmod_free_program_tempdir (ncxmod_temp_progcb_t *progcb) |
Remove a program instance temp files directory. More... | |
ncxmod_temp_sescb_t * | ncxmod_new_session_tempdir (ncxmod_temp_progcb_t *progcb, uint32 sidnum, status_t *res) |
Setup a session instance temp files directory. More... | |
void | ncxmod_free_session_tempdir (ncxmod_temp_progcb_t *progcb, uint32 sidnum) |
Clean and free a session instance temp files directory. More... | |
ncxmod_temp_filcb_t * | ncxmod_new_session_tempfile (ncxmod_temp_sescb_t *sescb, const xmlChar *filename, status_t *res) |
Setup a session instance temp file for writing. More... | |
void | ncxmod_free_session_tempfile (ncxmod_temp_filcb_t *filcb) |
Clean and free a session instance temp files directory. More... | |
ncxmod_search_result_t * | ncxmod_new_search_result (void) |
Malloc and initialize a search result struct. More... | |
ncxmod_search_result_t * | ncxmod_new_search_result_ex (const ncx_module_t *mod) |
Malloc and initialize a search result struct. More... | |
ncxmod_search_result_t * | ncxmod_new_search_result_str (const xmlChar *modname, const xmlChar *revision) |
Malloc and initialize a search result struct. More... | |
void | ncxmod_free_search_result (ncxmod_search_result_t *searchresult) |
Clean and free a search result struct. More... | |
void | ncxmod_clean_search_result_queue (dlq_hdr_t *searchQ) |
Clean and free all the search result structs in the specified Q. More... | |
ncxmod_search_result_t * | ncxmod_find_search_result (dlq_hdr_t *searchQ, const xmlChar *modname, const xmlChar *revision, const xmlChar *nsuri) |
Find a search result inthe specified Q. More... | |
ncxmod_search_result_t * | ncxmod_clone_search_result (const ncxmod_search_result_t *sr) |
Clone a search result. More... | |
boolean | ncxmod_test_filespec (const xmlChar *filespec) |
Check the exact filespec to see if it a file. More... | |
uint32 | ncxmod_get_pathlen_from_filespec (const xmlChar *filespec) |
Get the length of th path part of the filespec string. More... | |
status_t | ncxmod_get_file_mtime (const xmlChar *filespec, time_t *timebuff) |
Get the last-modified time for a file. More... | |
status_t | ncxmod_get_backup_files (ncxmod_backup_cbfn_t cbfn, void *cookie) |
Get all the available backup files found in the specified backup directory if it exist;. More... | |
xmlChar * | ncxmod_get_pid_filespec (const xmlChar *progname, boolean fileloc_fhs, status_t *res) |
Get the PID file specification for the given program name. More... | |
xmlChar * | ncxmod_get_subdir_filespec (const xmlChar *subdir, boolean fileloc_fhs, status_t *res) |
Get the subdir specification for the given subdir name The correct .yumapro directory will be used for the parent dir. More... | |
status_t | ncxmod_read_num_file (const xmlChar *numfile, uint64 *curnum, boolean file_error) |
Read the uint64 file and return the value found Expects full filespec, does not call ncx_get_source!! More... | |
status_t | ncxmod_write_num_file (const xmlChar *numfile, uint64 curnum) |
Write the number file with the supplied value Expects full filespec, does not call ncx_get_source!! More... | |
status_t | ncxmod_copy_text_file (const xmlChar *src_filespec, const xmlChar *dest_filespec) |
Copy the source text file to the fully specified filespec. More... | |
status_t | ncxmod_subsys_info_write (const xmlChar *filespec, const xmlChar *ipaddr, uint16 portnum) |
Write the subsystem info file;. More... | |
void | ncxmod_subsys_info_remove (const xmlChar *filespec) |
Remove the subsystem info file. More... | |
status_t | ncxmod_get_conf_files (const xmlChar *confdir, boolean must_exist, ncxmod_conf_cbfn_t cbfn, void *cookie) |
Get all the available conf files found in the specified config directory if it exist; Invoke the callback function for each config file found. More... | |
status_t | ncxmod_set_bestmatch_modules (void) |
Check for all the modules avialable for bestmatch checking. | |
status_t | ncxmod_scan_loadpath (ncxmod_callback_fn_t cbfn, void *cookie) |
Check for all the modules in the YUMAPRO_LOADPATH (–loadpath) Invoke the callback function which will load the SIL and/or module. More... | |
status_t | ncxmod_scan_loadpath_sm (ncxmod_callback_fn_t cbfn, xmlChar *load_path, void *cookie) |
Check for all the modules in the YUMAPRO_LOADPATH (–loadpath) Invoke the callback function which will load the SIL and/or module. More... | |
boolean | ncxmod_use_bestmatch_now (const xmlChar *revision) |
Check if the bestmatch can be used for this module. More... | |
void | ncxmod_dump_module_search_path (search_dumpfn_t dumpfn, log_debug_t loglevel) |
Output the YANG module search path. More... | |
const xmlChar * | ncxmod_get_modpath (void) |
Get the ncxmod_mod_path value. More... | |
const xmlChar * | ncxmod_get_datapath (void) |
Get the ncxmod_data_path value. More... | |
const xmlChar * | ncxmod_get_runpath (void) |
Get the ncxmod_run_path value. More... | |
xmlChar * | ncxmod_find_sid_file (const xmlChar *fname, boolean generrors, status_t *res) |
Determine the location of the specified Schema Item Identifier file. More... | |
YANG modules are loaded into the client and server.
THey can also be unloaded. High level APIs check if any dependencies are still using a module, before it is unloaded.
#define ncxmod_is_pschar | ( | ch | ) | ((ch) == NCXMOD_PSCHAR) |
Check if the char is a path separator char.
ch | Char to check |
typedef status_t(* ncxmod_backup_cbfn_t) (const char *fullspec, const xmlChar *mtime, void *cookie) |
user function callback template to process a backup file during a subtree traversal
Handle the current filename in the subtree traversal Parse the module and generate.
fullspec | absolute or relative path spec, with filename and ext. this regular file exists |
mtime | last-modified time for the backup file |
cookie | opaque handle passed from start of callbacks |
typedef status_t(* ncxmod_callback_fn_t) (const char *fullspec, void *cookie) |
user function callback template to process a module during a subtree traversal
Used by the ncxmod_process_subtree function
Handle the current filename in the subtree traversal Parse the module and generate.
fullspec | absolute or relative path spec, with filename and ext. this regular file exists, but has not been checked for read access of |
cookie | opaque handle passed from start of callbacks |
typedef status_t(* ncxmod_conf_cbfn_t) (const xmlChar *fullspec, void *cookie) |
internal .conf file handler Read all the foo.conf files in the specified directory Call the cbfn for each file found
fullspec | absolute filename of conf file |
cookie | opaque handle passed from start of callbacks |
typedef void(* search_dumpfn_t) (log_debug_t level, const char *fstr,...) |
Callback to do log dump function for show searchpath.
level | debug level to use |
fstr | format string |
... | extra parameters based on fstr |
status_t ncxmod_autoload_module | ( | const xmlChar * | modname, |
const xmlChar * | revision, | ||
dlq_hdr_t * | savedevQ, | ||
dlq_hdr_t * | savemodQ, | ||
dlq_hdr_t * | topfailedQ, | ||
ncx_module_t ** | retmod | ||
) |
Load a YANG Module (Used by yangcli-pro)
Determine the location of the specified module and then parse the file into an ncx_module_t, but do not load it into the module registry
Used by yangcli to build per-session view of each module advertised by the NETCONF server
Module Search order: 1) YUMAPRO_MODPATH environment var (or set by modpath CLI var) 2) current dir or absolute path 3) YUMAPRO_HOME/modules directory 4) HOME/modules directory
modname | module name with no path prefix or file extension | |
revision | optional revision date of 'modname' to find | |
savedevQ | Q of ncx_save_deviations_t to use, if any | |
savemodQ | Q of ncx_module_t to save any loaded modules; savemodQ will have entries added for any missing imports and the 'modname' module THIS Q HAS LIVE MALLOCED STRUCTS THAT NEED TO BE FREED LATER | |
topfailedQ | Q of failed_ptr_t used to make sure that the current module has never failed | |
[out] | retmod | address of return module (may be NULL)
|
void ncxmod_clean_search_result_queue | ( | dlq_hdr_t * | searchQ | ) |
Clean and free all the search result structs in the specified Q.
searchQ | Q of ncxmod_search_result_t to clean and free |
void ncxmod_cleanup | ( | void | ) |
Cleanup the ncxmod module.
void ncxmod_clear_altpath | ( | void | ) |
Clear the alternate path so none is used (for yangdiff)
ncxmod_search_result_t * ncxmod_clone_search_result | ( | const ncxmod_search_result_t * | sr | ) |
Clone a search result.
sr | searchresult to clone |
status_t ncxmod_copy_text_file | ( | const xmlChar * | src_filespec, |
const xmlChar * | dest_filespec | ||
) |
Copy the source text file to the fully specified filespec.
src_filespec | source filespec to copy from |
dest_filespec | destination filespec to copy from |
void ncxmod_dump_module_search_path | ( | search_dumpfn_t | dumpfn, |
log_debug_t | loglevel | ||
) |
Output the YANG module search path.
dumpfn | Callback function to do output, E.g., Can use log_info |
loglevel | == required log level to print anything |
status_t ncxmod_find_all_modules | ( | dlq_hdr_t * | resultQ | ) |
Find all modules in the path and create a Q of search results.
Determine the location of all possible YANG modules and submodules within the configured YUMAPRO_MODPATH and default search path All files with .yang and .yin file extensions found in the search directories will be checked.
Does not cause modules to be fully parsed and registered. Quick parse only is done, and modules are discarded. Strings from the module are copied into the searchresult struct
Module Search order: 1) YUMAPRO_MODPATH environment var (or set by modpath CLI var) 2) HOME/modules directory 3) YUMAPRO_HOME/modules directory 4) YUMAPRO_INSTALL/modules directory
[out] | resultQ | address of Q to store malloced search results
|
status_t ncxmod_find_all_modules_ycli_cache | ( | dlq_hdr_t * | resultQ | ) |
Find all modules in the search path for the yangcli cache.
Used by yangcli-pro only All files with .yang found in the ~/.yumapro/.yangcli_cache Strings from the module are copied into the searchresult struct
[out] | resultQ | address of Q to stor malloced search results
|
xmlChar * ncxmod_find_data_file | ( | const xmlChar * | fname, |
boolean | generrors, | ||
boolean | backup_file, | ||
status_t * | res | ||
) |
Determine the location of the specified data file.
Search order: 1) YUMA_DATAPATH environment var (or set by datapath CLI var) 2) current directory or absolute path 3) HOME/data directory 4) YUMAPRO_HOME/data directory 5) HOME/.yuma/ directory 6a) YUMAPRO_INSTALL/data directory OR 6b) /usr/share/yuma/data directory 7) /etc/yuma directory
fname | file name with extension if the first char is '.' or '/', then an absolute path is assumed, and the search path will not be tries | |
generrors | TRUE if error message should be generated FALSE if no error message | |
backup_file | TRUE if this is a backup file; FALSE if general file | |
[out] | res | address of status result
|
ncxmod_search_result_t * ncxmod_find_module | ( | const xmlChar * | modname, |
const xmlChar * | revision | ||
) |
Find a YANG module and generate a search result.
Determine the location of the specified module and then fill out a search result struct DO NOT load it into the system
Module Search order: 1) YUMAPRO_MODPATH environment var (or set by modpath CLI var) 2) current dir or absolute path 3) YUMAPRO_HOME/modules directory 4) HOME/modules directory
modname | module name with no path prefix or file extension |
revision | optional revision date of 'modname' to find |
xmlChar * ncxmod_find_script_file | ( | const xmlChar * | fname, |
status_t * | res | ||
) |
Determine the location of the specified script file.
Search order: 1) current directory or absolute path 2) YUMAPRO_RUNPATH environment var (or set by runpath CLI var) 3) HOME/scripts directory 4) YUMAPRO_HOME/scripts directory 5) YUMAPRO_INSTALL/scripts directory
fname | file name with extension if the first char is '.' or '/', then an absolute path is assumed, and the search path will not be tries | |
[out] | res | address of status result
|
ncxmod_search_result_t * ncxmod_find_search_result | ( | dlq_hdr_t * | searchQ, |
const xmlChar * | modname, | ||
const xmlChar * | revision, | ||
const xmlChar * | nsuri | ||
) |
Find a search result inthe specified Q.
Either modname or nsuri must be set If modname is set, then revision will be checked
searchQ | Q of ncxmod_search_result_t to check |
modname | module or submodule name to find |
revision | revision-date to find |
nsuri | namespace URI fo find |
xmlChar * ncxmod_find_server_data_file | ( | const xmlChar * | fname, |
boolean | fileloc_fhs, | ||
boolean | generrors, | ||
boolean | backup_file, | ||
boolean | keep_result, | ||
status_t * | res | ||
) |
Find a server data file.
Determine the location of the specified data file This is only for server data that is generated by the server. It is not for static data like ncxmod_find_data_file
If fileloc_fhs: Check /var/lib/netconfd-pro Else: Check $HOME/.yumapro If fileloc_fhs and backup: Check /var/lib/netconfd-pro/backups If !fileloc_fhs and backup: Check $HOME/.yumapro/backups
fname | file name with extension if the first char is '.' or '/', then an absolute path is assumed, and the search path will not be tries | |
fileloc_fhs | TRUE if using FHS file locations; FALSE if not | |
generrors | TRUE if error message should be generated FALSE if no error message | |
backup_file | TRUE if this is a backup file; FALSE if general file | |
keep_result | TRUE to return failed filespec even if *res == not-found | |
[out] | res | address of status result
|
xmlChar * ncxmod_find_sid_file | ( | const xmlChar * | fname, |
boolean | generrors, | ||
status_t * | res | ||
) |
Determine the location of the specified Schema Item Identifier file.
Search order: (MAY CHANGE!!!) 1) filespec == try that only and exit 2) current directory 3) YUMAPRO_MODPATH environment var (or set by modpath CLI var) 4) HOME/modules directory 5) YUMAPRO_HOME/modules directory 6) YUMAPRO_INSTALL/modules directory OR 7) default install module location, which is '/usr/share/yumapro/modules' 8) start-dir/modules
fname | SID file name with extension | |
generrors | TRUE if error message should be generated FALSE if no error message | |
[out] | res | address of status result
|
xmlChar * ncxmod_find_sil_file | ( | const xmlChar * | fname, |
boolean | generrors, | ||
status_t * | res | ||
) |
Determine the location of the specified server instrumentation library file.
Search order: 1) $YUMAPRO_HOME/target/lib directory 2) $YUMAPRO_RUNPATH environment variable 3) $YUMAPRO_INSTALL/lib 4) $YUMAPRO_INSTALL/lib/yuma 5) /usr/lib64/yuma directory (LIB64 only) 5 or 6) /usr/lib/yuma directory
fname | SIL file name with extension | |
generrors | TRUE if error message should be generated FALSE if no error message | |
[out] | res | address of status result
|
xmlChar * ncxmod_find_test_suite_file | ( | const xmlChar * | fname, |
status_t * | res | ||
) |
Determine the location of the specified test-suite file.
Search order: 1) current directory or absolute path 2) YUMAPRO_RUNPATH environment var (or set by runpath CLI var) 3) HOME/test-suites directory 4) YUMAPRO_HOME/test-suites directory 5) HOME/.yumapro directory
fname | file name with extension if the first char is '/', then an absolute path is assumed, and the search path will not be tried | |
[out] | res | address of status result
|
void ncxmod_free_program_tempdir | ( | ncxmod_temp_progcb_t * | progcb | ) |
Remove a program instance temp files directory.
progcb | tempoeray program instance control block to free |
void ncxmod_free_search_result | ( | ncxmod_search_result_t * | searchresult | ) |
Clean and free a search result struct.
searchresult | struct to clean and free |
void ncxmod_free_session_tempdir | ( | ncxmod_temp_progcb_t * | progcb, |
uint32 | sidnum | ||
) |
Clean and free a session instance temp files directory.
progcb | program instance control block to use |
sidnum | manager session number to delete |
void ncxmod_free_session_tempfile | ( | ncxmod_temp_filcb_t * | filcb | ) |
Clean and free a session instance temp files directory.
filcb | file control block to delete |
status_t ncxmod_get_backup_files | ( | ncxmod_backup_cbfn_t | cbfn, |
void * | cookie | ||
) |
Get all the available backup files found in the specified backup directory if it exist;.
Invoke the callback function for each backup file found
cbfn | callback function to use |
cookie | cookie to pass to the callback function |
status_t ncxmod_get_conf_files | ( | const xmlChar * | confdir, |
boolean | must_exist, | ||
ncxmod_conf_cbfn_t | cbfn, | ||
void * | cookie | ||
) |
Get all the available conf files found in the specified config directory if it exist; Invoke the callback function for each config file found.
confdir | directory to check for *.conf |
must_exist | TRUE if error for dir to be missing and accessible FALSE to just skip |
cbfn | callback function to use |
cookie | cookie to pass to the callback function |
const xmlChar * ncxmod_get_datapath | ( | void | ) |
Get the ncxmod_data_path value.
Set from YUMAPRO_DATAPATH or –datapath
const xmlChar * ncxmod_get_envvar | ( | const xmlChar * | name, |
uint32 | namelen | ||
) |
Get the specified shell environment variable.
name | name of the environment variable (may not be zero-terminiated) |
namelen | length of name string |
status_t ncxmod_get_file_mtime | ( | const xmlChar * | filespec, |
time_t * | timebuff | ||
) |
Get the last-modified time for a file.
filespec | full file spec to check |
timebuff | buffer to hold the timestamp |
const xmlChar * ncxmod_get_home | ( | void | ) |
Get the HOME or –home parameter value, whichever is in effect, if any.
const xmlChar * ncxmod_get_modpath | ( | void | ) |
Get the ncxmod_mod_path value.
Set from YUMAPRO_MODPATH or –modpath
uint32 ncxmod_get_pathlen_from_filespec | ( | const xmlChar * | filespec | ) |
Get the length of th path part of the filespec string.
filespec | file spec to check |
xmlChar * ncxmod_get_pid_filespec | ( | const xmlChar * | progname, |
boolean | fileloc_fhs, | ||
status_t * | res | ||
) |
Get the PID file specification for the given program name.
progname | program name to use | |
fileloc_fhs | TRUE for FHS locations; FALSE for yumadir location | |
[out] | res | address of return status
|
const xmlChar * ncxmod_get_runpath | ( | void | ) |
Get the ncxmod_run_path value.
Set from YUMAPRO_RUNPATH or –runapath
xmlChar * ncxmod_get_subdir_filespec | ( | const xmlChar * | subdir, |
boolean | fileloc_fhs, | ||
status_t * | res | ||
) |
Get the subdir specification for the given subdir name The correct .yumapro directory will be used for the parent dir.
subdir | subdirectory name to use | |
fileloc_fhs | TRUE for FHS locations; FALSE for yumadir location | |
[out] | res | address of return status
|
const xmlChar * ncxmod_get_userhome | ( | const xmlChar * | user, |
uint32 | userlen | ||
) |
Get the user home dir from the passwd file.
user | user name string (may not be zero-terminiated) |
userlen | length of user |
const xmlChar * ncxmod_get_yuma_home | ( | void | ) |
Get the YUMAPRO_HOME or –yuma-home parameter value, whichever is in effect, if any.
const xmlChar * ncxmod_get_yuma_install | ( | void | ) |
Get the YUMAPRO_INSTALL or default install parameter value, whichever is in effect.
const xmlChar * ncxmod_get_yumadir | ( | void | ) |
Get the yuma directory being used.
status_t ncxmod_init | ( | void | ) |
Initialize the ncxmod module.
status_t ncxmod_list_data_files | ( | help_mode_t | helpmode, |
boolean | logstdout | ||
) |
List the available data files found in the data search parh.
Search order: 1) current directory or absolute path 2) YUMA_DATAPATH environment var (or set by datapath CLI var) 3) HOME/data directory 4) YUMAPRO_HOME/data directory 5) YUMAPRO_INSTALL/data directory
helpmode | BRIEF, NORMAL or FULL |
logstdout | TRUE to use log_stdout FALSE to use log_write |
status_t ncxmod_list_script_files | ( | help_mode_t | helpmode, |
boolean | logstdout | ||
) |
List the available script files found in the 'run' search parh.
Search order: 1) current directory or absolute path 2) YUMAPRO_RUNPATH environment var (or set by datapath CLI var) 3) HOME/scripts directory 4) YUMAPRO_HOME/scripts directory 5) YUMAPRO_INSTALL/scripts directory
helpmode | BRIEF, NORMAL or FULL |
logstdout | TRUE to use log_stdout; FALSE to use log_write |
status_t ncxmod_list_yang_files | ( | help_mode_t | helpmode, |
boolean | logstdout | ||
) |
List the available YANG files found in the 'mod' search parh.
Search order: 1) current directory or absolute path 2) YUMAPRO_MODPATH environment var (or set by datapath CLI var) 3) HOME/modules directory 4) YUMAPRO_HOME/modules directory 5) YUMAPRO_INSTALL/modules directory
helpmode | BRIEF, NORMAL or FULL |
logstdout | TRUE to use log_stdout FALSE to use log_write |
status_t ncxmod_load_annotation | ( | const xmlChar * | deviname, |
dlq_hdr_t * | deviationQ | ||
) |
Load an annotation module (special compiler processing)
Same as deviation, except annotation not advertised Determine the location of the specified module and then parse it in the special deviation mode and save any deviation statements in the Q that is provided
Module Search order: 1) YUMAPRO_MODPATH environment var (or set by modpath CLI var) 2) current dir or absolute path 3) YUMAPRO_HOME/modules directory 4) HOME/modules directory
deviname | annotation module name with no path prefix or file extension | |
[out] | deviationQ | address of Q of ncx_save_deviations_t structs to add any new entries
|
status_t ncxmod_load_deviation | ( | const xmlChar * | deviname, |
dlq_hdr_t * | deviationQ | ||
) |
Load a deviation module (special handling by compiler)
Determine the location of the specified module and then parse it in the special deviation mode and save any deviation statements in the Q that is provided
* Module Search order: * * 1) YUMAPRO_MODPATH environment var (or set by modpath CLI var) * 2) current dir or absolute path * 3) YUMAPRO_HOME/modules directory * 4) HOME/modules directory
deviname | deviation module name with no path prefix or file extension | |
[out] | deviationQ | address of Q of ncx_save_deviations_t structs to add any new entries
|
status_t ncxmod_load_imodule | ( | const xmlChar * | modname, |
const xmlChar * | revision, | ||
yang_pcb_t * | pcb, | ||
yang_parsetype_t | ptyp, | ||
ncx_module_t * | parent, | ||
ncx_module_t ** | retmod | ||
) |
Load an import module (special compiler processing)
Determine the location of the specified module and then load it into the system, if not already loaded
Called from an include or import or submodule Includes the YANG parser control block and new parser source type
Module Search order: 1) YUMAPRO_MODPATH environment var (or set by modpath CLI var) 2) current dir or absolute path 3) YUMAPRO_HOME/modules directory 4) HOME/modules directory
modname | module name with no path prefix or file extension | |
revision | optional revision date of 'modname' to find | |
pcb | YANG parser control block | |
ptyp | YANG parser source type | |
parent | pointer to module being parsed if this is a a request to parse a submodule; there is only 1 parent for all submodules, based on the value of belongs-to | |
[out] | retmod | address of return module
|
status_t ncxmod_load_module | ( | const xmlChar * | modname, |
const xmlChar * | revision, | ||
dlq_hdr_t * | savedevQ, | ||
ncx_module_t ** | retmod | ||
) |
Determine the location of the specified module and then load it into the system, if not already loaded Main API for this module.
This is the only load module variant that checks if there are any errors recorded in the module or any of its dependencies !!! ONLY RETURNS TRUE IF MODULE AND ALL IMPORTS ARE LOADED OK !!!
Module Search order: 1) YUMAPRO_MODPATH environment var (or set by modpath CLI var) 2) current dir or absolute path 3) YUMAPRO_HOME/modules directory 4) HOME/modules directory
modname | module name with no path prefix or file extension | |
revision | optional revision date of 'modname' to find | |
savedevQ | Q of ncx_save_deviations_t to use, if any | |
[out] | retmod | address of return module (may be NULL)
|
yang_pcb_t * ncxmod_load_module_diff | ( | const xmlChar * | modname, |
const xmlChar * | revision, | ||
boolean | with_submods, | ||
const xmlChar * | modpath, | ||
dlq_hdr_t * | savedevQ, | ||
status_t * | res | ||
) |
Load a module (special yangdiff-pro handling)
Determine the location of the specified module and then load it into the system, if not already loaded Return the PCB instead of deleting it !!Do not add definitions to the registry!!
modname | module name with no path prefix or file extension | |
revision | optional revision date of 'modname' to find | |
with_submods | TRUE if YANG_PT_TOP mode should skip submodules == FALSE if top-level mode should process sub-modules | |
modpath | module path to override the modpath CLI var or the YUMAPRO_MODPATH env var | |
savedevQ | Q of ncx_save_deviations_t to use | |
[out] | res | address of return status
|
yang_pcb_t * ncxmod_load_module_ex | ( | const xmlChar * | modname, |
const xmlChar * | revision, | ||
boolean | with_submods, | ||
boolean | savetkc, | ||
boolean | keepmode, | ||
boolean | docmode, | ||
dlq_hdr_t * | savedevQ, | ||
status_t * | res | ||
) |
Load a YANG module (extended)
Determine the location of the specified module and then load it into the system, if not already loaded Return the PCB instead of deleting it
modname | module name with no path prefix or file extension | |
revision | optional revision date of 'modname' to find | |
with_submods | TRUE if YANG_PT_TOP mode should skip submodules FALSE if top-level mode should process sub-modules | |
savetkc | TRUE if the parse chain should be saved (e.g., YIN) | |
keepmode | TRUE if pcb->top should be saved even if it is already loaded; FALSE will allow the mod to be swapped out and the new copy deleted yangdump sets this to true | |
docmode | TRUE if need to preserve strings for –format=html or yang FALSE if no need to preserve string token sequences | |
savedevQ | Q of ncx_save_deviations_t to use | |
[out] | res | address of return status
|
status_t ncxmod_load_module_loadpath | ( | const xmlChar * | modname, |
const xmlChar * | revision, | ||
dlq_hdr_t * | savedevQ, | ||
boolean | is_loadpath, | ||
ncx_module_t ** | retmod | ||
) |
Determine the location of the specified module and then load it into the system, if not already loaded Allows all modules in the path to be loaded.
This is the only load module variant that checks if there are any errors recorded in the module or any of its dependencies !!! ONLY RETURNS TRUE IF MODULE AND ALL IMPORTS ARE LOADED OK !!!
Module Search order: 1) YUMAPRO_MODPATH environment var (or set by modpath CLI var) 2) current dir or absolute path 3) YUMAPRO_HOME/modules directory 4) HOME/modules directory
modname | module name with no path prefix or file extension | |
revision | optional revision date of 'modname' to find | |
savedevQ | Q of ncx_save_deviations_t to use, if any | |
is_loadpath | TRUE if loadpath load so silently skip submodules | |
[out] | retmod | address of return module (may be NULL)
|
void ncxmod_log_env | ( | void | ) |
Report the environment variables used by the running system.
xmlChar * ncxmod_make_data_filespec | ( | const xmlChar * | fname, |
boolean | backup_file, | ||
status_t * | res | ||
) |
Determine a suitable path location for the specified data file name.
Search order: 1) YUMA_DATAPATH environment var (or set by datapath CLI var) 2) HOME/data directory 3) YUMAPRO_HOME/data directory 4) HOME/.yuma directory 5) YUMAPRO_INSTALL/data directory 6) current directory
fname | file name with extension if the first char is '.' or '/', then an absolute path is assumed, and the search path will not be tries | |
backup_file | TRUE if this is a backup file; FALSE if general file | |
[out] | res | address of status result
|
xmlChar * ncxmod_make_data_filespec_from_src | ( | const xmlChar * | srcspec, |
const xmlChar * | fname, | ||
status_t * | res | ||
) |
Determine the directory path portion of the specified source_url and change the filename to the specified filename in a new copy of the complete filespec.
srcspec | source filespec to use | |
fname | file name with extension if the first char is '.' or '/', then an absolute path is assumed, and the search path will not be tries | |
[out] | res | address of status result
|
xmlChar * ncxmod_make_server_data_filespec | ( | const xmlChar * | fname, |
boolean | fileloc_fhs, | ||
boolean | backup_file, | ||
status_t * | res | ||
) |
Determine a suitable path location for the specified data file name.
fname | file name with extension if the first char is '.' or '/', then an absolute path is assumed, and the search path will not be tries | |
fileloc_fhs | TRUE if FHS locations; FALSE if $HOME/.yumapro | |
backup_file | TRUE if this is a backup file; FALSE if general file | |
[out] | res | address of status result
|
ncxmod_temp_progcb_t * ncxmod_new_program_tempdir | ( | status_t * | res | ) |
Setup a program instance temp files directory.
[out] | res | address of return status
|
ncxmod_search_result_t * ncxmod_new_search_result | ( | void | ) |
Malloc and initialize a search result struct.
ncxmod_search_result_t * ncxmod_new_search_result_ex | ( | const ncx_module_t * | mod | ) |
Malloc and initialize a search result struct.
mod | module struct to use |
ncxmod_search_result_t * ncxmod_new_search_result_str | ( | const xmlChar * | modname, |
const xmlChar * | revision | ||
) |
Malloc and initialize a search result struct.
modname | module name string to use |
revision | revision date to use (may be NULL) |
ncxmod_temp_sescb_t * ncxmod_new_session_tempdir | ( | ncxmod_temp_progcb_t * | progcb, |
uint32 | sidnum, | ||
status_t * | res | ||
) |
Setup a session instance temp files directory.
progcb | program instance control block to use | |
sidnum | manager session ID of the new session instance control block | |
[out] | res | address of return status
|
ncxmod_temp_filcb_t * ncxmod_new_session_tempfile | ( | ncxmod_temp_sescb_t * | sescb, |
const xmlChar * | filename, | ||
status_t * | res | ||
) |
Setup a session instance temp file for writing.
sescb | session instance control block to use | |
filename | filename to create in the temp directory | |
[out] | res | address of return status
|
status_t ncxmod_process_subtree | ( | const char * | startspec, |
ncxmod_callback_fn_t | callback, | ||
void * | cookie | ||
) |
Search the entire specified subtree, looking for YANG modules.
Invoke the callback function for each module file found
startspec | absolute or relative pathspec to start the search. If this is not a valid pathname, processing will exit immediately. |
callback | address of the ncxmod_callback_fn_t function to use for this traveral |
cookie | cookie to pass to each invocation of the callback |
status_t ncxmod_read_num_file | ( | const xmlChar * | numfile, |
uint64 * | curnum, | ||
boolean | file_error | ||
) |
Read the uint64 file and return the value found Expects full filespec, does not call ncx_get_source!!
numfile | full filespec of the uint64 file | |
[out] | curnum | address of return number
|
file_error | TRUE if the file is expected to exist; FALSE if OK not to exist |
status_t ncxmod_scan_loadpath | ( | ncxmod_callback_fn_t | cbfn, |
void * | cookie | ||
) |
Check for all the modules in the YUMAPRO_LOADPATH (–loadpath) Invoke the callback function which will load the SIL and/or module.
cbfn | callback function to invoke for each found module |
cookie | pointer to pass to callback as the cookie parm |
status_t ncxmod_scan_loadpath_sm | ( | ncxmod_callback_fn_t | cbfn, |
xmlChar * | load_path, | ||
void * | cookie | ||
) |
Check for all the modules in the YUMAPRO_LOADPATH (–loadpath) Invoke the callback function which will load the SIL and/or module.
cbfn | callback function to invoke for each found module |
load_path | unformatted string containing list of path strings |
cookie | pointer to pass to callback as the cookie parm |
void ncxmod_set_altpath | ( | const xmlChar * | altpath | ) |
Set the alternate path that should be used first (for yangdiff)
altpath | full path string to use must be static a const back-pointer is kept, not a copy |
void ncxmod_set_datapath | ( | const xmlChar * | datapath | ) |
Override the YUMA_DATAPATH env var with the datapath CLI var.
datapath | new YUMA_DATAPATH value NULL or empty string to disable |
status_t ncxmod_set_home | ( | const xmlChar * | home | ) |
Override the HOME env var with the home CLI var.
home | new HOME value NULL or empty string to disable |
void ncxmod_set_loadpath | ( | const xmlChar * | loadpath | ) |
Override the YUMAPRO_LOADPATH env var with the loadpath CLI var.
MALLOC FAILED IGNORED!!!
loadpath | new YUMAPRO_LOADPATH value NULL or empty string to disable |
void ncxmod_set_modpath | ( | const xmlChar * | modpath | ) |
Override the YUMAPRO_MODPATH env var with the modpath CLI var.
MALLOC FAILED IGNORED!!!
modpath | new YUMAPRO_MODPATH value NULL or empty string to disable |
void ncxmod_set_runpath | ( | const xmlChar * | runpath | ) |
Override the YUMAPRO_RUNPATH env var with the runpath CLI var.
runpath | new YUMAPRO_RUNPATH value NULL or empty string to disable |
void ncxmod_set_subdirs | ( | boolean | usesubdirs | ) |
Set the subdirs flag to FALSE if the no-subdirs CLI param is set.
usesubdirs | TRUE if subdirs searchs should be done FALSE if subdir searches should not be done |
status_t ncxmod_set_yuma_home | ( | const xmlChar * | yumahome | ) |
Override the YUMAPRO_HOME env var with the yuma-home CLI var.
MALLOC FAILED IGNORED!!!
yumahome | new YUMAPRO_HOME value NULL or empty string to disable |
status_t ncxmod_setup_backup_dir | ( | const xmlChar * | backup_dir | ) |
Setup the ~/.yumapro/backups directory if it does not exist.
status_t ncxmod_setup_fhs_dirs | ( | void | ) |
Setup the following FHS location server directories if they do not already exist.
/var/log/netconfd-pro /var/run/netconfd-pro /var/lib/netconfd-pro
status_t ncxmod_setup_fhs_srid_dirs | ( | const xmlChar * | server_root | ) |
Setup the following FHS SRID subdir location.
/var/lib/netconfd-pro/SRID
The ncxmod_setup_fhs_dirs function must be called first in order to create the 3 base libraries used in FHS mode
server_root | server root OID string to use as the subdir name |
status_t ncxmod_setup_recordtest_dir | ( | void | ) |
Setup the ~/.yuma/recordtest directory if it does not exist.
status_t ncxmod_setup_tempdir | ( | void | ) |
Setup the ~/.yuma/tmp directory if it does not exist.
status_t ncxmod_setup_yangcli_cache_dir | ( | const xmlChar * | cache_dir | ) |
Setup the ~/.yumapro/.yangcli_cache directory if it does not exist.
status_t ncxmod_setup_yumadir | ( | void | ) |
Setup the ~/.yumapro directory if it does not exist.
status_t ncxmod_setup_yumadir_force | ( | const xmlChar * | path | ) |
Setup the ~/.yumapro directory if it does not exist.
Use the specified path instead of the default YUMADIR This is no longer used by netconfd-pro if –fileloc-fhs is set This is used by the yuma-bench GUI
path | path spec to use |
status_t ncxmod_setup_yumadir_srid | ( | const xmlChar * | srid | ) |
Setup the ~/.yumapro/SRID directory if it does not exist.
Setup the ~/.yumapro/SRID directory if it does not exist This is not used by netconfd-pro if –fileloc-fhs is set
srid | server root ID string to use |
void ncxmod_subsys_info_remove | ( | const xmlChar * | filespec | ) |
Remove the subsystem info file.
filespec | full filespec of the subsys info file |
status_t ncxmod_subsys_info_write | ( | const xmlChar * | filespec, |
const xmlChar * | ipaddr, | ||
uint16 | portnum | ||
) |
Write the subsystem info file;.
Used by the server to indicate to the local netconf-subsystem-pro program instances what socket to use to connect to the netconfd-pro server, using the <ncx-connect> protocol
filespec | full filespec of the subsys info file |
ipaddr | IP address string to write |
portnum | TCP port number to write |
boolean ncxmod_test_filespec | ( | const xmlChar * | filespec | ) |
Check the exact filespec to see if it a file.
filespec | file spec to check |
boolean ncxmod_test_subdir | ( | const xmlChar * | dirspec | ) |
Check if the specified string is a directory.
dirspec | string to check as a directory spec |
boolean ncxmod_use_bestmatch_now | ( | const xmlChar * | revision | ) |
Check if the bestmatch can be used for this module.
revision | revision name |
status_t ncxmod_write_num_file | ( | const xmlChar * | numfile, |
uint64 | curnum | ||
) |
Write the number file with the supplied value Expects full filespec, does not call ncx_get_source!!
numfile | full filespec of the number file |
curnum | new number to write |