yumapro  24.10-11
YumaPro SDK
Loading...
Searching...
No Matches
ncxmod.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2008 - 2012, Andy Bierman, All Rights Reserved.
3 * Copyright (c) 2012 - 2025, 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
36date init comment
37----------------------------------------------------------------------
3810-nov-05 abb Begun
3922-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
4316-feb-08 abb Changed environment variables from NCX to YANG
44 Added YANG_INSTALL envvar as well.
4522-jul-08 abb Remove NCX support -- YANG only from now on
4606-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
75extern "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 * this is used to check file paths not XPath
92 * Windows allows foward and backslash so pick forward
93 * since that is all Linux and Mac support
94 */
95#define NCXMOD_PSCHAR '/'
96
97#define NCXMOD_WIN_PSCHAR '\\'
98
99#define NCXMOD_HMCHAR '~'
100
101#define NCXMOD_ENVCHAR '$'
102
103#define NCXMOD_DOTCHAR '.'
104
105/* name of the NCX module containing agent boot parameters
106 * loaded during startup
107 */
108#define NCXMOD_NETCONFD (const xmlChar *)"netconfd-pro"
109
110#define NCXMOD_NCX (const xmlChar *)"yuma-ncx"
111
112#define NCXMOD_RESTCONF (const xmlChar *)"ietf-restconf"
113
114#define NCXMOD_YANG_DATA_EXT (const xmlChar *)"yang-data-ext"
115
116#define NCXMOD_YANG_STRUCTURE (const xmlChar *)"ietf-yang-structure-ext"
117
118#define NCXMOD_YUMA_NACM (const xmlChar *)"yuma-nacm"
119
120#define NCXMOD_YUMA_TIME_FILTER (const xmlChar *)"yuma-time-filter"
121
122#define NCXMOD_YUMAWORKS_ATTRS (const xmlChar *)"yumaworks-attrs"
123
124#define NCXMOD_YUMAWORKS_CERT_USERMAP \
125 (const xmlChar *)"yumaworks-cert-usermap"
126
127#define NCXMOD_YUMAWORKS_CONFIG_CHANGE \
128 (const xmlChar *)"yumaworks-config-change"
129
130#define NCXMOD_YUMAWORKS_EVENT_FILTER \
131 (const xmlChar *)"yumaworks-event-filter"
132
133#define NCXMOD_YUMAWORKS_EVENT_STREAM \
134 (const xmlChar *)"yumaworks-event-stream"
135
136#define NCXMOD_YUMAWORKS_GETBULK (const xmlChar *)"yumaworks-getbulk"
137
138#define NCXMOD_YUMAWORKS_IDS (const xmlChar *)"yumaworks-ids"
139
140#define NCXMOD_YUMAWORKS_INTERNAL (const xmlChar *)"yumaworks-internal"
141
142#define NCXMOD_YUMAWORKS_SERVER (const xmlChar *)"yumaworks-server"
143
144#define NCXMOD_YUMAWORKS_SYSTEM (const xmlChar *)"yumaworks-system"
145
146#define NCXMOD_YUMAWORKS_TYPES (const xmlChar *)"yumaworks-types"
147
148#define NCXMOD_YUMAWORKS_APP_COMMON (const xmlChar *)"yumaworks-app-common"
149
150#define NCXMOD_YUMA_APP_COMMON (const xmlChar *)"yuma-app-common"
151
152#define NCXMOD_YUMA_TYPES (const xmlChar *)"yuma-types"
153
154#define NCXMOD_YANGCLI (const xmlChar *)"yangcli-pro"
155
156#define NCXMOD_YANG_API (const xmlChar *)"yumaworks-yang-api"
157
158#define NCXMOD_YUMAWORKS_GRPC_STATE \
159 (const xmlChar *)"yumaworks-grpc-mon"
160
161#define NCXMOD_YUMA_RESTCONF (const xmlChar *)"yumaworks-restconf"
162
163#define NCXMOD_YUMA_IDS (const xmlChar *)"yumaworks-ids"
164
165#define NCXMOD_YUMA_SUPPORT_SAVE (const xmlChar *)"yumaworks-support-save"
166
167#define NCXMOD_YUMA_TERM_MSG (const xmlChar *)"yumaworks-term-msg"
168
169/* name of the NETCONF module containing NETCONF protocol definitions,
170 * that is loaded by default during startup
171 */
172#define NCXMOD_NETCONF (const xmlChar *)"yuma-netconf"
173
174#define NCXMOD_YUMA_NETCONF (const xmlChar *)"yuma-netconf"
175
176#define NCXMOD_IETF_INTERFACES (const xmlChar *)"ietf-interfaces"
177
178#define NCXMOD_IETF_NETCONF (const xmlChar *)"ietf-netconf"
179
180#define NCXMOD_IETF_NETCONF_REV (const xmlChar *)"2011-06-01"
181
182#define NCXMOD_IETF_YANG_PATCH (const xmlChar *)"ietf-yang-patch"
183
184#define NCXMOD_IETF_YANG_TYPES (const xmlChar *)"ietf-yang-types"
185
186#define NCXMOD_IETF_INET_TYPES (const xmlChar *)"ietf-inet-types"
187
188#define NCXMOD_IETF_NETCONF_STATE (const xmlChar *)"ietf-netconf-monitoring"
189
190#define NCXMOD_IETF_NACM (const xmlChar *)"ietf-netconf-acm"
191
192#define NCXMOD_IETF_SID_FILE (const xmlChar *)"ietf-sid-file"
193
194#define NCXMOD_WITH_DEFAULTS (const xmlChar *)"ietf-netconf-with-defaults"
195
196#define NCXMOD_YUMAWORKS_EXTENSIONS (const xmlChar *)"yumaworks-extensions"
197
198#define NCXMOD_YUMAWORKS_YANG_CBOR (const xmlChar *)"yumaworks-yang-cbor"
199
200#define NCXMOD_FHS_RUNDIR (const xmlChar *)"/var/run/netconfd-pro"
201
202#define NCXMOD_FHS_LIBDIR (const xmlChar *)"/var/lib/netconfd-pro"
203
204#define NCXMOD_FHS_LOGDIR (const xmlChar *)"/var/log/netconfd-pro"
205
206#define NCXMOD_FHS_LOGSPEC \
207 (const xmlChar *)"/var/log/netconfd-pro/server.log"
208
209#define NCXMOD_FHS_AUDIT_LOGSPEC \
210 (const xmlChar *)"/var/log/netconfd-pro/audit.log"
211
212#define NCXMOD_SRID_FHS_LOGSPEC \
213 (const xmlChar *)"/var/log/netconfd-pro/server.%s.log"
214
215#define NCXMOD_SRID_FHS_AUDIT_LOGSPEC \
216 (const xmlChar *)"/var/log/netconfd-pro/audit.%s.log"
217
218
219#define NCXMOD_NETCONF_NOTIFICATIONS \
220 (const xmlChar *)"ietf-netconf-notifications"
221
222#define NCXMOD_PARTIAL_LOCK (const xmlChar *)"ietf-netconf-partial-lock"
223
224#define NCXMOD_CRYPT_HASH (const xmlChar *)"iana-crypt-hash"
225
226/* name of the RESTCONF modules, that is loaded during startup
227 * if WITH_RESTCONF flag is present
228 */
229#define NCXMOD_YANG_LIBRARY (const xmlChar *)"ietf-yang-library"
230#define NCXMOD_RESTMON (const xmlChar *)"ietf-restconf-monitoring"
231
232/* IETF NMDA modules */
233#define NCXMOD_IETF_DATASTORES (const xmlChar *)"ietf-datastores"
234#define NCXMOD_IETF_ORIGIN (const xmlChar *)"ietf-origin"
235#define NCXMOD_IETF_NETCONF_NMDA (const xmlChar *)"ietf-netconf-nmda"
236
237/* IETF Schema Mount modules */
238#define NCXMOD_IETF_SM_MODULE (const xmlChar *)"ietf-yang-schema-mount"
239
240/* YumaWorks annotation to ietf-yang-schema-mount */
241#define NCXMOD_IETF_SM_MODULE_ANNOT \
242 (const xmlChar *)"yumaworks-schema-mount-annot"
243
244/* hooks-test modules is loaded during startup
245 * if WITH_HOKS_TEST flag is present
246 */
247#define NCXMOD_HOOKS_TEST (const xmlChar *)"hooks-test"
248
249#define NCXMOD_YUMA_SYSTEM (const xmlChar *)"yuma-system"
250
251/* Openconfig extensions module containing OpenConfig extension definitions
252 * "oc-ext:openconfig-version" that is mandadory filed in gNMI
253 * capability-request
254 */
255#define NCXMOD_OC_EXT (const xmlChar *)"openconfig-extensions"
256
257/* name of the NCX modules directory appended when YUMAPRO_HOME or HOME
258 * ENV vars used to construct NCX module filespec
259 */
260#define NCXMOD_DIR (const xmlChar *)"modules"
261
262/* name of the data direectory when YUMAPRO_HOME or HOME
263 * ENV vars used to construct an NCX filespec
264 */
265#define NCXMOD_DATA_DIR (const xmlChar *)"data"
266
267/* name of the scripts directory when YUMAPRO_HOME or HOME
268 * ENV vars used to construct a NCX filespec
269 */
270#define NCXMOD_SCRIPT_DIR (const xmlChar *)"scripts"
271
272/* name of the test-suites directory */
273#define NCXMOD_TEST_SUITE_DIR (const xmlChar *)"test-suites"
274
275/* STD Environment Variable for user home directory */
276#define NCXMOD_PWD "PWD"
277
278/* STD Environment Variable for user home directory */
279#define USER_HOME "HOME"
280
281/* NCX Environment Variable for YANG/NCX user work home directory */
282#define NCXMOD_HOME "YUMAPRO_HOME"
283
284/* NCX Environment Variable for tools install directory
285 * The default is /usr/share/yuma
286 */
287#define NCXMOD_INSTALL "YUMAPRO_INSTALL"
288
289/* !! should import this from make !! */
290#if defined(FREEBSD) || defined(MACOSX)
291#define NCXMOD_DEFAULT_INSTALL (const xmlChar *)"/usr/local/share/yumapro"
292#else
293#define NCXMOD_DEFAULT_INSTALL (const xmlChar *)"/usr/share/yumapro"
294#endif
295
296/* !! should import this from make !! */
297#define NCXMOD_DEFAULT_YUMALIB64 (const xmlChar *)"/usr/lib64/yumapro"
298
299#ifdef MACOSX
300#define NCXMOD_DEFAULT_YUMALIB (const xmlChar *)"/usr/local/lib/yumapro"
301#else
302#define NCXMOD_DEFAULT_YUMALIB (const xmlChar *)"/usr/lib/yumapro"
303#endif
304
305
306/* !! should import this from make !! */
307#define NCXMOD_ETC_DATA (const xmlChar *)"/etc/yumapro"
308
309/* NCX Environment Variable for MODULE search path */
310#define NCXMOD_MODPATH "YUMAPRO_MODPATH"
311
312/* NCX Environment Variable for DATA search path */
313#define NCXMOD_DATAPATH "YUMAPRO_DATAPATH"
314
315/* NCX Environment Variable for SCRIPTS search path */
316#define NCXMOD_RUNPATH "YUMAPRO_RUNPATH"
317
318/* NCX Environment Variable for MODULE load path */
319#define NCXMOD_LOADPATH "YUMAPRO_LOADPATH"
320
321/* per user yangcli internal data home when $HOME defined */
322#define NCXMOD_YUMA_DIR (const xmlChar *)"~/.yumapro"
323
324/* per user yangcli internal data home when $HOME not defined */
325#define NCXMOD_TEMP_YUMA_DIR (const xmlChar *)"/tmp/yumapro"
326
327/* Yuma work directory name */
328#define NCXMOD_YUMA_DIRNAME (const xmlChar *)".yumapro"
329
330/* sub-directory name yangcli uses to store local per-session workdirs
331 * appended to ncxmod_yumadir_path
332 */
333#define NCXMOD_TEMP_DIR (const xmlChar *)"/tmp"
334
335/* directory uses to store rpydata per step of recorded test
336 */
337#define NCXMOD_UT_RECORDTEST_DIR (const xmlChar *)"/recordtest"
338
339/* directory uses to store cache schemas.
340 */
341#define NCXMOD_YANGCLI_CACHE_DIR (const xmlChar *)"/.yangcli_cache"
342
343
344#define NCXMOD_GET_SOURCE_NEEDED(s) \
345 (*(s) == (xmlChar)'~' || *(s) == (xmlChar)'.' || *(s) == (xmlChar)'$')
346
347#define NCXMOD_SEARCH_MODULE(R) (R)->module
348
349#define NCXMOD_SEARCH_REVISION(R) (R)->revision
350
351#define NCXMOD_SEARCH_SOURCE(R) (R)->source
352
353#define NCXMOD_SEARCH_NAMESPACE(R) (R)->namespacestr
354
355/* ncxmod_search_result_t flags */
356#define NCXMOD_FL_CAPMATCH bit0
357#define NCXMOD_FL_ISMOD bit1
358#define NCXMOD_FL_BEST bit2
359
360#define NCXMOD_SET_CAPMATCH(R) (R)->flags |= NCXMOD_FL_CAPMATCH
361#define NCXMOD_CLR_CAPMATCH(R) (R)->flags &= ~NCXMOD_FL_CAPMATCH
362#define NCXMOD_IS_CAPMATCH(R) ((R)->flags & NCXMOD_FL_CAPMATCH)
363
364#define NCXMOD_SET_ISMOD(R) (R)->flags |= NCXMOD_FL_ISMOD
365#define NCXMOD_IS_ISMOD(R) ((R)->flags & NCXMOD_FL_ISMOD)
366
367#define NCXMOD_SET_BEST(R) (R)->flags |= NCXMOD_FL_BEST
368#define NCXMOD_IS_BEST(R) ((R)->flags & NCXMOD_FL_BEST)
369
370/********************************************************************
371* *
372* T Y P E S *
373* *
374*********************************************************************/
375
388/* following 3 structs used for providing temporary
389 * work directories for yangcli sessions
390 */
391
393typedef struct ncxmod_temp_progcb_t_ {
394 dlq_hdr_t qhdr;
395 xmlChar *source;
396 dlq_hdr_t temp_sescbQ;
398
399
401typedef struct ncxmod_temp_sescb_t_ {
402 dlq_hdr_t qhdr;
403 xmlChar *source;
404 uint32 sidnum;
405 dlq_hdr_t temp_filcbQ;
407
408
410typedef struct ncxmod_temp_filcb_t_ {
411 dlq_hdr_t qhdr;
412 xmlChar *source;
413 const xmlChar *filename;
415
416
422typedef struct ncxmod_search_result_t_ {
423 dlq_hdr_t qhdr;
424 xmlChar *module;
425 xmlChar *belongsto;
426 xmlChar *revision;
427 xmlChar *namespacestr;
428 xmlChar *source;
431 uint32 nslen;
433 uint8 flags;
435
436
456typedef status_t (*ncxmod_callback_fn_t) (const char *fullspec,
457 void *cookie);
458
459
460
477typedef status_t (*ncxmod_backup_cbfn_t) (const char *fullspec,
478 const xmlChar *mtime,
479 void *cookie);
480
481
494typedef status_t
495 (*ncxmod_conf_cbfn_t) (const xmlChar *fullspec,
496 void *cookie);
497
498
499
507typedef void (*search_dumpfn_t) (log_debug_t level, const char *fstr, ...);
508
509
510/********************************************************************
511* *
512* F U N C T I O N S *
513* *
514*********************************************************************/
515
516
522extern status_t
523 ncxmod_init (void);
524
525
530extern void
531 ncxmod_log_env (void);
532
533
538extern void
539 ncxmod_cleanup (void);
540
541
570extern status_t
571 ncxmod_load_module (const xmlChar *modname,
572 const xmlChar *revision,
573 dlq_hdr_t *savedevQ,
574 ncx_module_t **retmod);
575
576
603extern status_t
604 ncxmod_load_module_loadpath (const xmlChar *modname,
605 const xmlChar *revision,
606 dlq_hdr_t *savedevQ,
607 boolean is_loadpath,
608 ncx_module_t **retmod);
609
610
644extern status_t
645 ncxmod_autoload_module (const xmlChar *modname,
646 const xmlChar *revision,
647 dlq_hdr_t *savedevQ,
648 dlq_hdr_t *savemodQ,
649 dlq_hdr_t *topfailedQ,
650 ncx_module_t **retmod);
651
652
680 ncxmod_find_module (const xmlChar *modname,
681 const xmlChar *revision);
682
683
710extern status_t
711 ncxmod_find_all_modules (dlq_hdr_t *resultQ);
712
713
726extern status_t
727 ncxmod_find_all_modules_ycli_cache (dlq_hdr_t *resultQ);
728
729
730
757extern status_t
758 ncxmod_load_deviation (const xmlChar *deviname,
759 dlq_hdr_t *deviationQ);
760
761
786extern status_t
787 ncxmod_load_annotation (const xmlChar *deviname,
788 dlq_hdr_t *deviationQ);
789
790
820extern status_t
821 ncxmod_load_imodule (const xmlChar *modname,
822 const xmlChar *revision,
823 yang_pcb_t *pcb,
824 yang_parsetype_t ptyp,
825 ncx_module_t *parent,
826 ncx_module_t **retmod);
827
828
852extern yang_pcb_t *
853 ncxmod_load_module_ex (const xmlChar *modname,
854 const xmlChar *revision,
855 boolean with_submods,
856 boolean savetkc,
857 boolean keepmode,
858 boolean docmode,
859 dlq_hdr_t *savedevQ,
860 status_t *res);
861
862
882extern yang_pcb_t *
883 ncxmod_load_module_diff (const xmlChar *modname,
884 const xmlChar *revision,
885 boolean with_submods,
886 const xmlChar *modpath,
887 dlq_hdr_t *savedevQ,
888 status_t *res);
889
890
919extern xmlChar *
920 ncxmod_find_data_file (const xmlChar *fname,
921 boolean generrors,
922 boolean backup_file,
923 status_t *res);
924
925
958extern xmlChar *
959 ncxmod_find_server_data_file (const xmlChar *fname,
960 boolean fileloc_fhs,
961 boolean generrors,
962 boolean backup_file,
963 boolean keep_result,
964 status_t *res);
965
966
967
992extern xmlChar *
993 ncxmod_find_sil_file (const xmlChar *fname,
994 boolean generrors,
995 status_t *res);
996
997
1023extern xmlChar *
1024 ncxmod_make_data_filespec (const xmlChar *fname,
1025 boolean backup_file,
1026 status_t *res);
1027
1028
1029
1045extern xmlChar *
1046 ncxmod_make_server_data_filespec (const xmlChar *fname,
1047 boolean fileloc_fhs,
1048 boolean backup_file,
1049 status_t *res);
1050
1051
1066extern xmlChar *
1067 ncxmod_make_data_filespec_from_src (const xmlChar *srcspec,
1068 const xmlChar *fname,
1069 status_t *res);
1070
1071
1094extern xmlChar *
1095 ncxmod_find_script_file (const xmlChar *fname,
1096 status_t *res);
1097
1098
1121extern xmlChar *
1122 ncxmod_find_test_suite_file (const xmlChar *fname,
1123 status_t *res);
1124
1125
1133extern status_t
1134 ncxmod_set_home (const xmlChar *home);
1135
1136
1143extern const xmlChar *
1144 ncxmod_get_home (void);
1145
1146
1156extern status_t
1157 ncxmod_set_yuma_home (const xmlChar *yumahome);
1158
1159
1166extern const xmlChar *
1167 ncxmod_get_yuma_home (void);
1168
1169
1176extern const xmlChar *
1178
1179
1188extern void
1189 ncxmod_set_modpath (const xmlChar *modpath);
1190
1191
1200extern void
1201 ncxmod_set_loadpath (const xmlChar *loadpath);
1202
1203
1210extern void
1211 ncxmod_set_datapath (const xmlChar *datapath);
1212
1213
1220extern void
1221 ncxmod_set_runpath (const xmlChar *runpath);
1222
1223
1230extern void
1231 ncxmod_set_subdirs (boolean usesubdirs);
1232
1233
1239extern const xmlChar *
1240 ncxmod_get_yumadir (void);
1241
1242
1257extern status_t
1258 ncxmod_process_subtree (const char *startspec,
1259 ncxmod_callback_fn_t callback,
1260 void *cookie);
1261
1262
1271extern boolean
1272 ncxmod_test_subdir (const xmlChar *dirspec);
1273
1274
1282extern const xmlChar *
1283 ncxmod_get_userhome (const xmlChar *user,
1284 uint32 userlen);
1285
1286
1294extern const xmlChar *
1295 ncxmod_get_envvar (const xmlChar *name,
1296 uint32 namelen);
1297
1298
1306extern void
1307 ncxmod_set_altpath (const xmlChar *altpath);
1308
1309
1314extern void
1315 ncxmod_clear_altpath (void);
1316
1317
1336extern status_t
1338 boolean logstdout);
1339
1340
1359extern status_t
1361 boolean logstdout);
1362
1363
1382extern status_t
1384 boolean logstdout);
1385
1386
1392extern status_t
1393 ncxmod_setup_yumadir (void);
1394
1395
1405extern status_t
1406 ncxmod_setup_yumadir_srid (const xmlChar *srid);
1407
1408
1413extern status_t
1414 ncxmod_setup_backup_dir (const xmlChar *backup_dir);
1415
1416
1428extern status_t
1429 ncxmod_setup_fhs_dirs (void);
1430
1431
1443extern status_t
1444 ncxmod_setup_fhs_srid_dirs (const xmlChar *server_root);
1445
1446
1452extern status_t
1453 ncxmod_setup_tempdir (void);
1454
1455
1466extern status_t
1467 ncxmod_setup_yumadir_force (const xmlChar *path);
1468
1469
1477
1478
1485 ncxmod_setup_yangcli_cache_dir (const xmlChar *cache_dir);
1486
1487
1495extern ncxmod_temp_progcb_t *
1497
1498
1504extern void
1506
1507
1517extern ncxmod_temp_sescb_t *
1519 uint32 sidnum,
1520 status_t *res);
1521
1522
1529extern void
1531 uint32 sidnum);
1532
1533
1543extern ncxmod_temp_filcb_t *
1545 const xmlChar *filename,
1546 status_t *res);
1547
1548
1554extern void
1556
1557
1565
1566
1575
1576
1585 ncxmod_new_search_result_str (const xmlChar *modname,
1586 const xmlChar *revision);
1587
1588
1594extern void
1596
1597
1598
1605extern void
1606 ncxmod_clean_search_result_queue (dlq_hdr_t *searchQ);
1607
1608
1622 ncxmod_find_search_result (dlq_hdr_t *searchQ,
1623 const xmlChar *modname,
1624 const xmlChar *revision,
1625 const xmlChar *nsuri);
1626
1627
1636
1637
1645extern boolean
1646 ncxmod_test_filespec (const xmlChar *filespec);
1647
1648
1655extern uint32
1656 ncxmod_get_pathlen_from_filespec (const xmlChar *filespec);
1657
1658
1666extern status_t
1667 ncxmod_get_file_mtime (const xmlChar *filespec,
1668 time_t *timebuff);
1669
1670
1681extern status_t
1683 void *cookie);
1684
1685
1695extern xmlChar *
1696 ncxmod_get_pid_filespec (const xmlChar *progname,
1697 boolean fileloc_fhs,
1698 status_t *res);
1699
1700
1711extern xmlChar *
1712 ncxmod_get_subdir_filespec (const xmlChar *subdir,
1713 boolean fileloc_fhs,
1714 status_t *res);
1715
1716
1728extern status_t
1729 ncxmod_read_num_file (const xmlChar *numfile,
1730 uint64 *curnum,
1731 boolean file_error);
1732
1733
1742extern status_t
1743 ncxmod_write_num_file (const xmlChar *numfile,
1744 uint64 curnum);
1745
1746
1754extern status_t
1755 ncxmod_copy_text_file (const xmlChar *src_filespec,
1756 const xmlChar *dest_filespec);
1757
1758
1759
1772extern status_t
1773 ncxmod_subsys_info_write (const xmlChar *filespec,
1774 const xmlChar *ipaddr,
1775 uint16 portnum);
1776
1777
1783extern void
1784 ncxmod_subsys_info_remove (const xmlChar *filespec);
1785
1786
1799extern status_t
1800 ncxmod_get_conf_files (const xmlChar *confdir,
1801 boolean must_exist,
1802 ncxmod_conf_cbfn_t cbfn,
1803 void *cookie);
1804
1805
1809extern status_t
1811
1812
1821extern status_t
1823 void *cookie);
1824
1825
1836extern status_t
1838 xmlChar *load_path,
1839 void *cookie);
1840
1841
1849extern boolean
1850 ncxmod_use_bestmatch_now (const xmlChar *revision);
1851
1852
1860extern void
1862 log_debug_t loglevel);
1863
1864
1872#ifdef WINDOWS
1873#define ncxmod_is_pschar(ch) \
1874 (((ch) == NCXMOD_PSCHAR) || ((ch) == NCXMOD_WIN_PSCHAR))
1875#else
1876#define ncxmod_is_pschar(ch) ((ch) == NCXMOD_PSCHAR)
1877#endif
1878
1879
1887extern const xmlChar *
1888 ncxmod_get_modpath (void);
1889
1890
1898extern const xmlChar *
1899 ncxmod_get_datapath (void);
1900
1901
1909extern const xmlChar *
1910 ncxmod_get_runpath (void);
1911
1912
1940extern xmlChar *
1941 ncxmod_find_sid_file (const xmlChar *fname,
1942 boolean generrors,
1943 status_t *res);
1944
1945
1949#ifdef __cplusplus
1950} /* end extern 'C' */
1951#endif
1952
1953#endif /* _H_ncxmod */
NETCONF protocol capabilities.
log_debug_t
The debug level enumerations used in util/log.c.
Definition: log.h:348
status_t
global error return code
Definition: status_enum.h:219
help_mode_t
modes to match the keywords brief, normal, full
Definition: help.h:84
void ncxmod_set_modpath(const xmlChar *modpath)
Override the YUMAPRO_MODPATH env var with the modpath CLI var.
Definition: ncxmod.c:6871
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:7267
status_t ncxmod_get_file_mtime(const xmlChar *filespec, time_t *timebuff)
Get the last-modified time for a file.
Definition: ncxmod.c:9133
status_t ncxmod_init(void)
Initialize the ncxmod module.
Definition: ncxmod.c:4541
const xmlChar * ncxmod_get_modpath(void)
Get the ncxmod_mod_path value.
Definition: ncxmod.c:10284
status_t ncxmod_load_annotation(const xmlChar *deviname, dlq_hdr_t *deviationQ)
Load an annotation module (special compiler processing)
Definition: ncxmod.c:5269
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:8590
void ncxmod_set_altpath(const xmlChar *altpath)
Set the alternate path that should be used first (for yangdiff)
Definition: ncxmod.c:7218
ncxmod_search_result_t * ncxmod_clone_search_result(const ncxmod_search_result_t *sr)
Clone a search result.
Definition: ncxmod.c:8985
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:456
boolean ncxmod_test_subdir(const xmlChar *dirspec)
Check if the specified string is a directory.
Definition: ncxmod.c:7102
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:5925
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:7613
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:7034
void ncxmod_set_runpath(const xmlChar *runpath)
Override the YUMAPRO_RUNPATH env var with the runpath CLI var.
Definition: ncxmod.c:6962
status_t ncxmod_setup_fhs_dirs(void)
Setup the following FHS location server directories if they do not already exist.
Definition: ncxmod.c:7997
void ncxmod_free_program_tempdir(ncxmod_temp_progcb_t *progcb)
Remove a program instance temp files directory.
Definition: ncxmod.c:8416
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:5582
void ncxmod_clear_altpath(void)
Clear the alternate path so none is used (for yangdiff)
Definition: ncxmod.c:7237
const xmlChar * ncxmod_get_yumadir(void)
Get the yuma directory being used.
Definition: ncxmod.c:7007
status_t ncxmod_setup_tempdir(void)
Setup the ~/.yuma/tmp directory if it does not exist.
Definition: ncxmod.c:8167
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:7440
xmlChar * ncxmod_find_sid_file(const xmlChar *fname, boolean generrors, status_t *res)
Determine the location of the specified Schema Item Identifier file.
Definition: ncxmod.c:10150
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:9213
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:9718
status_t ncxmod_set_home(const xmlChar *home)
Override the HOME env var with the home CLI var.
Definition: ncxmod.c:6702
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:5423
status_t ncxmod_set_bestmatch_modules(void)
Check for all the modules avialable for bestmatch checking.
Definition: ncxmod.c:9759
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:9169
uint32 ncxmod_get_pathlen_from_filespec(const xmlChar *filespec)
Get the length of th path part of the filespec string.
Definition: ncxmod.c:9092
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:6831
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:8443
boolean ncxmod_test_filespec(const xmlChar *filespec)
Check the exact filespec to see if it a file.
Definition: ncxmod.c:9063
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:5167
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:5805
status_t ncxmod_setup_yumadir(void)
Setup the ~/.yumapro directory if it does not exist.
Definition: ncxmod.c:7772
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:6098
void ncxmod_subsys_info_remove(const xmlChar *filespec)
Remove the subsystem info file.
Definition: ncxmod.c:9689
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:6250
ncxmod_search_result_t * ncxmod_new_search_result(void)
Malloc and initialize a search result struct.
Definition: ncxmod.c:8690
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:9810
void ncxmod_set_loadpath(const xmlChar *loadpath)
Override the YUMAPRO_LOADPATH env var with the loadpath CLI var.
Definition: ncxmod.c:6902
status_t ncxmod_setup_backup_dir(const xmlChar *backup_dir)
Setup the ~/.yumapro/backups directory if it does not exist.
Definition: ncxmod.c:7946
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:5139
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:8913
status_t ncxmod_set_yuma_home(const xmlChar *yumahome)
Override the YUMAPRO_HOME env var with the yuma-home CLI var.
Definition: ncxmod.c:6785
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:5314
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:495
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:4851
const xmlChar * ncxmod_get_home(void)
Get the HOME or –home parameter value, whichever is in effect, if any.
Definition: ncxmod.c:6767
void ncxmod_free_session_tempfile(ncxmod_temp_filcb_t *filcb)
Clean and free a session instance temp files directory.
Definition: ncxmod.c:8668
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:9364
status_t ncxmod_setup_recordtest_dir(void)
Setup the ~/.yuma/recordtest directory if it does not exist.
Definition: ncxmod.c:8216
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:4966
status_t ncxmod_setup_fhs_srid_dirs(const xmlChar *server_root)
Setup the following FHS SRID subdir location.
Definition: ncxmod.c:8084
void ncxmod_free_session_tempdir(ncxmod_temp_progcb_t *progcb, uint32 sidnum)
Clean and free a session instance temp files directory.
Definition: ncxmod.c:8539
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:477
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:5500
const xmlChar * ncxmod_get_datapath(void)
Get the ncxmod_data_path value.
Definition: ncxmod.c:10301
status_t ncxmod_setup_yumadir_force(const xmlChar *path)
Setup the ~/.yumapro directory if it does not exist.
Definition: ncxmod.c:7914
void ncxmod_dump_module_search_path(search_dumpfn_t dumpfn, log_debug_t loglevel)
Output the YANG module search path.
Definition: ncxmod.c:9890
status_t ncxmod_setup_yumadir_srid(const xmlChar *srid)
Setup the ~/.yumapro/SRID directory if it does not exist.
Definition: ncxmod.c:7847
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:9450
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:9294
void ncxmod_cleanup(void)
Cleanup the ncxmod module.
Definition: ncxmod.c:4734
status_t ncxmod_subsys_info_write(const xmlChar *filespec, const xmlChar *ipaddr, uint16 portnum)
Write the subsystem info file;.
Definition: ncxmod.c:9608
void ncxmod_set_subdirs(boolean usesubdirs)
Set the subdirs flag to FALSE if the no-subdirs CLI param is set.
Definition: ncxmod.c:6991
void ncxmod_set_datapath(const xmlChar *datapath)
Override the YUMA_DATAPATH env var with the datapath CLI var.
Definition: ncxmod.c:6932
ncxmod_temp_progcb_t * ncxmod_new_program_tempdir(status_t *res)
Setup a program instance temp files directory.
Definition: ncxmod.c:8313
const xmlChar * ncxmod_get_runpath(void)
Get the ncxmod_run_path value.
Definition: ncxmod.c:10318
void ncxmod_log_env(void)
Report the environment variables used by the running system.
Definition: ncxmod.c:4683
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:8266
const xmlChar * ncxmod_get_envvar(const xmlChar *name, uint32 namelen)
Get the specified shell environment variable.
Definition: ncxmod.c:7183
boolean ncxmod_use_bestmatch_now(const xmlChar *revision)
Check if the bestmatch can be used for this module.
Definition: ncxmod.c:9874
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:8800
const xmlChar * ncxmod_get_userhome(const xmlChar *user, uint32 userlen)
Get the user home dir from the passwd file.
Definition: ncxmod.c:7132
ncxmod_search_result_t * ncxmod_new_search_result_ex(const ncx_module_t *mod)
Malloc and initialize a search result struct.
Definition: ncxmod.c:8717
void ncxmod_free_search_result(ncxmod_search_result_t *searchresult)
Clean and free a search result struct.
Definition: ncxmod.c:8844
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:6358
xmlChar * ncxmod_find_script_file(const xmlChar *fname, status_t *res)
Determine the location of the specified script file.
Definition: ncxmod.c:6445
const xmlChar * ncxmod_get_yuma_install(void)
Get the YUMAPRO_INSTALL or default install parameter value, whichever is in effect.
Definition: ncxmod.c:6848
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...
Definition: ncxmod.c:9841
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:8880
xmlChar * ncxmod_find_test_suite_file(const xmlChar *fname, status_t *res)
Determine the location of the specified test-suite file.
Definition: ncxmod.c:6575
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:9515
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:5063
void(* search_dumpfn_t)(log_debug_t level, const char *fstr,...)
Callback to do log dump function for show searchpath.
Definition: ncxmod.h:507
yang_parsetype_t
YANG parser mode entry types.
Definition: yang.h:104
YANG help text support for CLI Print help text for various templates.
YANG module data structures Many internal representations of YANG module constructs.
Global error messages for status code enumerations.
queue of this structure for list of enterprise capabilities
Definition: cap.h:319
representation of one module or submodule during and after parsing
Definition: ncxtypes.h:1138
struct for storing YANG file search results this is used by yangcli for schema auto-load also for fin...
Definition: ncxmod.h:422
xmlChar * source
file location
Definition: ncxmod.h:428
xmlChar * module
module or submodule name
Definition: ncxmod.h:424
dlq_hdr_t qhdr
queue header
Definition: ncxmod.h:423
xmlChar * namespacestr
set if module & namespace found
Definition: ncxmod.h:427
status_t res
search result, only use if NO_ERR
Definition: ncxmod.h:430
xmlChar * revision
set if most recent revision found
Definition: ncxmod.h:426
ncx_module_t * mod
back-ptr to found module if loaded
Definition: ncxmod.h:429
xmlChar * belongsto
set if submodule & belongs-to found
Definition: ncxmod.h:425
uint8 flags
replaces capmatch and ismod
Definition: ncxmod.h:433
cap_rec_t * cap
back-ptr to source capability URI
Definition: ncxmod.h:432
uint32 nslen
length of base part of namespacestr
Definition: ncxmod.h:431
temporary file control block
Definition: ncxmod.h:410
xmlChar * source
filespec source string
Definition: ncxmod.h:412
dlq_hdr_t qhdr
queue header
Definition: ncxmod.h:411
const xmlChar * filename
ptr into source
Definition: ncxmod.h:413
program-level temp dir control block
Definition: ncxmod.h:393
xmlChar * source
filespec source string
Definition: ncxmod.h:395
dlq_hdr_t temp_sescbQ
Q of ncxmod_temp_sescb_t.
Definition: ncxmod.h:396
dlq_hdr_t qhdr
queue header
Definition: ncxmod.h:394
session-level temp-dir control block
Definition: ncxmod.h:401
xmlChar * source
filespec source string
Definition: ncxmod.h:403
dlq_hdr_t temp_filcbQ
Q of ncxmod_temp_filcb_t.
Definition: ncxmod.h:405
dlq_hdr_t qhdr
queue header
Definition: ncxmod.h:402
uint32 sidnum
session ID number
Definition: ncxmod.h:404
YANG parser control block.
Definition: yang.h:204
YANG Module parser utilities.