yumapro  20.10-12
YumaPro SDK
ncxmod.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2008 - 2012, Andy Bierman, All Rights Reserved.
3  * Copyright (c) 2012 - 2017, YumaWorks, Inc., All Rights Reserved.
4  *
5  * Unless required by applicable law or agreed to in writing,
6  * software distributed under the License is distributed on an
7  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
8  * KIND, either express or implied. See the License for the
9  * specific language governing permissions and limitations
10  * under the License.
11  */
12 #ifndef _H_ncxmod
13 #define _H_ncxmod
14 
15 /* FILE: ncxmod.h
16 *********************************************************************
17 * *
18 * P U R P O S E *
19 * *
20 *********************************************************************/
21 
30 /*********************************************************************
31 * *
32 * C H A N G E H I S T O R Y *
33 * *
34 *********************************************************************
35 
36 date init comment
37 ----------------------------------------------------------------------
38 10-nov-05 abb Begun
39 22-jan-08 abb Add support for YANG import and include
40  Unlike NCX, forward references are allowed
41  so import/include loops have to be tracked
42  and prevented
43 16-feb-08 abb Changed environment variables from NCX to YANG
44  Added YANG_INSTALL envvar as well.
45 22-jul-08 abb Remove NCX support -- YANG only from now on
46 06-oct-09 abb Change YANG_ env vars to YUMA_
47 */
48 
49 #include <xmlstring.h>
50 
51 /* used for timestamps and time deltas */
52 #include <time.h>
53 
54 #ifndef _H_cap
55 #include "cap.h"
56 #endif
57 
58 #ifndef _H_help
59 #include "help.h"
60 #endif
61 
62 #ifndef _H_ncxtypes
63 #include "ncxtypes.h"
64 #endif
65 
66 #ifndef _H_status
67 #include "status.h"
68 #endif
69 
70 #ifndef _H_yang
71 #include "yang.h"
72 #endif
73 
74 #ifdef __cplusplus
75 extern "C" {
76 #endif
77 
78 /********************************************************************
79 * *
80 * C O N S T A N T S *
81 * *
82 *********************************************************************/
83 
84 /* max user-configurable directories for NCX and YANG modules */
85 #define NCXMOD_MAX_SEARCHPATH 64
86 
87 /* maximum abolute filespec */
88 #define NCXMOD_MAX_FSPEC_LEN 2047
89 
90 /* path, file separator char */
91 #define NCXMOD_PSCHAR '/'
92 
93 #define NCXMOD_HMCHAR '~'
94 
95 #define NCXMOD_ENVCHAR '$'
96 
97 #define NCXMOD_DOTCHAR '.'
98 
99 /* name of the NCX module containing agent boot parameters
100  * loaded during startup
101  */
102 #define NCXMOD_NETCONFD (const xmlChar *)"netconfd-pro"
103 
104 #define NCXMOD_NCX (const xmlChar *)"yuma-ncx"
105 
106 #define NCXMOD_RESTCONF (const xmlChar *)"ietf-restconf"
107 
108 #define NCXMOD_YANG_DATA_EXT (const xmlChar *)"yang-data-ext"
109 
110 #define NCXMOD_YUMA_NACM (const xmlChar *)"yuma-nacm"
111 
112 #define NCXMOD_YUMA_TIME_FILTER (const xmlChar *)"yuma-time-filter"
113 
114 #define NCXMOD_YUMAWORKS_ATTRS (const xmlChar *)"yumaworks-attrs"
115 
116 #define NCXMOD_YUMAWORKS_CONFIG_CHANGE \
117  (const xmlChar *)"yumaworks-config-change"
118 
119 #define NCXMOD_YUMAWORKS_EVENT_FILTER \
120  (const xmlChar *)"yumaworks-event-filter"
121 
122 #define NCXMOD_YUMAWORKS_EVENT_STREAM \
123  (const xmlChar *)"yumaworks-event-stream"
124 
125 #define NCXMOD_YUMAWORKS_GETBULK (const xmlChar *)"yumaworks-getbulk"
126 
127 #define NCXMOD_YUMAWORKS_IDS (const xmlChar *)"yumaworks-ids"
128 
129 #define NCXMOD_YUMAWORKS_INTERNAL (const xmlChar *)"yumaworks-internal"
130 
131 #define NCXMOD_YUMAWORKS_SERVER (const xmlChar *)"yumaworks-server"
132 
133 #define NCXMOD_YUMAWORKS_SYSTEM (const xmlChar *)"yumaworks-system"
134 
135 #define NCXMOD_YUMAWORKS_TYPES (const xmlChar *)"yumaworks-types"
136 
137 #define NCXMOD_YUMAWORKS_APP_COMMON (const xmlChar *)"yumaworks-app-common"
138 
139 #define NCXMOD_YUMA_APP_COMMON (const xmlChar *)"yuma-app-common"
140 
141 #define NCXMOD_YUMA_TYPES (const xmlChar *)"yuma-types"
142 
143 #define NCXMOD_YANGCLI (const xmlChar *)"yangcli-pro"
144 
145 #define NCXMOD_YANG_API (const xmlChar *)"yumaworks-yang-api"
146 
147 #define NCXMOD_YUMA_RESTCONF (const xmlChar *)"yumaworks-restconf"
148 
149 #define NCXMOD_YUMA_IDS (const xmlChar *)"yumaworks-ids"
150 
151 #define NCXMOD_YUMA_SUPPORT_SAVE (const xmlChar *)"yumaworks-support-save"
152 
153 #define NCXMOD_YUMA_TERM_MSG (const xmlChar *)"yumaworks-term-msg"
154 
155 /* name of the NETCONF module containing NETCONF protocol definitions,
156  * that is loaded by default during startup
157  */
158 #define NCXMOD_NETCONF (const xmlChar *)"yuma-netconf"
159 
160 #define NCXMOD_YUMA_NETCONF (const xmlChar *)"yuma-netconf"
161 
162 #define NCXMOD_IETF_INTERFACES (const xmlChar *)"ietf-interfaces"
163 
164 #define NCXMOD_IETF_NETCONF (const xmlChar *)"ietf-netconf"
165 
166 #define NCXMOD_IETF_NETCONF_REV (const xmlChar *)"2011-06-01"
167 
168 #define NCXMOD_IETF_YANG_PATCH (const xmlChar *)"ietf-yang-patch"
169 
170 #define NCXMOD_IETF_YANG_TYPES (const xmlChar *)"ietf-yang-types"
171 
172 #define NCXMOD_IETF_INET_TYPES (const xmlChar *)"ietf-inet-types"
173 
174 #define NCXMOD_IETF_NETCONF_STATE (const xmlChar *)"ietf-netconf-monitoring"
175 
176 #define NCXMOD_IETF_NACM (const xmlChar *)"ietf-netconf-acm"
177 
178 #define NCXMOD_WITH_DEFAULTS (const xmlChar *)"ietf-netconf-with-defaults"
179 
180 #define NCXMOD_YUMAWORKS_EXTENSIONS (const xmlChar *)"yumaworks-extensions"
181 
182 #define NCXMOD_FHS_RUNDIR (const xmlChar *)"/var/run/netconfd-pro"
183 
184 #define NCXMOD_FHS_LIBDIR (const xmlChar *)"/var/lib/netconfd-pro"
185 
186 #define NCXMOD_FHS_LOGDIR (const xmlChar *)"/var/log/netconfd-pro"
187 
188 #define NCXMOD_FHS_LOGSPEC \
189  (const xmlChar *)"/var/log/netconfd-pro/server.log"
190 
191 #define NCXMOD_FHS_AUDIT_LOGSPEC \
192  (const xmlChar *)"/var/log/netconfd-pro/audit.log"
193 
194 #define NCXMOD_NETCONF_NOTIFICATIONS \
195  (const xmlChar *)"ietf-netconf-notifications"
196 
197 #define NCXMOD_PARTIAL_LOCK (const xmlChar *)"ietf-netconf-partial-lock"
198 
199 #define NCXMOD_CRYPT_HASH (const xmlChar *)"iana-crypt-hash"
200 
201 /* name of the RESTCONF modules, that is loaded during startup
202  * if WITH_RESTCONF flag is present
203  */
204 #define NCXMOD_YANG_LIBRARY (const xmlChar *)"ietf-yang-library"
205 #define NCXMOD_RESTMON (const xmlChar *)"ietf-restconf-monitoring"
206 
207 /* IETF NMDA modules */
208 #define NCXMOD_IETF_DATASTORES (const xmlChar *)"ietf-datastores"
209 #define NCXMOD_IETF_ORIGIN (const xmlChar *)"ietf-origin"
210 #define NCXMOD_IETF_NETCONF_NMDA (const xmlChar *)"ietf-netconf-nmda"
211 
212 /* hooks-test modules is loaded during startup
213  * if WITH_HOKS_TEST flag is present
214  */
215 #define NCXMOD_HOOKS_TEST (const xmlChar *)"hooks-test"
216 
217 #define NCXMOD_YUMA_SYSTEM (const xmlChar *)"yuma-system"
218 
219 /* Openconfig extensions module containing OpenConfig extension definitions
220  * "oc-ext:openconfig-version" that is mandadory filed in gNMI
221  * capability-request
222  */
223 #define NCXMOD_OC_EXT (const xmlChar *)"openconfig-extensions"
224 
225 /* name of the NCX modules directory appended when YUMAPRO_HOME or HOME
226  * ENV vars used to construct NCX module filespec
227  */
228 #define NCXMOD_DIR (const xmlChar *)"modules"
229 
230 /* name of the data direectory when YUMAPRO_HOME or HOME
231  * ENV vars used to construct an NCX filespec
232  */
233 #define NCXMOD_DATA_DIR (const xmlChar *)"data"
234 
235 /* name of the scripts directory when YUMAPRO_HOME or HOME
236  * ENV vars used to construct a NCX filespec
237  */
238 #define NCXMOD_SCRIPT_DIR (const xmlChar *)"scripts"
239 
240 /* name of the test-suites directory */
241 #define NCXMOD_TEST_SUITE_DIR (const xmlChar *)"test-suites"
242 
243 /* STD Environment Variable for user home directory */
244 #define NCXMOD_PWD "PWD"
245 
246 /* STD Environment Variable for user home directory */
247 #define USER_HOME "HOME"
248 
249 /* NCX Environment Variable for YANG/NCX user work home directory */
250 #define NCXMOD_HOME "YUMAPRO_HOME"
251 
252 /* NCX Environment Variable for tools install directory
253  * The default is /usr/share/yuma
254  */
255 #define NCXMOD_INSTALL "YUMAPRO_INSTALL"
256 
257 /* !! should import this from make !! */
258 #if defined(FREEBSD) || defined(MACOSX)
259 #define NCXMOD_DEFAULT_INSTALL (const xmlChar *)"/usr/local/share/yumapro"
260 #else
261 #define NCXMOD_DEFAULT_INSTALL (const xmlChar *)"/usr/share/yumapro"
262 #endif
263 
264 /* !! should import this from make !! */
265 #define NCXMOD_DEFAULT_YUMALIB64 (const xmlChar *)"/usr/lib64/yumapro"
266 
267 #ifdef MACOSX
268 #define NCXMOD_DEFAULT_YUMALIB (const xmlChar *)"/usr/local/lib/yumapro"
269 #else
270 #define NCXMOD_DEFAULT_YUMALIB (const xmlChar *)"/usr/lib/yumapro"
271 #endif
272 
273 
274 /* !! should import this from make !! */
275 #define NCXMOD_ETC_DATA (const xmlChar *)"/etc/yumapro"
276 
277 /* NCX Environment Variable for MODULE search path */
278 #define NCXMOD_MODPATH "YUMAPRO_MODPATH"
279 
280 /* NCX Environment Variable for DATA search path */
281 #define NCXMOD_DATAPATH "YUMAPRO_DATAPATH"
282 
283 /* NCX Environment Variable for SCRIPTS search path */
284 #define NCXMOD_RUNPATH "YUMAPRO_RUNPATH"
285 
286 /* NCX Environment Variable for MODULE load path */
287 #define NCXMOD_LOADPATH "YUMAPRO_LOADPATH"
288 
289 /* per user yangcli internal data home when $HOME defined */
290 #define NCXMOD_YUMA_DIR (const xmlChar *)"~/.yumapro"
291 
292 /* per user yangcli internal data home when $HOME not defined */
293 #define NCXMOD_TEMP_YUMA_DIR (const xmlChar *)"/tmp/yumapro"
294 
295 /* Yuma work directory name */
296 #define NCXMOD_YUMA_DIRNAME (const xmlChar *)".yumapro"
297 
298 /* sub-directory name yangcli uses to store local per-session workdirs
299  * appended to ncxmod_yumadir_path
300  */
301 #define NCXMOD_TEMP_DIR (const xmlChar *)"/tmp"
302 
303 /* directory uses to store rpydata per step of recorded test
304  */
305 #define NCXMOD_UT_RECORDTEST_DIR (const xmlChar *)"/recordtest"
306 
307 /* directory uses to store cache schemas.
308  */
309 #define NCXMOD_YANGCLI_CACHE_DIR (const xmlChar *)"/.yangcli_cache"
310 
311 
312 #define NCXMOD_GET_SOURCE_NEEDED(s) \
313  (*(s) == (xmlChar)'~' || *(s) == (xmlChar)'.' || *(s) == (xmlChar)'$')
314 
315 #define NCXMOD_SEARCH_MODULE(R) (R)->module
316 
317 #define NCXMOD_SEARCH_REVISION(R) (R)->revision
318 
319 #define NCXMOD_SEARCH_SOURCE(R) (R)->source
320 
321 #define NCXMOD_SEARCH_NAMESPACE(R) (R)->namespacestr
322 
323 /* ncxmod_search_result_t flags */
324 #define NCXMOD_FL_CAPMATCH bit0
325 #define NCXMOD_FL_ISMOD bit1
326 #define NCXMOD_FL_BEST bit2
327 
328 #define NCXMOD_SET_CAPMATCH(R) (R)->flags |= NCXMOD_FL_CAPMATCH
329 #define NCXMOD_CLR_CAPMATCH(R) (R)->flags &= ~NCXMOD_FL_CAPMATCH
330 #define NCXMOD_IS_CAPMATCH(R) ((R)->flags & NCXMOD_FL_CAPMATCH)
331 
332 #define NCXMOD_SET_ISMOD(R) (R)->flags |= NCXMOD_FL_ISMOD
333 #define NCXMOD_IS_ISMOD(R) ((R)->flags & NCXMOD_FL_ISMOD)
334 
335 #define NCXMOD_SET_BEST(R) (R)->flags |= NCXMOD_FL_BEST
336 #define NCXMOD_IS_BEST(R) ((R)->flags & NCXMOD_FL_BEST)
337 
338 /********************************************************************
339 * *
340 * T Y P E S *
341 * *
342 *********************************************************************/
343 
356 /* following 3 structs used for providing temporary
357  * work directories for yangcli sessions
358  */
359 
361 typedef struct ncxmod_temp_progcb_t_ {
362  dlq_hdr_t qhdr;
363  xmlChar *source;
364  dlq_hdr_t temp_sescbQ;
365 } ncxmod_temp_progcb_t;
366 
367 
369 typedef struct ncxmod_temp_sescb_t_ {
370  dlq_hdr_t qhdr;
371  xmlChar *source;
372  uint32 sidnum;
373  dlq_hdr_t temp_filcbQ;
374 } ncxmod_temp_sescb_t;
375 
376 
378 typedef struct ncxmod_temp_filcb_t_ {
379  dlq_hdr_t qhdr;
380  xmlChar *source;
381  const xmlChar *filename;
382 } ncxmod_temp_filcb_t;
383 
384 
390 typedef struct ncxmod_search_result_t_ {
391  dlq_hdr_t qhdr;
392  xmlChar *module;
393  xmlChar *belongsto;
394  xmlChar *revision;
395  xmlChar *namespacestr;
396  xmlChar *source;
397  ncx_module_t *mod;
398  status_t res;
399  uint32 nslen;
400  cap_rec_t *cap;
401  uint8 flags;
402 } ncxmod_search_result_t;
403 
404 
424 typedef status_t (*ncxmod_callback_fn_t) (const char *fullspec,
425  void *cookie);
426 
427 
428 
445 typedef status_t (*ncxmod_backup_cbfn_t) (const char *fullspec,
446  const xmlChar *mtime,
447  void *cookie);
448 
449 
462 typedef status_t
463  (*ncxmod_conf_cbfn_t) (const xmlChar *fullspec,
464  void *cookie);
465 
466 
467 
475 typedef void (*search_dumpfn_t) (log_debug_t level, const char *fstr, ...);
476 
477 
478 /********************************************************************
479 * *
480 * F U N C T I O N S *
481 * *
482 *********************************************************************/
483 
484 
490 extern status_t
491  ncxmod_init (void);
492 
493 
498 extern void
499  ncxmod_log_env (void);
500 
501 
506 extern void
507  ncxmod_cleanup (void);
508 
509 
535 extern status_t
536  ncxmod_load_module (const xmlChar *modname,
537  const xmlChar *revision,
538  dlq_hdr_t *savedevQ,
539  ncx_module_t **retmod);
540 
541 
568 extern status_t
569  ncxmod_load_module_loadpath (const xmlChar *modname,
570  const xmlChar *revision,
571  dlq_hdr_t *savedevQ,
572  boolean is_loadpath,
573  ncx_module_t **retmod);
574 
575 
576 
610 extern status_t
611  ncxmod_autoload_module (const xmlChar *modname,
612  const xmlChar *revision,
613  dlq_hdr_t *savedevQ,
614  dlq_hdr_t *savemodQ,
615  dlq_hdr_t *topfailedQ,
616  ncx_module_t **retmod);
617 
618 
645 extern ncxmod_search_result_t *
646  ncxmod_find_module (const xmlChar *modname,
647  const xmlChar *revision);
648 
649 
676 extern status_t
677  ncxmod_find_all_modules (dlq_hdr_t *resultQ);
678 
679 
692 extern status_t
693  ncxmod_find_all_modules_ycli_cache (dlq_hdr_t *resultQ);
694 
695 
696 
720 extern status_t
721  ncxmod_load_deviation (const xmlChar *deviname,
722  dlq_hdr_t *deviationQ);
723 
724 
749 extern status_t
750  ncxmod_load_annotation (const xmlChar *deviname,
751  dlq_hdr_t *deviationQ);
752 
753 
783 extern status_t
784  ncxmod_load_imodule (const xmlChar *modname,
785  const xmlChar *revision,
786  yang_pcb_t *pcb,
787  yang_parsetype_t ptyp,
788  ncx_module_t *parent,
789  ncx_module_t **retmod);
790 
791 
815 extern yang_pcb_t *
816  ncxmod_load_module_ex (const xmlChar *modname,
817  const xmlChar *revision,
818  boolean with_submods,
819  boolean savetkc,
820  boolean keepmode,
821  boolean docmode,
822  dlq_hdr_t *savedevQ,
823  status_t *res);
824 
825 
845 extern yang_pcb_t *
846  ncxmod_load_module_diff (const xmlChar *modname,
847  const xmlChar *revision,
848  boolean with_submods,
849  const xmlChar *modpath,
850  dlq_hdr_t *savedevQ,
851  status_t *res);
852 
853 
882 extern xmlChar *
883  ncxmod_find_data_file (const xmlChar *fname,
884  boolean generrors,
885  boolean backup_file,
886  status_t *res);
887 
888 
921 extern xmlChar *
922  ncxmod_find_server_data_file (const xmlChar *fname,
923  boolean fileloc_fhs,
924  boolean generrors,
925  boolean backup_file,
926  boolean keep_result,
927  status_t *res);
928 
929 
930 
955 extern xmlChar *
956  ncxmod_find_sil_file (const xmlChar *fname,
957  boolean generrors,
958  status_t *res);
959 
960 
986 extern xmlChar *
987  ncxmod_make_data_filespec (const xmlChar *fname,
988  boolean backup_file,
989  status_t *res);
990 
991 
992 
1008 extern xmlChar *
1009  ncxmod_make_server_data_filespec (const xmlChar *fname,
1010  boolean fileloc_fhs,
1011  boolean backup_file,
1012  status_t *res);
1013 
1014 
1029 extern xmlChar *
1030  ncxmod_make_data_filespec_from_src (const xmlChar *srcspec,
1031  const xmlChar *fname,
1032  status_t *res);
1033 
1034 
1057 extern xmlChar *
1058  ncxmod_find_script_file (const xmlChar *fname,
1059  status_t *res);
1060 
1061 
1084 extern xmlChar *
1085  ncxmod_find_test_suite_file (const xmlChar *fname,
1086  status_t *res);
1087 
1088 
1096 extern status_t
1097  ncxmod_set_home (const xmlChar *home);
1098 
1099 
1106 extern const xmlChar *
1107  ncxmod_get_home (void);
1108 
1109 
1120 extern status_t
1121  ncxmod_set_yuma_home (const xmlChar *yumahome);
1122 
1123 
1130 extern const xmlChar *
1131  ncxmod_get_yuma_home (void);
1132 
1133 
1140 extern const xmlChar *
1141  ncxmod_get_yuma_install (void);
1142 
1143 
1153 extern void
1154  ncxmod_set_modpath (const xmlChar *modpath);
1155 
1156 
1166 extern void
1167  ncxmod_set_loadpath (const xmlChar *loadpath);
1168 
1169 
1176 extern void
1177  ncxmod_set_datapath (const xmlChar *datapath);
1178 
1179 
1186 extern void
1187  ncxmod_set_runpath (const xmlChar *runpath);
1188 
1189 
1196 extern void
1197  ncxmod_set_subdirs (boolean usesubdirs);
1198 
1199 
1205 extern const xmlChar *
1206  ncxmod_get_yumadir (void);
1207 
1208 
1223 extern status_t
1224  ncxmod_process_subtree (const char *startspec,
1225  ncxmod_callback_fn_t callback,
1226  void *cookie);
1227 
1228 
1237 extern boolean
1238  ncxmod_test_subdir (const xmlChar *dirspec);
1239 
1240 
1248 extern const xmlChar *
1249  ncxmod_get_userhome (const xmlChar *user,
1250  uint32 userlen);
1251 
1252 
1260 extern const xmlChar *
1261  ncxmod_get_envvar (const xmlChar *name,
1262  uint32 namelen);
1263 
1264 
1272 extern void
1273  ncxmod_set_altpath (const xmlChar *altpath);
1274 
1275 
1280 extern void
1281  ncxmod_clear_altpath (void);
1282 
1283 
1302 extern status_t
1303  ncxmod_list_data_files (help_mode_t helpmode,
1304  boolean logstdout);
1305 
1306 
1325 extern status_t
1326  ncxmod_list_script_files (help_mode_t helpmode,
1327  boolean logstdout);
1328 
1329 
1348 extern status_t
1349  ncxmod_list_yang_files (help_mode_t helpmode,
1350  boolean logstdout);
1351 
1352 
1358 extern status_t
1359  ncxmod_setup_yumadir (void);
1360 
1361 
1366 extern status_t
1367  ncxmod_setup_backup_dir (const xmlChar *backup_dir);
1368 
1369 
1381 extern status_t
1382  ncxmod_setup_fhs_dirs (void);
1383 
1384 
1390 extern status_t
1391  ncxmod_setup_tempdir (void);
1392 
1393 
1404 extern status_t
1405  ncxmod_setup_yumadir_force (const xmlChar *path);
1406 
1407 
1413 status_t
1415 
1416 
1422 status_t
1423  ncxmod_setup_yangcli_cache_dir (const xmlChar *cache_dir);
1424 
1425 
1433 extern ncxmod_temp_progcb_t *
1434  ncxmod_new_program_tempdir (status_t *res);
1435 
1436 
1442 extern void
1443  ncxmod_free_program_tempdir (ncxmod_temp_progcb_t *progcb);
1444 
1445 
1455 extern ncxmod_temp_sescb_t *
1456  ncxmod_new_session_tempdir (ncxmod_temp_progcb_t *progcb,
1457  uint32 sidnum,
1458  status_t *res);
1459 
1460 
1467 extern void
1468  ncxmod_free_session_tempdir (ncxmod_temp_progcb_t *progcb,
1469  uint32 sidnum);
1470 
1471 
1481 extern ncxmod_temp_filcb_t *
1482  ncxmod_new_session_tempfile (ncxmod_temp_sescb_t *sescb,
1483  const xmlChar *filename,
1484  status_t *res);
1485 
1486 
1492 extern void
1493  ncxmod_free_session_tempfile (ncxmod_temp_filcb_t *filcb);
1494 
1495 
1501 extern ncxmod_search_result_t *
1502  ncxmod_new_search_result (void);
1503 
1504 
1511 extern ncxmod_search_result_t *
1512  ncxmod_new_search_result_ex (const ncx_module_t *mod);
1513 
1514 
1522 extern ncxmod_search_result_t *
1523  ncxmod_new_search_result_str (const xmlChar *modname,
1524  const xmlChar *revision);
1525 
1526 
1532 extern void
1533  ncxmod_free_search_result (ncxmod_search_result_t *searchresult);
1534 
1535 
1536 
1543 extern void
1544  ncxmod_clean_search_result_queue (dlq_hdr_t *searchQ);
1545 
1546 
1559 extern ncxmod_search_result_t *
1560  ncxmod_find_search_result (dlq_hdr_t *searchQ,
1561  const xmlChar *modname,
1562  const xmlChar *revision,
1563  const xmlChar *nsuri);
1564 
1565 
1572 extern ncxmod_search_result_t *
1573  ncxmod_clone_search_result (const ncxmod_search_result_t *sr);
1574 
1575 
1583 extern boolean
1584  ncxmod_test_filespec (const xmlChar *filespec);
1585 
1586 
1593 extern uint32
1594  ncxmod_get_pathlen_from_filespec (const xmlChar *filespec);
1595 
1596 
1604 extern status_t
1605  ncxmod_get_file_mtime (const xmlChar *filespec,
1606  time_t *timebuff);
1607 
1608 
1619 extern status_t
1621  void *cookie);
1622 
1623 
1633 extern xmlChar *
1634  ncxmod_get_pid_filespec (const xmlChar *progname,
1635  boolean fileloc_fhs,
1636  status_t *res);
1637 
1638 
1649 extern xmlChar *
1650  ncxmod_get_subdir_filespec (const xmlChar *subdir,
1651  boolean fileloc_fhs,
1652  status_t *res);
1653 
1654 
1666 extern status_t
1667  ncxmod_read_num_file (const xmlChar *numfile,
1668  uint64 *curnum,
1669  boolean file_error);
1670 
1671 
1680 extern status_t
1681  ncxmod_write_num_file (const xmlChar *numfile,
1682  uint64 curnum);
1683 
1684 
1692 extern status_t
1693  ncxmod_copy_text_file (const xmlChar *src_filespec,
1694  const xmlChar *dest_filespec);
1695 
1696 
1697 
1710 extern status_t
1711  ncxmod_subsys_info_write (const xmlChar *filespec,
1712  const xmlChar *ipaddr,
1713  uint16 portnum);
1714 
1715 
1721 extern void
1722  ncxmod_subsys_info_remove (const xmlChar *filespec);
1723 
1724 
1737 extern status_t
1738  ncxmod_get_conf_files (const xmlChar *confdir,
1739  boolean must_exist,
1740  ncxmod_conf_cbfn_t cbfn,
1741  void *cookie);
1742 
1743 
1747 extern status_t
1749 
1750 
1759 extern status_t
1761  void *cookie);
1762 
1763 
1771 extern boolean
1772  ncxmod_use_bestmatch_now (const xmlChar *revision);
1773 
1774 
1782 extern void
1784  log_debug_t loglevel);
1785 
1786 
1787 
1791 #ifdef __cplusplus
1792 } /* end extern 'C' */
1793 #endif
1794 
1795 #endif /* _H_ncxmod */
yang_parse_from_filespec
status_t yang_parse_from_filespec(const xmlChar *filespec, yang_pcb_t *pcb, yang_parsetype_t ptyp, boolean isyang)
Parse a file as a YANG module.
Definition: yang_parse.c:4582
ERR_NCX_SKIPPED
@ ERR_NCX_SKIPPED
2001
Definition: status_enum.h:551
xml_strlen
uint32 xml_strlen(const xmlChar *str)
Get the String len for xmlChar.
Definition: xml_util.c:1406
ncxmod_temp_progcb_t_::temp_sescbQ
dlq_hdr_t temp_sescbQ
Q of ncxmod_temp_sescb_t.
Definition: ncxmod.h:364
ncxmod_new_session_tempdir
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.
Definition: ncxmod.c:7647
ncxmod_find_sil_file
xmlChar * ncxmod_find_sil_file(const xmlChar *fname, boolean generrors, status_t *res)
Determine the location of the specified server instrumentation library file.
Definition: ncxmod.c:5351
ncxmod_search_result_t_::module
xmlChar * module
module or submodule name
Definition: ncxmod.h:392
xml_strncpy
uint32 xml_strncpy(xmlChar *copyTo, const xmlChar *copyFrom, uint32 maxlen)
String copy for xmlChar – checks for buffer overflow.
Definition: xml_util.c:1518
YANG_FILE_SEPCHAR
#define YANG_FILE_SEPCHAR
YANG file name separator char.
Definition: yangconst.h:100
ncx_file_remove
status_t ncx_file_remove(const xmlChar *filespec, boolean do_warn)
Close a file; check result.
Definition: ncx.c:13262
tstamp.h
Timestamp utilities.
tstamp_datetime_dirname
void tstamp_datetime_dirname(xmlChar *buff)
Set the current date and time in an XML dateTime string format.
Definition: tstamp.c:427
xml_strdup
xmlChar * xml_strdup(const xmlChar *copyFrom)
String duplicate for xmlChar.
Definition: xml_util.c:1553
ncxmod_subsys_info_remove
void ncxmod_subsys_info_remove(const xmlChar *filespec)
Remove the subsystem info file.
Definition: ncxmod.c:8863
ncxmod_test_filespec
boolean ncxmod_test_filespec(const xmlChar *filespec)
Check the exact filespec to see if it a file.
Definition: ncxmod.c:8275
yang_fileext_is_yang
boolean yang_fileext_is_yang(const xmlChar *filename)
Check if the filespec ends with the .yang extension.
Definition: yang.c:3935
ncxmod_search_result_t_::qhdr
dlq_hdr_t qhdr
queue header
Definition: ncxmod.h:391
smioid_tree_init
status_t smioid_tree_init(void)
initialize the tree used for managing the SMI OID and the associated obj_template_t reference
Definition: smioid_tree.c:381
ncxmod_conf_cbfn_t
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 ...
Definition: ncxmod.h:463
YANG_SUFFIX
#define YANG_SUFFIX
YANG suffix.
Definition: yangconst.h:73
ncxmod_set_altpath
void ncxmod_set_altpath(const xmlChar *altpath)
Set the alternate path that should be used first (for yangdiff)
Definition: ncxmod.c:6623
ncxmod_find_data_file
xmlChar * ncxmod_find_data_file(const xmlChar *fname, boolean generrors, boolean backup_file, status_t *res)
Determine the location of the specified data file.
Definition: ncxmod.c:5068
ERR_NCX_DEF_NOT_FOUND
@ ERR_NCX_DEF_NOT_FOUND
250
Definition: status_enum.h:289
ncxmod_load_module_diff
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)
Definition: ncxmod.c:4996
search_dumpfn_t
void(* search_dumpfn_t)(log_debug_t level, const char *fstr,...)
Callback to do log dump function for show searchpath.
Definition: ncxmod.h:475
LOG_DEBUG_NONE
@ LOG_DEBUG_NONE
value not set or error
Definition: log.h:386
YANG_PT_TOP
@ YANG_PT_TOP
called from top level [sub]module
Definition: yang.h:106
log_error
void log_error(const char *fstr,...) __attribute__((format(printf
Generate a new LOG_DEBUG_ERROR log entry.
ncxmod_search_result_t_::flags
uint8 flags
replaces capmatch and ismod
Definition: ncxmod.h:401
ncx_get_modname
const xmlChar * ncx_get_modname(const ncx_module_t *mod)
Get the main module name.
Definition: ncx.c:4834
ncxmod_free_program_tempdir
void ncxmod_free_program_tempdir(ncxmod_temp_progcb_t *progcb)
Remove a program instance temp files directory.
Definition: ncxmod.c:7620
ncxmod_load_imodule
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)
Definition: ncxmod.c:4828
xml_util.h
XML Utilities.
ncxmod_find_module
ncxmod_search_result_t * ncxmod_find_module(const xmlChar *modname, const xmlChar *revision)
Find a YANG module and generate a search result.
Definition: ncxmod.c:4575
ncxmod_find_test_suite_file
xmlChar * ncxmod_find_test_suite_file(const xmlChar *fname, status_t *res)
Determine the location of the specified test-suite file.
Definition: ncxmod.c:5984
ncxmod_get_file_mtime
status_t ncxmod_get_file_mtime(const xmlChar *filespec, time_t *timebuff)
Get the last-modified time for a file.
Definition: ncxmod.c:8349
yang_clean_pcb_top
void yang_clean_pcb_top(yang_pcb_t *pcb)
Make sure pcb->top is freed before the pcb is reused after the bestmatch failed and NULL revision is ...
Definition: yang.c:4190
ncxmod_temp_progcb_t_::source
xmlChar * source
filespec source string
Definition: ncxmod.h:363
ncxmod_find_server_data_file
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.
Definition: ncxmod.c:5233
ncx_free_module
void ncx_free_module(ncx_module_t *mod)
Free a YANG module.
Definition: ncx.c:3431
smioid_tree_cleanup
void smioid_tree_cleanup(void)
Clean and free the oid tree.
Definition: smioid_tree.c:401
log_debug3
void void void void void void void void void void void log_debug3(const char *fstr,...) __attribute__((format(printf
Generate a new LOG_DEBUG_DEBUG3 log entry.
ncxmod_temp_sescb_t_::qhdr
dlq_hdr_t qhdr
queue header
Definition: ncxmod.h:370
ncx_num.h
NCX Module Library Number Utility Functions.
yang_free_pcb
void yang_free_pcb(yang_pcb_t *pcb)
Delete a YANG parser control block.
Definition: yang.c:2911
ncxmod_set_home
status_t ncxmod_set_home(const xmlChar *home)
Override the HOME env var with the home CLI var.
Definition: ncxmod.c:6111
ncxmod_cleanup
void ncxmod_cleanup(void)
Cleanup the ncxmod module.
Definition: ncxmod.c:4273
ncxmod_get_yumadir
const xmlChar * ncxmod_get_yumadir(void)
Get the yuma directory being used.
Definition: ncxmod.c:6418
ncxmod_temp_sescb_t_
session-level temp-dir control block
Definition: ncxmod.h:369
ncxmod_get_yuma_install
const xmlChar * ncxmod_get_yuma_install(void)
Get the YUMAPRO_INSTALL or default install parameter value, whichever is in effect.
Definition: ncxmod.c:6257
ERR_NCX_WRONG_VERSION
@ ERR_NCX_WRONG_VERSION
314
Definition: status_enum.h:357
ncxmod_search_result_t_::nslen
uint32 nslen
length of base part of namespacestr
Definition: ncxmod.h:399
ncxmod_make_data_filespec_from_src
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 speci...
Definition: ncxmod.c:5763
ncxmod_make_server_data_filespec
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.
Definition: ncxmod.c:5668
ncx_init_num
void ncx_init_num(ncx_num_t *num)
Init a ncx_num_t struct.
Definition: ncx_num.c:162
ncxmod_read_num_file
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!...
Definition: ncxmod.c:8550
ncxmod_setup_tempdir
status_t ncxmod_setup_tempdir(void)
Setup the ~/.yuma/tmp directory if it does not exist.
Definition: ncxmod.c:7373
ncxmod_search_result_t_::cap
cap_rec_t * cap
back-ptr to source capability URI
Definition: ncxmod.h:400
ncxmod_log_env
void ncxmod_log_env(void)
Report the environment variables used by the running system.
Definition: ncxmod.c:4222
ncxmod_subsys_info_write
status_t ncxmod_subsys_info_write(const xmlChar *filespec, const xmlChar *ipaddr, uint16 portnum)
Write the subsystem info file;.
Definition: ncxmod.c:8782
ncxconst.h
Contains NCX constants.
ncxmod.h
NCX Module Load Manager.
ncxmod_use_bestmatch_now
boolean ncxmod_use_bestmatch_now(const xmlChar *revision)
Check if the bestmatch can be used for this module.
Definition: ncxmod.c:9015
YIN_SUFFIX
#define YIN_SUFFIX
YIN file suffix.
Definition: yangconst.h:85
ncxmod_temp_filcb_t_::qhdr
dlq_hdr_t qhdr
queue header
Definition: ncxmod.h:379
ncxmod_make_data_filespec
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.
Definition: ncxmod.c:5526
ncxmod_setup_yumadir
status_t ncxmod_setup_yumadir(void)
Setup the ~/.yuma directory if it does not exist.
Definition: ncxmod.c:7179
help.h
YANG help text support for CLI Print help text for various templates.
log_set_log_level
void log_set_log_level(log_debug_t dlevel)
Set the main log level.
Definition: log.c:3395
ERR_FIL_WRITE
@ ERR_FIL_WRITE
103
Definition: status_enum.h:215
ncxmod_free_session_tempfile
void ncxmod_free_session_tempfile(ncxmod_temp_filcb_t *filcb)
Clean and free a session instance temp files directory.
Definition: ncxmod.c:7874
NCX_NF_DEC
@ NCX_NF_DEC
YANG deciaml format.
Definition: ncxtypes.h:335
ncxmod_search_result_t_::revision
xmlChar * revision
set if most recent revision found
Definition: ncxmod.h:394
ncxmod_find_all_modules_ycli_cache
status_t ncxmod_find_all_modules_ycli_cache(dlq_hdr_t *resultQ)
Find all modules in the search path for the yangcli cache.
Definition: ncxmod.c:4683
log_info
void void void void void log_info(const char *fstr,...) __attribute__((format(printf
Generate a new LOG_DEBUG_INFO log entry.
ERR_NCX_ENTRY_EXISTS
@ ERR_NCX_ENTRY_EXISTS
223
Definition: status_enum.h:262
log_debug2
void void void void void void void void void log_debug2(const char *fstr,...) __attribute__((format(printf
Generate a new LOG_DEBUG_DEBUG2 log entry.
ncxmod_callback_fn_t
status_t(* ncxmod_callback_fn_t)(const char *fullspec, void *cookie)
user function callback template to process a module during a subtree traversal
Definition: ncxmod.h:424
errno_to_status
status_t errno_to_status(void)
Get the errno variable and convert it to a status_t.
Definition: status.c:968
yang_new_node
yang_node_t * yang_new_node(void)
Create a new YANG parser node.
Definition: yang.c:2673
NO_ERR
@ NO_ERR
000
Definition: status_enum.h:188
ncxmod_backup_cbfn_t
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
Definition: ncxmod.h:445
ncxmod_init
status_t ncxmod_init(void)
Initialize the ncxmod module.
Definition: ncxmod.c:4087
ncxmod_set_subdirs
void ncxmod_set_subdirs(boolean usesubdirs)
Set the subdirs flag to FALSE if the no-subdirs CLI param is set.
Definition: ncxmod.c:6402
NCX_BT_UINT64
@ NCX_BT_UINT64
uint64
Definition: ncxtypes.h:214
ERR_NCX_MOD_NOT_FOUND
@ ERR_NCX_MOD_NOT_FOUND
236
Definition: status_enum.h:275
NCX_MAX_NLEN
#define NCX_MAX_NLEN
all name fields in YANG can be 1 to N bytes set a limit based on likely malloc failure CHANGE TO MATC...
Definition: ncxconst.h:149
ERR_NCX_MISSING_FILE
@ ERR_NCX_MISSING_FILE
226
Definition: status_enum.h:265
ncxmod_write_num_file
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!...
Definition: ncxmod.c:8630
ncxmod_search_result_t_::res
status_t res
search result, only use if NO_ERR
Definition: ncxmod.h:398
log_debug4
void void void void void void void void void void void void void log_debug4(const char *fstr,...) __attribute__((format(printf
Generate a new LOG_DEBUG_DEBUG4 log entry.
ERR_NCX_OPERATION_FAILED
@ ERR_NCX_OPERATION_FAILED
274
Definition: status_enum.h:315
ncxmod_free_search_result
void ncxmod_free_search_result(ncxmod_search_result_t *searchresult)
Clean and free a search result struct.
Definition: ncxmod.c:8049
LOGDEBUG2
#define LOGDEBUG2
Check if at least log-level=debug2.
Definition: log.h:292
HELP_MODE_BRIEF
@ HELP_MODE_BRIEF
–brief mode selected
Definition: help.h:86
dlq_createSQue
void dlq_createSQue(dlq_hdrT *queAddr)
create a static queue header
Definition: dlq.c:177
log_warn
void void void log_warn(const char *fstr,...) __attribute__((format(printf
Generate a new LOG_DEBUG_WARN log entry.
ERR_INTERNAL_VAL
@ ERR_INTERNAL_VAL
004
Definition: status_enum.h:194
ncxmod_temp_sescb_t_::source
xmlChar * source
filespec source string
Definition: ncxmod.h:371
ncxmod_get_home
const xmlChar * ncxmod_get_home(void)
Get the HOME or –home parameter value, whichever is in effect, if any.
Definition: ncxmod.c:6176
ncx_valid_name
boolean ncx_valid_name(const xmlChar *str, uint32 len)
Check if an xmlChar string is a valid YANG identifier value.
Definition: ncx.c:7596
ncxmod_get_yuma_home
const xmlChar * ncxmod_get_yuma_home(void)
Get the YUMAPRO_HOME or –yuma-home parameter value, whichever is in effect, if any.
Definition: ncxmod.c:6240
ncxmod_search_result_t_
struct for storing YANG file search results this is used by yangcli for schema auto-load also for fin...
Definition: ncxmod.h:390
ncxmod_temp_filcb_t_
temporary file control block
Definition: ncxmod.h:378
dlq_remove
void dlq_remove(void *nodeP)
remove the queue entry from its queue list entry MUST have been enqueued somehow before this function...
Definition: dlq.c:519
ncxmod_temp_progcb_t_::qhdr
dlq_hdr_t qhdr
queue header
Definition: ncxmod.h:362
ncxmod_get_pid_filespec
xmlChar * ncxmod_get_pid_filespec(const xmlChar *progname, boolean fileloc_fhs, status_t *res)
Get the PID file specification for the given program name.
Definition: ncxmod.c:8433
ncxmod_search_result_t_::namespacestr
xmlChar * namespacestr
set if module & namespace found
Definition: ncxmod.h:395
ncxmod_set_yuma_home
status_t ncxmod_set_yuma_home(const xmlChar *yumahome)
Override the YUMAPRO_HOME env var with the yuma-home CLI var.
Definition: ncxmod.c:6194
ncxmod_load_module_loadpath
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 loade...
Definition: ncxmod.c:4388
ncxmod_load_module_ex
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)
Definition: ncxmod.c:4936
ncxmod_temp_filcb_t_::source
xmlChar * source
filespec source string
Definition: ncxmod.h:380
NCX_MAX_USERNAME_LEN
#define NCX_MAX_USERNAME_LEN
NCX User Name max length.
Definition: ncxconst.h:156
NCX_PATHSEP_CH
#define NCX_PATHSEP_CH
filespec identifier field separator token
Definition: ncxconst.h:404
ERR_NCX_INVALID_VALUE
@ ERR_NCX_INVALID_VALUE
258
Definition: status_enum.h:299
ncxmod_get_envvar
const xmlChar * ncxmod_get_envvar(const xmlChar *name, uint32 namelen)
Get the specified shell environment variable.
Definition: ncxmod.c:6586
log_get_log_level
log_debug_t log_get_log_level(void)
Get the main log level.
Definition: log.c:3508
ncxmod_temp_sescb_t_::sidnum
uint32 sidnum
session ID number
Definition: ncxmod.h:372
ncxmod_setup_fhs_dirs
status_t ncxmod_setup_fhs_dirs(void)
Setup the following FHS location server directories if they do not already exist.
Definition: ncxmod.c:7297
ERR_NCX_WRONG_LEN
@ ERR_NCX_WRONG_LEN
222
Definition: status_enum.h:261
log_debug_append
void void void void void void void void log_debug_append(const char *fstr,...) __attribute__((format(printf
Append to a LOG_DEBUG_DEBUG log entry.
ncxmod_get_subdir_filespec
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 fo...
Definition: ncxmod.c:8494
NCX_BT_UINT16
@ NCX_BT_UINT16
uint16
Definition: ncxtypes.h:212
ncxmod_copy_text_file
status_t ncxmod_copy_text_file(const xmlChar *src_filespec, const xmlChar *dest_filespec)
Copy the source text file to the fully specified filespec.
Definition: ncxmod.c:8693
ERR_INTERNAL_MEM
@ ERR_INTERNAL_MEM
003
Definition: status_enum.h:193
xml_strncmp
int xml_strncmp(const xmlChar *s1, const xmlChar *s2, uint32 maxlen)
String compare for xmlChar for at most 'maxlen' xmlChars.
Definition: xml_util.c:1824
ERR_INTERNAL_INIT_SEQ
@ ERR_INTERNAL_INIT_SEQ
007
Definition: status_enum.h:197
get_error_string
const char * get_error_string(status_t res)
Get the error message for a specific internal error.
Definition: status.c:239
ncxmod_setup_yumadir_force
status_t ncxmod_setup_yumadir_force(const xmlChar *path)
Setup the ~/.yumapro directory if it does not exist.
Definition: ncxmod.c:7217
ERR_INTERNAL_PTR
@ ERR_INTERNAL_PTR
002
Definition: status_enum.h:192
yang.h
YANG Module parser utilities.
tstamp_time2datetime
void tstamp_time2datetime(time_t *timerec, xmlChar *buff)
Convert the specified time_t to a YANG data-and-time format.
Definition: tstamp.c:457
log_debug
void void void void void void void log_debug(const char *fstr,...) __attribute__((format(printf
Generate a new LOG_DEBUG_DEBUG log entry.
ncxmod_find_search_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.
Definition: ncxmod.c:8121
ncxmod_set_datapath
void ncxmod_set_datapath(const xmlChar *datapath)
Override the YUMA_DATAPATH env var with the datapath CLI var.
Definition: ncxmod.c:6343
ncxmod_set_modpath
void ncxmod_set_modpath(const xmlChar *modpath)
Override the YUMAPRO_MODPATH env var with the modpath CLI var.
Definition: ncxmod.c:6281
yangconst.h
Contains YANG constants separated to prevent H file include loops.
log_write
void void void log_write(const char *fstr,...) __attribute__((format(printf
Write a new entry to the main log.
log_stdout
void log_stdout(const char *fstr,...) __attribute__((format(printf
Write output to STDOUT.
ncxmod_search_result_t_::mod
ncx_module_t * mod
back-ptr to found module if loaded
Definition: ncxmod.h:397
LOGINFO
#define LOGINFO
Check if at least log-level=info.
Definition: log.h:279
dlq_nextEntry
#define dlq_nextEntry(nodeP)
get the next queue entry after the current entry
Definition: dlq.h:265
ncxmod_find_all_modules
status_t ncxmod_find_all_modules(dlq_hdr_t *resultQ)
Find all modules in the path and create a Q of search results.
Definition: ncxmod.c:4653
ERR_NCX_INVALID_NAME
@ ERR_NCX_INVALID_NAME
228
Definition: status_enum.h:267
yang_find_node
yang_node_t * yang_find_node(const dlq_hdr_t *que, const xmlChar *name, const xmlChar *revision)
Find a YANG parser node in the specified Q.
Definition: yang.c:2778
ncxmod_list_yang_files
status_t ncxmod_list_yang_files(help_mode_t helpmode, boolean logstdout)
List the available YANG files found in the 'mod' search parh.
Definition: ncxmod.c:7020
NCX_MAX_LINELEN
#define NCX_MAX_LINELEN
Internal buffer max line length.
Definition: ncxconst.h:310
ERR_NCX_NOT_FOUND
@ ERR_NCX_NOT_FOUND
225
Definition: status_enum.h:264
NCX_MAX_NUMLEN
#define NCX_MAX_NUMLEN
max number len to use for static buffer allocation only
Definition: ncxconst.h:136
ERR_NCX_INVALID_NUM
@ ERR_NCX_INVALID_NUM
241
Definition: status_enum.h:280
ncx_sprintf_num
status_t ncx_sprintf_num(xmlChar *buff, const ncx_num_t *num, ncx_btype_t btyp, uint32 *len)
Sprintf a ncx_num_t contents.
Definition: ncx_num.c:2357
ncx_set_module_supported
void ncx_set_module_supported(ncx_module_t *mod, boolean supported)
Set the module supported field.
Definition: ncx.c:12505
ncxmod_temp_filcb_t_::filename
const xmlChar * filename
ptr into source
Definition: ncxmod.h:381
yang_compare_revision_dates
int32 yang_compare_revision_dates(const xmlChar *revstring1, const xmlChar *revstring2)
Compare 2 revision strings, which either may be NULL.
Definition: yang.c:3705
ncxmod_find_script_file
xmlChar * ncxmod_find_script_file(const xmlChar *fname, status_t *res)
Determine the location of the specified script file.
Definition: ncxmod.c:5852
ERR_NCX_EXP_MODULE
@ ERR_NCX_EXP_MODULE
329
Definition: status_enum.h:372
ncx_clean_num
void ncx_clean_num(ncx_btype_t btyp, ncx_num_t *num)
Scrub the memory in a ncx_num_t by freeing all the sub-fields.
Definition: ncx_num.c:189
ncxmod_list_script_files
status_t ncxmod_list_script_files(help_mode_t helpmode, boolean logstdout)
List the available script files found in the 'run' search parh.
Definition: ncxmod.c:6847
EMPTY_STRING
#define EMPTY_STRING
empty string used to get const xmlChar * cast
Definition: ncxconst.h:289
YANG_PT_INCLUDE
@ YANG_PT_INCLUDE
called from module include-stmt
Definition: yang.h:107
ncxmod_load_annotation
status_t ncxmod_load_annotation(const xmlChar *deviname, dlq_hdr_t *deviationQ)
Load an annotation module (special compiler processing)
Definition: ncxmod.c:4784
xml_strcmp
int xml_strcmp(const xmlChar *s1, const xmlChar *s2)
String compare for xmlChar.
Definition: xml_util.c:1746
ncxmod_free_session_tempdir
void ncxmod_free_session_tempdir(ncxmod_temp_progcb_t *progcb, uint32 sidnum)
Clean and free a session instance temp files directory.
Definition: ncxmod.c:7744
ncxmod_load_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 loade...
Definition: ncxmod.c:4342
YANG_PT_IMPORT
@ YANG_PT_IMPORT
called from module import-stmt
Definition: yang.h:108
ncxmod_set_bestmatch_modules
status_t ncxmod_set_bestmatch_modules(void)
Check for all the modules avialable for bestmatch checking.
Definition: ncxmod.c:8931
LOGDEBUG4
#define LOGDEBUG4
Check if at least log-level=debug4.
Definition: log.h:302
log.h
NCX System Logging Manager.
ncxmod_setup_recordtest_dir
status_t ncxmod_setup_recordtest_dir(void)
Setup the ~/.yuma/recordtest directory if it does not exist.
Definition: ncxmod.c:7422
ERR_BUFF_OVFL
@ ERR_BUFF_OVFL
106
Definition: status_enum.h:218
ncxtypes.h
YANG module data structures Many internal representations of YANG module constructs.
LOGDEBUG
#define LOGDEBUG
Check if at least log-level=debug.
Definition: log.h:287
ncx_get_cwd_subdirs
boolean ncx_get_cwd_subdirs(void)
Get the CLI parameter value whether to search for modules in subdirs of the CWD by default.
Definition: ncx.c:10176
log_error_append
void void log_error_append(const char *fstr,...) __attribute__((format(printf
Append to a LOG_DEBUG_ERROR log entry.
ncxmod_get_conf_files
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 call...
Definition: ncxmod.c:8890
ncxmod_new_search_result_str
ncxmod_search_result_t * ncxmod_new_search_result_str(const xmlChar *modname, const xmlChar *revision)
Malloc and initialize a search result struct.
Definition: ncxmod.c:8003
ncxmod_set_loadpath
void ncxmod_set_loadpath(const xmlChar *loadpath)
Override the YUMAPRO_LOADPATH env var with the loadpath CLI var.
Definition: ncxmod.c:6313
yang_copy_filename
status_t yang_copy_filename(const xmlChar *modname, const xmlChar *revision, xmlChar *buffer, uint32 bufflen, boolean isyang)
Construct a YANG filename into a provided buffer.
Definition: yang.c:3801
ERR_NCX_CFG_NOT_FOUND
@ ERR_NCX_CFG_NOT_FOUND
307
Definition: status_enum.h:350
HELP_MODE_FULL
@ HELP_MODE_FULL
–full selected
Definition: help.h:88
ncxmod_search_result_t_::source
xmlChar * source
file location
Definition: ncxmod.h:396
dlq_deque
void * dlq_deque(dlq_hdrT *listP)
remove the first queue node from the queue list
Definition: dlq.c:286
ncxmod_new_search_result_ex
ncxmod_search_result_t * ncxmod_new_search_result_ex(const ncx_module_t *mod)
Malloc and initialize a search result struct.
Definition: ncxmod.c:7923
yang_free_node
void yang_free_node(yang_node_t *node)
Clean and delete the memory for a YANG parser node.
Definition: yang.c:2705
dlq_empty
#define dlq_empty(listP)
check if queue list is empty
Definition: dlq.h:367
yang_parse.h
YANG Module parser module.
xml_strcpy
uint32 xml_strcpy(xmlChar *copyTo, const xmlChar *copyFrom)
String copy for xmlChar.
Definition: xml_util.c:1486
ERR_XML_READER_START_FAILED
@ ERR_XML_READER_START_FAILED
212
Definition: status_enum.h:251
log_debug2_append
void void void void void void void void void void log_debug2_append(const char *fstr,...) __attribute__((format(printf
Append to a LOG_DEBUG_DEBUG2 log entry.
xml_strcat
xmlChar * xml_strcat(xmlChar *appendTo, const xmlChar *appendFrom)
String concatenate for xmlChar.
Definition: xml_util.c:1597
cap.h
NETCONF protocol capabilities.
ncxmod_get_pathlen_from_filespec
uint32 ncxmod_get_pathlen_from_filespec(const xmlChar *filespec)
Get the length of th path part of the filespec string.
Definition: ncxmod.c:8306
dlq_firstEntry
#define dlq_firstEntry(listP)
get the first entry in the queue list
Definition: dlq.h:337
ncx_get_source
xmlChar * ncx_get_source(const xmlChar *fspec, status_t *res)
Expand a filespec into an absolute path.
Definition: ncx.c:8362
ncxmod_clean_search_result_queue
void ncxmod_clean_search_result_queue(dlq_hdr_t *searchQ)
Clean and free all the search result structs in the specified Q.
Definition: ncxmod.c:8085
ncx.h
YANG module utility functions.
ncxmod_load_deviation
status_t ncxmod_load_deviation(const xmlChar *deviname, dlq_hdr_t *deviationQ)
Load a deviation module (special handling by compiler)
Definition: ncxmod.c:4744
TSTAMP_MIN_SIZE
#define TSTAMP_MIN_SIZE
normal minimum buffer size for a tstamp buffer
Definition: tstamp.h:67
ncxmod_new_session_tempfile
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.
Definition: ncxmod.c:7795
ncxmod_autoload_module
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)
Definition: ncxmod.c:4490
ncxmod_clone_search_result
ncxmod_search_result_t * ncxmod_clone_search_result(const ncxmod_search_result_t *sr)
Clone a search result.
Definition: ncxmod.c:8195
ERR_FIL_BAD_FILENAME
@ ERR_FIL_BAD_FILENAME
205
Definition: status_enum.h:244
ncx_file_close
void ncx_file_close(FILE *fp)
Close a file; check result.
Definition: ncx.c:13235
dlq_enque
void dlq_enque(REG void *newP, REG dlq_hdrT *listP)
add a queue node to the end of a queue list Add newP to listP
Definition: dlq.c:246
yang_new_pcb
yang_pcb_t * yang_new_pcb(void)
Create a new YANG parser control block.
Definition: yang.c:2876
ncx_convert_num
status_t ncx_convert_num(const xmlChar *numstr, ncx_numfmt_t numfmt, ncx_btype_t btyp, ncx_num_t *val)
Convert a number string to a numeric type.
Definition: ncx_num.c:717
ncxmod_new_search_result
ncxmod_search_result_t * ncxmod_new_search_result(void)
Malloc and initialize a search result struct.
Definition: ncxmod.c:7896
smioid_tree.h
AVL Tree storage of SMI OID data.
ncxmod_temp_progcb_t_
program-level temp dir control block
Definition: ncxmod.h:361
ncxmod_search_result_t_::belongsto
xmlChar * belongsto
set if submodule & belongs-to found
Definition: ncxmod.h:393
ncx_find_module
ncx_module_t * ncx_find_module(const xmlChar *modname, const xmlChar *revision)
Find a ncx_module_t in the ncx_sesmodQ.
Definition: ncx.c:3227
SET_ERROR
#define SET_ERROR(E)
macro SET_ERROR
Definition: status_enum.h:103
ncxmod_dump_module_search_path
void ncxmod_dump_module_search_path(search_dumpfn_t dumpfn, log_debug_t loglevel)
Output the YANG module search path.
Definition: ncxmod.c:9031
ncxmod_new_program_tempdir
ncxmod_temp_progcb_t * ncxmod_new_program_tempdir(status_t *res)
Setup a program instance temp files directory.
Definition: ncxmod.c:7517
ncxmod_set_runpath
void ncxmod_set_runpath(const xmlChar *runpath)
Override the YUMAPRO_RUNPATH env var with the runpath CLI var.
Definition: ncxmod.c:6373
ncxmod_clear_altpath
void ncxmod_clear_altpath(void)
Clear the alternate path so none is used (for yangdiff)
Definition: ncxmod.c:6644
ncxmod_test_subdir
boolean ncxmod_test_subdir(const xmlChar *dirspec)
Check if the specified string is a directory.
Definition: ncxmod.c:6515
status.h
Global error messages for status code enumerations.
ncxmod_get_userhome
const xmlChar * ncxmod_get_userhome(const xmlChar *user, uint32 userlen)
Get the user home dir from the passwd file.
Definition: ncxmod.c:6545
ncxmod_process_subtree
status_t ncxmod_process_subtree(const char *startspec, ncxmod_callback_fn_t callback, void *cookie)
Search the entire specified subtree, looking for YANG modules.
Definition: ncxmod.c:6445
ncxmod_scan_loadpath
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...
Definition: ncxmod.c:8982
ncxmod_setup_backup_dir
status_t ncxmod_setup_backup_dir(const xmlChar *backup_dir)
Setup the ~/.yumapro/backups directory if it does not exist.
Definition: ncxmod.c:7247
ncx_set_mod_unloadable
void ncx_set_mod_unloadable(ncx_module_t *mod)
Set this module so it can be unloaded.
Definition: ncx.c:12100
ncxmod_list_data_files
status_t ncxmod_list_data_files(help_mode_t helpmode, boolean logstdout)
List the available data files found in the data search parh.
Definition: ncxmod.c:6674
ncxmod_temp_sescb_t_::temp_filcbQ
dlq_hdr_t temp_filcbQ
Q of ncxmod_temp_filcb_t.
Definition: ncxmod.h:373
LOGDEBUG3
#define LOGDEBUG3
Check if at least log-level=debug3.
Definition: log.h:297
ncxmod_get_backup_files
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;.
Definition: ncxmod.c:8387
ncxmod_setup_yangcli_cache_dir
status_t ncxmod_setup_yangcli_cache_dir(const xmlChar *cache_dir)
Setup the ~/.yumapro/.yangcli_cache directory if it does not exist.
Definition: ncxmod.c:7472
NCX_DEF_INDENT
#define NCX_DEF_INDENT
default indent amount for nesting XML or other structured output
Definition: ncxconst.h:441