yumapro  20.10-10
YumaPro SDK
Load a YANG Module

YANG modules are loaded into the client and server. More...

Collaboration diagram for Load a YANG Module:

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...
 

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_tncxmod_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_tncxmod_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_tncxmod_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 ~/.yuma 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_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_tncxmod_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_tncxmod_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_tncxmod_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_tncxmod_new_search_result (void)
 Malloc and initialize a search result struct. More...
 
ncxmod_search_result_tncxmod_new_search_result_ex (const ncx_module_t *mod)
 Malloc and initialize a search result struct. More...
 
ncxmod_search_result_tncxmod_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_tncxmod_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_tncxmod_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...
 
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...
 

Detailed Description

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.

Typedef Documentation

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.

Parameters
fullspecabsolute or relative path spec, with filename and ext. this regular file exists
mtimelast-modified time for the backup file
cookieopaque handle passed from start of callbacks
Returns
status; Return fatal error to stop the traversal or NO_ERR to keep the traversal going. Do not return any warning or recoverable error, just log and move on
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.

Parameters
fullspecabsolute or relative path spec, with filename and ext. this regular file exists, but has not been checked for read access of
cookieopaque handle passed from start of callbacks
Returns
status; Return fatal error to stop the traversal or NO_ERR to keep the traversal going. Do not return any warning or recoverable error, just log and move on
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

Parameters
fullspecabsolute filename of conf file
cookieopaque handle passed from start of callbacks
Returns
status; Return fatal error to stop the traversal or NO_ERR to keep the traversal going. Do not return any warning or recoverable error, just log and move on
typedef void(* search_dumpfn_t) (log_debug_t level, const char *fstr,...)

Callback to do log dump function for show searchpath.

Parameters
leveldebug level to use
fstrformat string
...extra parameters based on fstr

Function Documentation

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
Parameters
modnamemodule name with no path prefix or file extension
revisionoptional revision date of 'modname' to find
savedevQQ of ncx_save_deviations_t to use, if any
savemodQQ 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
topfailedQQ of failed_ptr_t used to make sure that the current module has never failed
retmodaddress of return module (may be NULL)
Return values
*retmodpointer to requested module version
Returns
status

Here is the call graph for this function:

void ncxmod_clean_search_result_queue ( dlq_hdr_t *  searchQ)

Clean and free all the search result structs in the specified Q.

Parameters
searchQQ of ncxmod_search_result_t to clean and free

Here is the call graph for this function:

Here is the caller graph for this function:

void ncxmod_cleanup ( void  )

Cleanup the ncxmod module.

Here is the call graph for this function:

Here is the caller graph for this function:

void ncxmod_clear_altpath ( void  )

Clear the alternate path so none is used (for yangdiff)

Here is the caller graph for this function:

ncxmod_search_result_t* ncxmod_clone_search_result ( const ncxmod_search_result_t sr)

Clone a search result.

Parameters
srsearchresult to clone
Returns
pointer to malloced and filled in clone of sr

Here is the call graph for this function:

status_t ncxmod_copy_text_file ( const xmlChar *  src_filespec,
const xmlChar *  dest_filespec 
)

Copy the source text file to the fully specified filespec.

Parameters
src_filespecsource filespec to copy from
dest_filespecdestination filespec to copy from
Returns
status

Here is the call graph for this function:

void ncxmod_dump_module_search_path ( search_dumpfn_t  dumpfn,
log_debug_t  loglevel 
)

Output the YANG module search path.

Parameters
dumpfnCallback function to do output, E.g., Can use log_info
loglevel== required log level to print anything

Here is the call graph for this function:

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
Parameters
resultQaddress of Q to store malloced search results
Return values
resultQmay have malloced ncxmod_search_result_t structs queued into it representing the modules found in the search
Returns
status

Here is the caller graph for this function:

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

Parameters
resultQaddress of Q to stor malloced search results
Return values
resultQmay have malloced ncxmod_zsearch_result_t structs queued into it representing the modules found in the search
Returns
status

Here is the call graph for this function:

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
Parameters
fnamefile name with extension
if the first char is '.' or '/', then an absolute path is assumed, and the search path will not be tries
generrorsTRUE if error message should be generated
FALSE if no error message
backup_fileTRUE if this is a backup file; FALSE if general file
resaddress of status result
Return values
*resstatus
Returns
pointer to the malloced and initialized string containing the complete filespec or NULL if not found It must be freed after use!!!

Here is the call graph for this function:

Here is the caller graph for this function:

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
Parameters
modnamemodule name with no path prefix or file extension
revisionoptional revision date of 'modname' to find
Returns
malloced and filled in search result struct; MUST call ncxmod_free_search_result() if the return value is non-NULL CHECK result->res TO SEE IF MODULE WAS FOUND A SEARCH RESULT WILL BE RETURNED IF A SEARCH WAS ATTEMPTED, EVEN IF NOTHING FOUND
NULL if any error preventing a search

Here is the call graph for this function:

Here is the caller graph for this function:

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
Parameters
fnamefile name with extension if the first char is '.' or '/', then an absolute path is assumed, and the search path will not be tries
resaddress of status result
Return values
*resstatus
Returns
pointer to the malloced and initialized string containing the complete filespec or NULL if not found It must be freed after use!!!

Here is the call graph for this function:

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

Parameters
searchQQ of ncxmod_search_result_t to check
modnamemodule or submodule name to find
revisionrevision-date to find
nsurinamespace URI fo find
Returns
pointer to first matching record; NULL if not found

Here is the call graph for this function:

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
Parameters
fnamefile name with extension
if the first char is '.' or '/', then an absolute path is assumed, and the search path will not be tries
fileloc_fhsTRUE if using FHS file locations; FALSE if not
generrorsTRUE if error message should be generated
FALSE if no error message
backup_fileTRUE if this is a backup file; FALSE if general file
keep_resultTRUE to return failed filespec even if *res == not-found
resaddress of status result
Return values
*resstatus
Returns
pointer to the malloced and initialized string containing the complete filespec or NULL if not found It must be freed after use!!!

Here is the call graph for this function:

Here is the caller graph for this function:

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
Parameters
fnameSIL file name with extension
generrorsTRUE if error message should be generated
FALSE if no error message
resaddress of status result
Return values
*resstatus
Returns
pointer to the malloced and initialized string containing the complete filespec or NULL if not found It must be freed after use!!!

Here is the call graph for this function:

Here is the caller graph for this function:

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
Parameters
fnamefile name with extension if the first char is '/', then an absolute path is assumed, and the search path will not be tried
resaddress of status result
Return values
*resstatus
Returns
pointer to the malloced and initialized string containing the complete filespec or NULL if not found It must be freed after use!!!

Here is the call graph for this function:

void ncxmod_free_program_tempdir ( ncxmod_temp_progcb_t progcb)

Remove a program instance temp files directory.

Parameters
progcbtempoeray program instance control block to free
void ncxmod_free_search_result ( ncxmod_search_result_t searchresult)

Clean and free a search result struct.

Parameters
searchresultstruct to clean and free

Here is the caller graph for this function:

void ncxmod_free_session_tempdir ( ncxmod_temp_progcb_t progcb,
uint32  sidnum 
)

Clean and free a session instance temp files directory.

Parameters
progcbprogram instance control block to use
sidnummanager session number to delete

Here is the call graph for this function:

void ncxmod_free_session_tempfile ( ncxmod_temp_filcb_t filcb)

Clean and free a session instance temp files directory.

Parameters
filcbfile control block to delete

Here is the call graph for this function:

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

Parameters
cbfncallback function to use
cookiecookie to pass to the callback function
Returns
status of the operation

Here is the call graph for this function:

Here is the caller graph for this 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.

Parameters
confdirdirectory to check for *.conf
must_existTRUE if error for dir to be missing and accessible
FALSE to just skip
cbfncallback function to use
cookiecookie to pass to the callback function
Returns
status of the operation

Here is the call graph for this function:

Here is the caller graph for this function:

const xmlChar* ncxmod_get_envvar ( const xmlChar *  name,
uint32  namelen 
)

Get the specified shell environment variable.

Parameters
namename of the environment variable (may not be zero-terminiated)
namelenlength of name string
Returns
const pointer to the specified environment variable value

Here is the caller graph for this function:

status_t ncxmod_get_file_mtime ( const xmlChar *  filespec,
time_t *  timebuff 
)

Get the last-modified time for a file.

Parameters
filespecfull file spec to check
timebuffbuffer to hold the timestamp
Returns
status
const xmlChar* ncxmod_get_home ( void  )

Get the HOME or –home parameter value, whichever is in effect, if any.

Returns
const point to the home variable, or NULL if not set
uint32 ncxmod_get_pathlen_from_filespec ( const xmlChar *  filespec)

Get the length of th path part of the filespec string.

Parameters
filespecfile spec to check
Returns
number of chars to keep for the path spec

Here is the call graph for this function:

Here is the caller graph for this function:

xmlChar* ncxmod_get_pid_filespec ( const xmlChar *  progname,
boolean  fileloc_fhs,
status_t res 
)

Get the PID file specification for the given program name.

Parameters
prognameprogram name to use
fileloc_fhsTRUE for FHS locations; FALSE for yumadir location
resaddress of return status
Return values
*resreturn status
Returns
malloced filespec string for the program PID file

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Parameters
subdirsubdirectory name to use
fileloc_fhsTRUE for FHS locations; FALSE for yumadir location
resaddress of return status
Return values
*resreturn status
Returns
malloced filespec string for the program PID file

Here is the call graph for this function:

const xmlChar* ncxmod_get_userhome ( const xmlChar *  user,
uint32  userlen 
)

Get the user home dir from the passwd file.

Parameters
useruser name string (may not be zero-terminiated)
userlenlength of user
Returns
const pointer to the user home directory string

Here is the caller graph for this function:

const xmlChar* ncxmod_get_yuma_home ( void  )

Get the YUMAPRO_HOME or –yuma-home parameter value, whichever is in effect, if any.

Returns
const point to the yuma_home variable, or NULL if not set

Here is the caller graph for this function:

const xmlChar* ncxmod_get_yuma_install ( void  )

Get the YUMAPRO_INSTALL or default install parameter value, whichever is in effect.

Returns
const point to the YUMAPRO_INSTALL value
const xmlChar* ncxmod_get_yumadir ( void  )

Get the yuma directory being used.

Returns
pointer to the yuma dir string

Here is the caller graph for this function:

status_t ncxmod_init ( void  )

Initialize the ncxmod module.

Returns
status

Here is the call graph for this function:

Here is the caller graph for this function:

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
Parameters
helpmodeBRIEF, NORMAL or FULL
logstdoutTRUE to use log_stdout
FALSE to use log_write
Returns
status of the operation

Here is the call graph for this function:

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
Parameters
helpmodeBRIEF, NORMAL or FULL
logstdoutTRUE to use log_stdout; FALSE to use log_write
Returns
status of the operation

Here is the call graph for this function:

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
Parameters
helpmodeBRIEF, NORMAL or FULL
logstdoutTRUE to use log_stdout
FALSE to use log_write
Returns
status of the operation

Here is the call graph for this function:

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
Parameters
devinameannotation module name with no path prefix or file extension
deviationQaddress of Q of ncx_save_deviations_t structs to add any new entries
Return values
deviationQhas malloced ncx_save_deviations_t structs added
Returns
status
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
Parameters
devinamedeviation module name with no path prefix or file extension
deviationQaddress of Q of ncx_save_deviations_t structs to add any new entries
Return values
deviationQhas malloced ncx_save_deviations_t structs added
Returns
status

Here is the caller graph for this function:

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
Parameters
modnamemodule name with no path prefix or file extension
revisionoptional revision date of 'modname' to find
pcbYANG parser control block
ptypYANG parser source type
parentpointer 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
retmodaddress of return module
Return values
*retmodpointer to found module (if NO_ERR)
Returns
status

Here is the call graph for this function:

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
Parameters
modnamemodule name with no path prefix or file extension
revisionoptional revision date of 'modname' to find
savedevQQ of ncx_save_deviations_t to use, if any
retmodaddress of return module (may be NULL)
Return values
*retmodpointer to requested module version
Returns
status

Here is the call graph for this function:

Here is the caller graph for this function:

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!!

Parameters
modnamemodule name with no path prefix or file extension
revisionoptional revision date of 'modname' to find
with_submodsTRUE if YANG_PT_TOP mode should skip submodules
== FALSE if top-level mode should process sub-modules
modpathmodule path to override the modpath CLI var or the YUMAPRO_MODPATH env var
savedevQQ of ncx_save_deviations_t to use
resaddress of return status
Return values
*resreturn status
Returns
pointer to malloced parser control block, or NULL of none

Here is the call graph for this function:

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

Parameters
modnamemodule name with no path prefix or file extension
revisionoptional revision date of 'modname' to find
with_submodsTRUE if YANG_PT_TOP mode should skip submodules
FALSE if top-level mode should process sub-modules
savetkcTRUE if the parse chain should be saved (e.g., YIN)
keepmodeTRUE 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
docmodeTRUE if need to preserve strings for –format=html or yang
FALSE if no need to preserve string token sequences
savedevQQ of ncx_save_deviations_t to use
resaddress of return status
Return values
*resreturn status
Returns
pointer to malloced parser control block, or NULL of none

Here is the call graph for this function:

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
Parameters
modnamemodule name with no path prefix or file extension
revisionoptional revision date of 'modname' to find
savedevQQ of ncx_save_deviations_t to use, if any
is_loadpathTRUE if loadpath load so silently skip submodules
retmodaddress of return module (may be NULL)
Return values
*retmodpointer to requested module version
Returns
status

Here is the call graph for this function:

Here is the caller graph for this function:

void ncxmod_log_env ( void  )

Report the environment variables used by the running system.

Here is the call graph for this function:

Here is the caller graph for this function:

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
Parameters
fnamefile name with extension if the first char is '.' or '/', then an absolute path is assumed, and the search path will not be tries
backup_fileTRUE if this is a backup file; FALSE if general file
resaddress of status result
Return values
*resstatus
Returns
pointer to the malloced and initialized string containing the complete filespec or NULL if no suitable location for the datafile is found It must be freed after use!!!

Here is the call graph for this function:

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.

Parameters
srcspecsource filespec to use
fnamefile name with extension if the first char is '.' or '/', then an absolute path is assumed, and the search path will not be tries
resaddress of status result
Return values
*resstatus
Returns
pointer to the malloced and initialized string containing the complete filespec or NULL if some error occurred

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Parameters
fnamefile name with extension if the first char is '.' or '/', then an absolute path is assumed, and the search path will not be tries
fileloc_fhsTRUE if FHS locations; FALSE if $HOME/.yumapro
backup_fileTRUE if this is a backup file; FALSE if general file
resaddress of status result
Return values
*resstatus
Returns
pointer to the malloced and initialized string containing the complete filespec or NULL if no suitable location for the datafile is found It must be freed after use!!!

Here is the call graph for this function:

Here is the caller graph for this function:

ncxmod_temp_progcb_t* ncxmod_new_program_tempdir ( status_t res)

Setup a program instance temp files directory.

Parameters
resaddress of return status
Return values
*resreturn status
Returns
malloced tempdir_progcb_t record (if NO_ERR)

Here is the call graph for this function:

ncxmod_search_result_t* ncxmod_new_search_result ( void  )

Malloc and initialize a search result struct.

Returns
malloced and initialized struct, NULL if ERR_INTERNAL_MEM

Here is the caller graph for this function:

ncxmod_search_result_t* ncxmod_new_search_result_ex ( const ncx_module_t mod)

Malloc and initialize a search result struct.

Parameters
modmodule struct to use
Returns
malloced and initialized struct, NULL if ERR_INTERNAL_MEM

Here is the call graph for this function:

ncxmod_search_result_t* ncxmod_new_search_result_str ( const xmlChar *  modname,
const xmlChar *  revision 
)

Malloc and initialize a search result struct.

Parameters
modnamemodule name string to use
revisionrevision date to use (may be NULL)
Returns
malloced and initialized struct, NULL if ERR_INTERNAL_MEM

Here is the call graph for this function:

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.

Parameters
progcbprogram instance control block to use
sidnummanager session ID of the new session instance control block
resaddress of return status
Return values
*resreturn status
Returns
malloced tempdir_sescb_t record

Here is the call graph for this function:

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.

Parameters
sescbsession instance control block to use
filenamefilename to create in the temp directory
resaddress of return status
Return values
*resreturn status
Returns
malloced tempdir_sescb_t record

Here is the call graph for this function:

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

Parameters
startspecabsolute or relative pathspec to start the search. If this is not a valid pathname, processing will exit immediately.
callbackaddress of the ncxmod_callback_fn_t function to use for this traveral
cookiecookie to pass to each invocation of the callback
Returns
NO_ERR if file found okay, full filespec in the 'buff' variable OR some error if not found or buffer overflow

Here is the call graph for this function:

Here is the caller graph for this function:

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!!

Parameters
numfilefull filespec of the uint64 file
curnumaddress of return number
file_errorTRUE if the file is expected to exist; ALSE if OK not to exist
Return values
*curnumreturn number found
Returns
status

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Parameters
cbfncallback function to invoke for each found module
cookiepointer to pass to callback as the cookie parm
Returns
status NO_ERR to continue walk; some error to stop walk

Here is the call graph for this function:

void ncxmod_set_altpath ( const xmlChar *  altpath)

Set the alternate path that should be used first (for yangdiff)

Parameters
altpathfull path string to use must be static a const back-pointer is kept, not a copy

Here is the caller graph for this function:

void ncxmod_set_datapath ( const xmlChar *  datapath)

Override the YUMA_DATAPATH env var with the datapath CLI var.

Parameters
datapathnew YUMA_DATAPATH value
NULL or empty string to disable

Here is the call graph for this function:

Here is the caller graph for this function:

status_t ncxmod_set_home ( const xmlChar *  home)

Override the HOME env var with the home CLI var.

Parameters
homenew HOME value
NULL or empty string to disable
Returns
status; ERR_NCX_OPERATION_FAILED if cannot change to the dir

Here is the call graph for this function:

Here is the caller graph for this function:

void ncxmod_set_loadpath ( const xmlChar *  loadpath)

Override the YUMAPRO_LOADPATH env var with the loadpath CLI var.

THIS MAY GET SET DURING BOOTSTRAP SO SET_ERROR NOT CALLED !!! MALLOC FAILED IGNORED!!!

Parameters
loadpathnew YUMAPRO_LOADPATH value
NULL or empty string to disable

Here is the call graph for this function:

Here is the caller graph for this function:

void ncxmod_set_modpath ( const xmlChar *  modpath)

Override the YUMAPRO_MODPATH env var with the modpath CLI var.

THIS MAY GET SET DURING BOOTSTRAP SO SET_ERROR NOT CALLED !!! MALLOC FAILED IGNORED!!!

Parameters
modpathnew YUMAPRO_MODPATH value
NULL or empty string to disable

Here is the call graph for this function:

Here is the caller graph for this function:

void ncxmod_set_runpath ( const xmlChar *  runpath)

Override the YUMAPRO_RUNPATH env var with the runpath CLI var.

Parameters
runpathnew YUMAPRO_RUNPATH value
NULL or empty string to disable

Here is the call graph for this function:

Here is the caller graph for this function:

void ncxmod_set_subdirs ( boolean  usesubdirs)

Set the subdirs flag to FALSE if the no-subdirs CLI param is set.

Parameters
usesubdirsTRUE if subdirs searchs should be done
FALSE if subdir searches should not be done

Here is the caller graph for this function:

status_t ncxmod_set_yuma_home ( const xmlChar *  yumahome)

Override the YUMAPRO_HOME env var with the yuma-home CLI var.

THIS MAY GET SET DURING BOOTSTRAP SO SET_ERROR NOT CALLED !!! MALLOC FAILED IGNORED!!!

Parameters
yumahomenew YUMAPRO_HOME value
NULL or empty string to disable
Returns
status

Here is the call graph for this function:

Here is the caller graph for this function:

status_t ncxmod_setup_backup_dir ( const xmlChar *  backup_dir)

Setup the ~/.yumapro/backups directory if it does not exist.

Returns
status

Here is the call graph for this function:

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
Returns
status

Here is the call graph for this function:

Here is the caller graph for this function:

status_t ncxmod_setup_recordtest_dir ( void  )

Setup the ~/.yuma/recordtest directory if it does not exist.

Returns
status

Here is the call graph for this function:

status_t ncxmod_setup_tempdir ( void  )

Setup the ~/.yuma/tmp directory if it does not exist.

Returns
status

Here is the call graph for this function:

status_t ncxmod_setup_yangcli_cache_dir ( const xmlChar *  cache_dir)

Setup the ~/.yumapro/.yangcli_cache directory if it does not exist.

Returns
status

Here is the call graph for this function:

status_t ncxmod_setup_yumadir ( void  )

Setup the ~/.yuma directory if it does not exist.

Returns
status

Here is the call graph for this function:

Here is the caller graph for this function:

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

Parameters
pathpath spec to use
Returns
status

Here is the call graph for this function:

void ncxmod_subsys_info_remove ( const xmlChar *  filespec)

Remove the subsystem info file.

Parameters
filespecfull filespec of the subsys info file

Here is the call graph for this function:

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

Parameters
filespecfull filespec of the subsys info file
ipaddrIP address string to write
portnumTCP port number to write
Returns
status

Here is the call graph for this function:

boolean ncxmod_test_filespec ( const xmlChar *  filespec)

Check the exact filespec to see if it a file.

Parameters
filespecfile spec to check
Returns
TRUE if valid readable file; FALSE otherwise

Here is the caller graph for this function:

boolean ncxmod_test_subdir ( const xmlChar *  dirspec)

Check if the specified string is a directory.

Parameters
dirspecstring to check as a directory spec
Returns
TRUE if the string is a directory spec that this user is allowed to open; FALSE otherwise

Here is the caller graph for this function:

boolean ncxmod_use_bestmatch_now ( const xmlChar *  revision)

Check if the bestmatch can be used for this module.

Parameters
revisionrevision name
Returns
TRUE if bestmatch should be tried; FALSE otherwise
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!!

Parameters
numfilefull filespec of the number file
curnumnew number to write
Returns
status

Here is the call graph for this function:

Here is the caller graph for this function: