yumapro  23.10T-6
YumaPro SDK
Loading...
Searching...
No Matches
ncxmod.h File Reference

NCX Module Load Manager. More...

#include <xmlstring.h>
#include <time.h>
#include "cap.h"
#include "help.h"
#include "ncxtypes.h"
#include "status.h"
#include "yang.h"
Include dependency graph for ncxmod.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

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_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 ~/.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_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...
 
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...
 

Detailed Description

NCX Module Load Manager.

  • manages NCX module search path
  • loads NCX module files by module name