yumapro  24.10-1
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 - 2022, 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
567extern status_t
568 ncxmod_load_module (const xmlChar *modname,
569 const xmlChar *revision,
570 dlq_hdr_t *savedevQ,
571 ncx_module_t **retmod);
572
573
600extern status_t
601 ncxmod_load_module_loadpath (const xmlChar *modname,
602 const xmlChar *revision,
603 dlq_hdr_t *savedevQ,
604 boolean is_loadpath,
605 ncx_module_t **retmod);
606
607
641extern status_t
642 ncxmod_autoload_module (const xmlChar *modname,
643 const xmlChar *revision,
644 dlq_hdr_t *savedevQ,
645 dlq_hdr_t *savemodQ,
646 dlq_hdr_t *topfailedQ,
647 ncx_module_t **retmod);
648
649
677 ncxmod_find_module (const xmlChar *modname,
678 const xmlChar *revision);
679
680
707extern status_t
708 ncxmod_find_all_modules (dlq_hdr_t *resultQ);
709
710
723extern status_t
724 ncxmod_find_all_modules_ycli_cache (dlq_hdr_t *resultQ);
725
726
727
751extern status_t
752 ncxmod_load_deviation (const xmlChar *deviname,
753 dlq_hdr_t *deviationQ);
754
755
780extern status_t
781 ncxmod_load_annotation (const xmlChar *deviname,
782 dlq_hdr_t *deviationQ);
783
784
814extern status_t
815 ncxmod_load_imodule (const xmlChar *modname,
816 const xmlChar *revision,
817 yang_pcb_t *pcb,
818 yang_parsetype_t ptyp,
819 ncx_module_t *parent,
820 ncx_module_t **retmod);
821
822
846extern yang_pcb_t *
847 ncxmod_load_module_ex (const xmlChar *modname,
848 const xmlChar *revision,
849 boolean with_submods,
850 boolean savetkc,
851 boolean keepmode,
852 boolean docmode,
853 dlq_hdr_t *savedevQ,
854 status_t *res);
855
856
876extern yang_pcb_t *
877 ncxmod_load_module_diff (const xmlChar *modname,
878 const xmlChar *revision,
879 boolean with_submods,
880 const xmlChar *modpath,
881 dlq_hdr_t *savedevQ,
882 status_t *res);
883
884
913extern xmlChar *
914 ncxmod_find_data_file (const xmlChar *fname,
915 boolean generrors,
916 boolean backup_file,
917 status_t *res);
918
919
952extern xmlChar *
953 ncxmod_find_server_data_file (const xmlChar *fname,
954 boolean fileloc_fhs,
955 boolean generrors,
956 boolean backup_file,
957 boolean keep_result,
958 status_t *res);
959
960
961
986extern xmlChar *
987 ncxmod_find_sil_file (const xmlChar *fname,
988 boolean generrors,
989 status_t *res);
990
991
1017extern xmlChar *
1018 ncxmod_make_data_filespec (const xmlChar *fname,
1019 boolean backup_file,
1020 status_t *res);
1021
1022
1023
1039extern xmlChar *
1040 ncxmod_make_server_data_filespec (const xmlChar *fname,
1041 boolean fileloc_fhs,
1042 boolean backup_file,
1043 status_t *res);
1044
1045
1060extern xmlChar *
1061 ncxmod_make_data_filespec_from_src (const xmlChar *srcspec,
1062 const xmlChar *fname,
1063 status_t *res);
1064
1065
1088extern xmlChar *
1089 ncxmod_find_script_file (const xmlChar *fname,
1090 status_t *res);
1091
1092
1115extern xmlChar *
1116 ncxmod_find_test_suite_file (const xmlChar *fname,
1117 status_t *res);
1118
1119
1127extern status_t
1128 ncxmod_set_home (const xmlChar *home);
1129
1130
1137extern const xmlChar *
1138 ncxmod_get_home (void);
1139
1140
1150extern status_t
1151 ncxmod_set_yuma_home (const xmlChar *yumahome);
1152
1153
1160extern const xmlChar *
1161 ncxmod_get_yuma_home (void);
1162
1163
1170extern const xmlChar *
1172
1173
1182extern void
1183 ncxmod_set_modpath (const xmlChar *modpath);
1184
1185
1194extern void
1195 ncxmod_set_loadpath (const xmlChar *loadpath);
1196
1197
1204extern void
1205 ncxmod_set_datapath (const xmlChar *datapath);
1206
1207
1214extern void
1215 ncxmod_set_runpath (const xmlChar *runpath);
1216
1217
1224extern void
1225 ncxmod_set_subdirs (boolean usesubdirs);
1226
1227
1233extern const xmlChar *
1234 ncxmod_get_yumadir (void);
1235
1236
1251extern status_t
1252 ncxmod_process_subtree (const char *startspec,
1253 ncxmod_callback_fn_t callback,
1254 void *cookie);
1255
1256
1265extern boolean
1266 ncxmod_test_subdir (const xmlChar *dirspec);
1267
1268
1276extern const xmlChar *
1277 ncxmod_get_userhome (const xmlChar *user,
1278 uint32 userlen);
1279
1280
1288extern const xmlChar *
1289 ncxmod_get_envvar (const xmlChar *name,
1290 uint32 namelen);
1291
1292
1300extern void
1301 ncxmod_set_altpath (const xmlChar *altpath);
1302
1303
1308extern void
1309 ncxmod_clear_altpath (void);
1310
1311
1330extern status_t
1332 boolean logstdout);
1333
1334
1353extern status_t
1355 boolean logstdout);
1356
1357
1376extern status_t
1378 boolean logstdout);
1379
1380
1386extern status_t
1387 ncxmod_setup_yumadir (void);
1388
1389
1399extern status_t
1400 ncxmod_setup_yumadir_srid (const xmlChar *srid);
1401
1402
1407extern status_t
1408 ncxmod_setup_backup_dir (const xmlChar *backup_dir);
1409
1410
1422extern status_t
1423 ncxmod_setup_fhs_dirs (void);
1424
1425
1437extern status_t
1438 ncxmod_setup_fhs_srid_dirs (const xmlChar *server_root);
1439
1440
1446extern status_t
1447 ncxmod_setup_tempdir (void);
1448
1449
1460extern status_t
1461 ncxmod_setup_yumadir_force (const xmlChar *path);
1462
1463
1471
1472
1479 ncxmod_setup_yangcli_cache_dir (const xmlChar *cache_dir);
1480
1481
1489extern ncxmod_temp_progcb_t *
1491
1492
1498extern void
1500
1501
1511extern ncxmod_temp_sescb_t *
1513 uint32 sidnum,
1514 status_t *res);
1515
1516
1523extern void
1525 uint32 sidnum);
1526
1527
1537extern ncxmod_temp_filcb_t *
1539 const xmlChar *filename,
1540 status_t *res);
1541
1542
1548extern void
1550
1551
1559
1560
1569
1570
1579 ncxmod_new_search_result_str (const xmlChar *modname,
1580 const xmlChar *revision);
1581
1582
1588extern void
1590
1591
1592
1599extern void
1600 ncxmod_clean_search_result_queue (dlq_hdr_t *searchQ);
1601
1602
1616 ncxmod_find_search_result (dlq_hdr_t *searchQ,
1617 const xmlChar *modname,
1618 const xmlChar *revision,
1619 const xmlChar *nsuri);
1620
1621
1630
1631
1639extern boolean
1640 ncxmod_test_filespec (const xmlChar *filespec);
1641
1642
1649extern uint32
1650 ncxmod_get_pathlen_from_filespec (const xmlChar *filespec);
1651
1652
1660extern status_t
1661 ncxmod_get_file_mtime (const xmlChar *filespec,
1662 time_t *timebuff);
1663
1664
1675extern status_t
1677 void *cookie);
1678
1679
1689extern xmlChar *
1690 ncxmod_get_pid_filespec (const xmlChar *progname,
1691 boolean fileloc_fhs,
1692 status_t *res);
1693
1694
1705extern xmlChar *
1706 ncxmod_get_subdir_filespec (const xmlChar *subdir,
1707 boolean fileloc_fhs,
1708 status_t *res);
1709
1710
1722extern status_t
1723 ncxmod_read_num_file (const xmlChar *numfile,
1724 uint64 *curnum,
1725 boolean file_error);
1726
1727
1736extern status_t
1737 ncxmod_write_num_file (const xmlChar *numfile,
1738 uint64 curnum);
1739
1740
1748extern status_t
1749 ncxmod_copy_text_file (const xmlChar *src_filespec,
1750 const xmlChar *dest_filespec);
1751
1752
1753
1766extern status_t
1767 ncxmod_subsys_info_write (const xmlChar *filespec,
1768 const xmlChar *ipaddr,
1769 uint16 portnum);
1770
1771
1777extern void
1778 ncxmod_subsys_info_remove (const xmlChar *filespec);
1779
1780
1793extern status_t
1794 ncxmod_get_conf_files (const xmlChar *confdir,
1795 boolean must_exist,
1796 ncxmod_conf_cbfn_t cbfn,
1797 void *cookie);
1798
1799
1803extern status_t
1805
1806
1815extern status_t
1817 void *cookie);
1818
1819
1830extern status_t
1832 xmlChar *load_path,
1833 void *cookie);
1834
1835
1843extern boolean
1844 ncxmod_use_bestmatch_now (const xmlChar *revision);
1845
1846
1854extern void
1856 log_debug_t loglevel);
1857
1858
1866#ifdef WINDOWS
1867#define ncxmod_is_pschar(ch) \
1868 (((ch) == NCXMOD_PSCHAR) || ((ch) == NCXMOD_WIN_PSCHAR))
1869#else
1870#define ncxmod_is_pschar(ch) ((ch) == NCXMOD_PSCHAR)
1871#endif
1872
1873
1881extern const xmlChar *
1882 ncxmod_get_modpath (void);
1883
1884
1892extern const xmlChar *
1893 ncxmod_get_datapath (void);
1894
1895
1903extern const xmlChar *
1904 ncxmod_get_runpath (void);
1905
1906
1934extern xmlChar *
1935 ncxmod_find_sid_file (const xmlChar *fname,
1936 boolean generrors,
1937 status_t *res);
1938
1939
1943#ifdef __cplusplus
1944} /* end extern 'C' */
1945#endif
1946
1947#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:210
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:6852
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:7248
status_t ncxmod_get_file_mtime(const xmlChar *filespec, time_t *timebuff)
Get the last-modified time for a file.
Definition: ncxmod.c:9114
status_t ncxmod_init(void)
Initialize the ncxmod module.
Definition: ncxmod.c:4522
const xmlChar * ncxmod_get_modpath(void)
Get the ncxmod_mod_path value.
Definition: ncxmod.c:10265
status_t ncxmod_load_annotation(const xmlChar *deviname, dlq_hdr_t *deviationQ)
Load an annotation module (special compiler processing)
Definition: ncxmod.c:5250
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:8571
void ncxmod_set_altpath(const xmlChar *altpath)
Set the alternate path that should be used first (for yangdiff)
Definition: ncxmod.c:7199
ncxmod_search_result_t * ncxmod_clone_search_result(const ncxmod_search_result_t *sr)
Clone a search result.
Definition: ncxmod.c:8966
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:7083
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:5906
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:7594
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:7015
void ncxmod_set_runpath(const xmlChar *runpath)
Override the YUMAPRO_RUNPATH env var with the runpath CLI var.
Definition: ncxmod.c:6943
status_t ncxmod_setup_fhs_dirs(void)
Setup the following FHS location server directories if they do not already exist.
Definition: ncxmod.c:7978
void ncxmod_free_program_tempdir(ncxmod_temp_progcb_t *progcb)
Remove a program instance temp files directory.
Definition: ncxmod.c:8397
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:5563
void ncxmod_clear_altpath(void)
Clear the alternate path so none is used (for yangdiff)
Definition: ncxmod.c:7218
const xmlChar * ncxmod_get_yumadir(void)
Get the yuma directory being used.
Definition: ncxmod.c:6988
status_t ncxmod_setup_tempdir(void)
Setup the ~/.yuma/tmp directory if it does not exist.
Definition: ncxmod.c:8148
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:7421
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:10131
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:9194
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:9699
status_t ncxmod_set_home(const xmlChar *home)
Override the HOME env var with the home CLI var.
Definition: ncxmod.c:6683
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:5404
status_t ncxmod_set_bestmatch_modules(void)
Check for all the modules avialable for bestmatch checking.
Definition: ncxmod.c:9740
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:9150
uint32 ncxmod_get_pathlen_from_filespec(const xmlChar *filespec)
Get the length of th path part of the filespec string.
Definition: ncxmod.c:9073
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:6812
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:8424
boolean ncxmod_test_filespec(const xmlChar *filespec)
Check the exact filespec to see if it a file.
Definition: ncxmod.c:9044
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:5148
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:5786
status_t ncxmod_setup_yumadir(void)
Setup the ~/.yumapro directory if it does not exist.
Definition: ncxmod.c:7753
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:6079
void ncxmod_subsys_info_remove(const xmlChar *filespec)
Remove the subsystem info file.
Definition: ncxmod.c:9670
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:6231
ncxmod_search_result_t * ncxmod_new_search_result(void)
Malloc and initialize a search result struct.
Definition: ncxmod.c:8671
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:9791
void ncxmod_set_loadpath(const xmlChar *loadpath)
Override the YUMAPRO_LOADPATH env var with the loadpath CLI var.
Definition: ncxmod.c:6883
status_t ncxmod_setup_backup_dir(const xmlChar *backup_dir)
Setup the ~/.yumapro/backups directory if it does not exist.
Definition: ncxmod.c:7927
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:5120
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:8894
status_t ncxmod_set_yuma_home(const xmlChar *yumahome)
Override the YUMAPRO_HOME env var with the yuma-home CLI var.
Definition: ncxmod.c:6766
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:5295
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:4832
const xmlChar * ncxmod_get_home(void)
Get the HOME or –home parameter value, whichever is in effect, if any.
Definition: ncxmod.c:6748
void ncxmod_free_session_tempfile(ncxmod_temp_filcb_t *filcb)
Clean and free a session instance temp files directory.
Definition: ncxmod.c:8649
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:9345
status_t ncxmod_setup_recordtest_dir(void)
Setup the ~/.yuma/recordtest directory if it does not exist.
Definition: ncxmod.c:8197
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:4947
status_t ncxmod_setup_fhs_srid_dirs(const xmlChar *server_root)
Setup the following FHS SRID subdir location.
Definition: ncxmod.c:8065
void ncxmod_free_session_tempdir(ncxmod_temp_progcb_t *progcb, uint32 sidnum)
Clean and free a session instance temp files directory.
Definition: ncxmod.c:8520
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
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:4786
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:5481
const xmlChar * ncxmod_get_datapath(void)
Get the ncxmod_data_path value.
Definition: ncxmod.c:10282
status_t ncxmod_setup_yumadir_force(const xmlChar *path)
Setup the ~/.yumapro directory if it does not exist.
Definition: ncxmod.c:7895
void ncxmod_dump_module_search_path(search_dumpfn_t dumpfn, log_debug_t loglevel)
Output the YANG module search path.
Definition: ncxmod.c:9871
status_t ncxmod_setup_yumadir_srid(const xmlChar *srid)
Setup the ~/.yumapro/SRID directory if it does not exist.
Definition: ncxmod.c:7828
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:9431
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:9275
void ncxmod_cleanup(void)
Cleanup the ncxmod module.
Definition: ncxmod.c:4715
status_t ncxmod_subsys_info_write(const xmlChar *filespec, const xmlChar *ipaddr, uint16 portnum)
Write the subsystem info file;.
Definition: ncxmod.c:9589
void ncxmod_set_subdirs(boolean usesubdirs)
Set the subdirs flag to FALSE if the no-subdirs CLI param is set.
Definition: ncxmod.c:6972
void ncxmod_set_datapath(const xmlChar *datapath)
Override the YUMA_DATAPATH env var with the datapath CLI var.
Definition: ncxmod.c:6913
ncxmod_temp_progcb_t * ncxmod_new_program_tempdir(status_t *res)
Setup a program instance temp files directory.
Definition: ncxmod.c:8294
const xmlChar * ncxmod_get_runpath(void)
Get the ncxmod_run_path value.
Definition: ncxmod.c:10299
void ncxmod_log_env(void)
Report the environment variables used by the running system.
Definition: ncxmod.c:4664
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:8247
const xmlChar * ncxmod_get_envvar(const xmlChar *name, uint32 namelen)
Get the specified shell environment variable.
Definition: ncxmod.c:7164
boolean ncxmod_use_bestmatch_now(const xmlChar *revision)
Check if the bestmatch can be used for this module.
Definition: ncxmod.c:9855
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:8781
const xmlChar * ncxmod_get_userhome(const xmlChar *user, uint32 userlen)
Get the user home dir from the passwd file.
Definition: ncxmod.c:7113
ncxmod_search_result_t * ncxmod_new_search_result_ex(const ncx_module_t *mod)
Malloc and initialize a search result struct.
Definition: ncxmod.c:8698
void ncxmod_free_search_result(ncxmod_search_result_t *searchresult)
Clean and free a search result struct.
Definition: ncxmod.c:8825
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:6339
xmlChar * ncxmod_find_script_file(const xmlChar *fname, status_t *res)
Determine the location of the specified script file.
Definition: ncxmod.c:6426
const xmlChar * ncxmod_get_yuma_install(void)
Get the YUMAPRO_INSTALL or default install parameter value, whichever is in effect.
Definition: ncxmod.c:6829
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:9822
status_t ncxmod_load_deviation(const xmlChar *deviname, dlq_hdr_t *deviationQ)
Load a deviation module (special handling by compiler)
Definition: ncxmod.c:5209
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:8861
xmlChar * ncxmod_find_test_suite_file(const xmlChar *fname, status_t *res)
Determine the location of the specified test-suite file.
Definition: ncxmod.c:6556
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:9496
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:5044
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.