yumapro  20.10-12
YumaPro SDK
yang.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2008 - 2012, Andy Bierman, All Rights Reserved.
3  * Copyright (c) 2012 - 2021, 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_yang
13 #define _H_yang
14 
15 /* FILE: yang.h
16 *********************************************************************
17 * *
18 * P U R P O S E *
19 * *
20 *********************************************************************/
21 
27 /*********************************************************************
28 * *
29 * C H A N G E H I S T O R Y *
30 * *
31 *********************************************************************
32 
33 date init comment
34 ----------------------------------------------------------------------
35 15-nov-07 abb Begun; start from yang_parse.c
36 
37 */
38 
39 #include <xmlstring.h>
40 
41 #ifndef _H_dlq
42 #include "dlq.h"
43 #endif
44 
45 #ifndef _H_ext
46 #include "ext.h"
47 #endif
48 
49 #ifndef _H_grp
50 #include "grp.h"
51 #endif
52 
53 #ifndef _H_ncxtypes
54 #include "ncxtypes.h"
55 #endif
56 
57 #ifndef _H_obj
58 #include "obj.h"
59 #endif
60 
61 #ifndef _H_status
62 #include "status.h"
63 #endif
64 
65 #ifndef _H_tk
66 #include "tk.h"
67 #endif
68 
69 #ifndef _H_typ
70 #include "typ.h"
71 #endif
72 
73 #ifdef __cplusplus
74 extern "C" {
75 #endif
76 
77 /********************************************************************
78 * *
79 * T Y P E S *
80 * *
81 *********************************************************************/
82 
83 /* Group yangcomp defined in ncx.h */
84 
85  // BEGIN ncxlib/yang/yangcomp/yangcomp-parse
92 
93  // BEGIN ncxlib/yang/yangcomp/yangcompparse
101 
102 
104 typedef enum yang_parsetype_t_ {
109 } yang_parsetype_t;
110 
111 
112 /* YANG statement types for yang_stmt_t order struct */
113 typedef enum yang_stmttype_t_ {
114  YANG_ST_NONE,
115  YANG_ST_TYPEDEF, /* node is typ_template_t */
116  YANG_ST_GROUPING, /* node is grp_template_t */
117  YANG_ST_EXTENSION, /* node is ext_template_t */
118  YANG_ST_OBJECT, /* node is obj_template_t */
119  YANG_ST_IDENTITY, /* node is ncx_identity_t */
120  YANG_ST_FEATURE, /* node is ncx_feature_t */
121  YANG_ST_DEVIATION /* node is ncx_deviation_t */
122 } yang_stmttype_t;
123 
124 
126 typedef struct yang_stmt_t_ {
128  dlq_hdr_t qhdr;
129 
131  yang_stmttype_t stmttype;
132 
134  union s_ {
135  typ_template_t *typ;
136  grp_template_t *grp;
137  ext_template_t *ext;
138  obj_template_t *obj;
139  ncx_identity_t *identity;
140  ncx_feature_t *feature;
141  obj_deviation_t *deviation;
142  } s;
143 } yang_stmt_t;
144 
145 
147 typedef struct yang_node_t_ {
148  dlq_hdr_t qhdr;
149  const xmlChar *name;
150  const xmlChar *revision;
151  ncx_module_t *mod;
152  ncx_module_t *submod;
153  xmlChar *failed;
154  xmlChar *failedrev;
155  status_t res;
156  ncx_error_t tkerr;
157 } yang_node_t;
158 
159 
161 typedef struct yang_import_ptr_t_ {
162  dlq_hdr_t qhdr;
163  xmlChar *modname;
164  xmlChar *modprefix;
165  xmlChar *revision;
166  xmlChar *descr;
167  xmlChar *ref;
168 } yang_import_ptr_t;
169 
170 
174 typedef struct failed_ptr_t_ {
175  dlq_hdr_t qhdr;
176  xmlChar *modname;
177  xmlChar *revision;
178  status_t status;
179 } failed_ptr_t;
180 
181 
204 typedef struct yang_pcb_t_ {
205  struct ncx_module_t_ *top;
208  const xmlChar *revision;
209  boolean with_submods;
210  boolean stmtmode;
211  boolean diffmode;
212  boolean deviationmode;
213  boolean annotation;
214  boolean searchmode;
215  boolean parsemode;
216  boolean keepmode;
217  boolean topfound;
218  boolean topadded;
219  boolean savetkc;
220  boolean docmode;
221  boolean trackmode;
222  boolean reparse;
223  boolean set_supported;
224  boolean res_dev;
225  boolean autoloadmode;
226  boolean in_grouping;
227  boolean in_yangdata;
228  boolean retmod_malloced;
229  boolean swaptop;
230  boolean freetop;
231  dlq_hdr_t allimpQ;
233  dlq_hdr_t *topfailedQ;
234  dlq_hdr_t *savedevQ;
235  dlq_hdr_t *savemodQ;
236  tk_chain_t *tkc;
239  dlq_hdr_t impchainQ;
240  dlq_hdr_t failedQ;
242 } yang_pcb_t;
243 
244 
245 /********************************************************************
246 * *
247 * F U N C T I O N S *
248 * *
249 *********************************************************************/
250 
251 
268 extern status_t
269  yang_consume_semiapp (tk_chain_t *tkc,
270  ncx_module_t *mod,
271  dlq_hdr_t *appinfoQ);
272 
273 
289 extern status_t
290  yang_consume_string (tk_chain_t *tkc,
291  ncx_module_t *mod,
292  xmlChar **field);
293 
294 
311 extern status_t
312  yang_consume_keyword (tk_chain_t *tkc,
313  ncx_module_t *mod,
314  xmlChar **prefix,
315  xmlChar **field);
316 
317 
335 extern status_t
336  yang_consume_nowsp_string (tk_chain_t *tkc,
337  ncx_module_t *mod,
338  xmlChar **field);
339 
340 
358 extern status_t
359  yang_consume_id_string (tk_chain_t *tkc,
360  ncx_module_t *mod,
361  xmlChar **field);
362 
363 
384 extern status_t
385  yang_consume_pid_string (tk_chain_t *tkc,
386  ncx_module_t *mod,
387  xmlChar **prefix,
388  xmlChar **field);
389 
390 
415 extern status_t
416  yang_consume_error_stmts (tk_chain_t *tkc,
417  ncx_module_t *mod,
418  ncx_errinfo_t *errinfo,
419  dlq_hdr_t *appinfoQ,
420  boolean allow_modifier,
421  boolean *gotinverted);
422 
423 
444 extern status_t
445  yang_consume_descr (tk_chain_t *tkc,
446  ncx_module_t *mod,
447  xmlChar **str,
448  boolean *dupflag,
449  dlq_hdr_t *appinfoQ);
450 
451 
478 extern status_t
479  yang_consume_pid (tk_chain_t *tkc,
480  ncx_module_t *mod,
481  xmlChar **prefixstr,
482  xmlChar **str,
483  boolean *dupflag,
484  dlq_hdr_t *appinfoQ);
485 
486 
487 
508 extern status_t
509  yang_consume_strclause (tk_chain_t *tkc,
510  ncx_module_t *mod,
511  xmlChar **str,
512  boolean *dupflag,
513  dlq_hdr_t *appinfoQ);
514 
515 
536 extern status_t
537  yang_consume_status (tk_chain_t *tkc,
538  ncx_module_t *mod,
539  ncx_status_t *status,
540  boolean *dupflag,
541  dlq_hdr_t *appinfoQ);
542 
543 
564 extern status_t
565  yang_consume_ordered_by (tk_chain_t *tkc,
566  ncx_module_t *mod,
567  boolean *ordsys,
568  boolean *dupflag,
569  dlq_hdr_t *appinfoQ);
570 
571 
592 extern status_t
593  yang_consume_max_elements (tk_chain_t *tkc,
594  ncx_module_t *mod,
595  uint32 *maxelems,
596  boolean *dupflag,
597  dlq_hdr_t *appinfoQ);
598 
599 
620 extern status_t
621  yang_consume_must (tk_chain_t *tkc,
622  ncx_module_t *mod,
623  dlq_hdr_t *mustQ,
624  dlq_hdr_t *appinfoQ,
625  boolean do_parse);
626 
627 
649 extern status_t
650  yang_consume_when (tk_chain_t *tkc,
651  ncx_module_t *mod,
652  obj_template_t *obj,
653  boolean *whenflag);
654 
655 
656 
676 extern status_t
677  yang_consume_boolean (tk_chain_t *tkc,
678  ncx_module_t *mod,
679  boolean *boolval,
680  boolean *dupflag,
681  dlq_hdr_t *appinfoQ);
682 
683 
703 extern status_t
704  yang_consume_int32 (tk_chain_t *tkc,
705  ncx_module_t *mod,
706  int32 *num,
707  boolean *dupflag,
708  dlq_hdr_t *appinfoQ);
709 
710 
731 extern status_t
732  yang_consume_uint32 (tk_chain_t *tkc,
733  ncx_module_t *mod,
734  uint32 *num,
735  boolean *dupflag,
736  dlq_hdr_t *appinfoQ);
737 
738 
759 extern status_t
760  yang_consume_modifier (tk_chain_t *tkc,
761  ncx_module_t *mod,
762  boolean *dupflag,
763  dlq_hdr_t *appinfoQ);
764 
765 
782 extern status_t
783  yang_find_imp_typedef (yang_pcb_t *pcb,
784  tk_chain_t *tkc,
785  ncx_module_t *mod,
786  const xmlChar *prefix,
787  const xmlChar *name,
788  ncx_error_t *tkerr,
789  typ_template_t **typ);
790 
791 
808 extern status_t
809  yang_find_imp_grouping (yang_pcb_t *pcb,
810  tk_chain_t *tkc,
811  ncx_module_t *mod,
812  const xmlChar *prefix,
813  const xmlChar *name,
814  ncx_error_t *tkerr,
815  grp_template_t **grp);
816 
817 
834 extern status_t
835  yang_find_imp_extension (yang_pcb_t *pcb,
836  tk_chain_t *tkc,
837  ncx_module_t *mod,
838  const xmlChar *prefix,
839  const xmlChar *name,
840  ncx_error_t *tkerr,
841  ext_template_t **ext);
842 
843 
860 extern status_t
861  yang_find_imp_feature (yang_pcb_t *pcb,
862  tk_chain_t *tkc,
863  ncx_module_t *mod,
864  const xmlChar *prefix,
865  const xmlChar *name,
866  ncx_error_t *tkerr,
867  ncx_feature_t **feature);
868 
869 
886 extern status_t
887  yang_find_imp_identity (yang_pcb_t *pcb,
888  tk_chain_t *tkc,
889  ncx_module_t *mod,
890  const xmlChar *prefix,
891  const xmlChar *name,
892  ncx_error_t *tkerr,
893  ncx_identity_t **identity);
894 
895 
910 extern void
911  yang_check_obj_used (tk_chain_t *tkc,
912  ncx_module_t *mod,
913  dlq_hdr_t *typeQ,
914  dlq_hdr_t *grpQ);
915 
916 
930 extern void
931  yang_check_imports_used (tk_chain_t *tkc,
932  ncx_module_t *mod);
933 
934 
940 extern yang_node_t *
941  yang_new_node (void);
942 
943 
949 extern void
950  yang_free_node (yang_node_t *node);
951 
952 
958 extern void
959  yang_clean_nodeQ (dlq_hdr_t *que);
960 
961 
970 extern yang_node_t *
971  yang_find_node (const dlq_hdr_t *que,
972  const xmlChar *name,
973  const xmlChar *revision);
974 
975 
982 extern void
983  yang_dump_nodeQ (dlq_hdr_t *que,
984  const char *name);
985 
986 
992 extern yang_pcb_t *
993  yang_new_pcb (void);
994 
995 
1001 extern void
1002  yang_free_pcb (yang_pcb_t *pcb);
1003 
1004 
1011 extern yang_stmt_t *
1012  yang_new_typ_stmt (typ_template_t *typ);
1013 
1014 
1021 extern yang_stmt_t *
1022  yang_new_grp_stmt (grp_template_t *grp);
1023 
1024 
1025 
1032 extern yang_stmt_t *
1033  yang_new_ext_stmt (ext_template_t *ext);
1034 
1035 
1042 extern yang_stmt_t *
1043  yang_new_obj_stmt (obj_template_t *obj);
1044 
1045 
1052 extern yang_stmt_t *
1053  yang_new_id_stmt (ncx_identity_t *identity);
1054 
1055 
1062 extern yang_stmt_t *
1063  yang_new_feature_stmt (ncx_feature_t *feature);
1064 
1065 
1072 extern yang_stmt_t *
1073  yang_new_deviation_stmt (obj_deviation_t *deviation);
1074 
1075 
1081 extern void
1082  yang_free_stmt (yang_stmt_t *stmt);
1083 
1084 
1090 extern void
1091  yang_clean_stmtQ (dlq_hdr_t *que);
1092 
1093 
1112 extern status_t
1113  yang_validate_date_string (tk_chain_t *tkc,
1114  ncx_module_t *mod,
1115  ncx_error_t *tkerr,
1116  const xmlChar *datestr);
1117 
1118 
1126 extern void
1127  yang_skip_statement (tk_chain_t *tkc,
1128  ncx_module_t *mod);
1129 
1130 
1137 extern boolean
1138  yang_top_keyword (const xmlChar *keyword);
1139 
1140 
1151 extern yang_import_ptr_t *
1152  yang_new_import_ptr (const xmlChar *modname,
1153  const xmlChar *modprefix,
1154  const xmlChar *revision,
1155  const xmlChar *descr,
1156  const xmlChar *ref);
1157 
1158 
1164 extern void
1165  yang_free_import_ptr (yang_import_ptr_t *impptr);
1166 
1167 
1173 extern void
1174  yang_clean_import_ptrQ (dlq_hdr_t *que);
1175 
1176 
1184 extern yang_import_ptr_t *
1185  yang_find_import_ptr (dlq_hdr_t *que,
1186  const xmlChar *name);
1187 
1188 
1201 extern int32
1202  yang_compare_revision_dates (const xmlChar *revstring1,
1203  const xmlChar *revstring2);
1204 
1205 
1216 extern xmlChar *
1217  yang_make_filename (const xmlChar *modname,
1218  const xmlChar *revision,
1219  boolean isyang);
1220 
1221 
1234 extern status_t
1235  yang_copy_filename (const xmlChar *modname,
1236  const xmlChar *revision,
1237  xmlChar *buffer,
1238  uint32 bufflen,
1239  boolean isyang);
1240 
1241 
1252 extern boolean
1253  yang_split_filename (const xmlChar *filename,
1254  uint32 *modnamelen);
1255 
1256 
1264 extern boolean
1265  yang_fileext_is_yang (const xmlChar *filename);
1266 
1267 
1275 extern boolean
1276  yang_fileext_is_yin (const xmlChar *filename);
1277 
1278 
1286 extern boolean
1287  yang_fileext_is_xml (const xmlChar *filename);
1288 
1289 
1294 extern void
1295  yang_final_memcheck (void);
1296 
1297 
1304 extern void
1305  yang_set_in_yangdata (yang_pcb_t *pcb, boolean val);
1306 
1307 
1314 extern boolean
1315  yang_is_in_yangdata (const yang_pcb_t *pcb);
1316 
1317 
1330 extern status_t
1331  yang_extract_filespec_info (const char *filespec,
1332  xmlChar **modname,
1333  xmlChar **revision,
1334  boolean *isyang);
1335 
1336 
1343 extern void
1344  yang_clean_pcb_top (yang_pcb_t *pcb);
1345 
1346 
1351 #ifdef __cplusplus
1352 } /* end extern 'C' */
1353 #endif
1354 
1355 #endif /* _H_yang */
yang_consume_pid
status_t yang_consume_pid(tk_chain_t *tkc, ncx_module_t *mod, xmlChar **prefixstr, xmlChar **str, boolean *dupflag, dlq_hdr_t *appinfoQ)
consume one [prefix:]name clause
Definition: yang.c:967
yang_free_import_ptr
void yang_free_import_ptr(yang_import_ptr_t *impptr)
Delete a YANG import pointer node.
Definition: yang.c:3593
TK_CUR
#define TK_CUR(T)
return the current token
Definition: tk.h:122
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
TK_TT_TSTRING
@ TK_TT_TSTRING
token string
Definition: tk.h:319
tk_next_typ
tk_type_t tk_next_typ(tk_chain_t *tkc)
Get the token type of the next token.
Definition: tk.c:3349
TK_TT_DNUM
@ TK_TT_DNUM
decimal number
Definition: tk.h:331
yang_set_in_yangdata
void yang_set_in_yangdata(yang_pcb_t *pcb, boolean val)
Set the in_yangdata mode.
Definition: yang.c:4061
ncx_find_identity
ncx_identity_t * ncx_find_identity(ncx_module_t *mod, const xmlChar *name, boolean useall)
Find a ncx_identity_t struct in the module and perhaps any of its submodules.
Definition: ncx.c:6082
ncx_feature.h
NCX Module Library YANG Feature Utility Functions.
ncx_consume_appinfo
status_t ncx_consume_appinfo(tk_chain_t *tkc, ncx_module_t *mod, dlq_hdr_t *appinfoQ)
Check if an appinfo clause is present.
Definition: ncx_appinfo.c:761
NCX_BT_INT32
@ NCX_BT_INT32
int32
Definition: ncxtypes.h:209
ncx_appinfo.h
NCX Module Library Extension (Application Info) Utility Functions.
xpath_free_pcb
void xpath_free_pcb(xpath_pcb_t *pcb)
Free a malloced XPath parser control block.
Definition: xpath.c:2963
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_pcb_t_::annotation
boolean annotation
TRUE if deviation really annotation.
Definition: yang.h:213
failed_ptr_t_::modname
xmlChar * modname
module name
Definition: yang.h:176
TK_BKUP
#define TK_BKUP(T)
back-up the current token pointer
Definition: tk.h:112
tk_check_save_origstr
status_t tk_check_save_origstr(tk_chain_t *tkc, tk_token_t *tk, const void *field)
Check the docmode and the specified token; Save a tk_origptr_t if needed with the field address.
Definition: tk.c:4368
YANG_FILE_SEPCHAR
#define YANG_FILE_SEPCHAR
YANG file name separator char.
Definition: yangconst.h:100
yang_import_ptr_t_::modname
xmlChar * modname
import module name
Definition: yang.h:163
yang_find_imp_extension
status_t yang_find_imp_extension(yang_pcb_t *pcb, tk_chain_t *tkc, ncx_module_t *mod, const xmlChar *prefix, const xmlChar *name, ncx_error_t *tkerr, ext_template_t **ext)
Find the specified imported extension.
Definition: yang.c:2248
xpath1_parse_expr
status_t xpath1_parse_expr(tk_chain_t *tkc, ncx_module_t *mod, xpath_pcb_t *pcb, xpath_source_t source)
Parse the XPATH 1.0 expression string.
Definition: xpath1.c:4816
yang_pcb_t_::savemodQ
dlq_hdr_t * savemodQ
ptr to Q of ncx_module_t: parse mode
Definition: yang.h:235
yang_stmt_t_::s_::identity
ncx_identity_t * identity
identity-stmt
Definition: yang.h:139
tstamp.h
Timestamp utilities.
tk_get_token_name
const char * tk_get_token_name(tk_type_t ttyp)
Get the symbolic token name.
Definition: tk.c:3280
yang_consume_int32
status_t yang_consume_int32(tk_chain_t *tkc, ncx_module_t *mod, int32 *num, boolean *dupflag, dlq_hdr_t *appinfoQ)
consume one int32 clause Parse the int32 based parameter statement
Definition: yang.c:1848
xml_strdup
xmlChar * xml_strdup(const xmlChar *copyFrom)
String duplicate for xmlChar.
Definition: xml_util.c:1553
ncx_warning_enabled
boolean ncx_warning_enabled(status_t res)
Check if a specific status_t code is enabled.
Definition: ncx.c:9394
ncx_decode_num
status_t ncx_decode_num(const xmlChar *numstr, ncx_btype_t btyp, ncx_num_t *retnum)
Handle some sort of number string.
Definition: ncx_num.c:1288
yang_pcb_t_::swaptop
boolean swaptop
T: keepmode found top already so swap.
Definition: yang.h:229
ERR_NCX_WRONG_TKVAL
@ ERR_NCX_WRONG_TKVAL
246
Definition: status_enum.h:285
yang_pcb_t_::savetkc
boolean savetkc
TRUE if tkc should be kept in tkc.
Definition: yang.h:219
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
ERR_NCX_TYPDEF_NOT_USED
@ ERR_NCX_TYPDEF_NOT_USED
1013
Definition: status_enum.h:502
YANG_SUFFIX
#define YANG_SUFFIX
YANG suffix.
Definition: yangconst.h:73
yang_consume_when
status_t yang_consume_when(tk_chain_t *tkc, ncx_module_t *mod, obj_template_t *obj, boolean *whenflag)
consume one when-stmt into obj->when
Definition: yang.c:1572
ERR_NCX_DEF_NOT_FOUND
@ ERR_NCX_DEF_NOT_FOUND
250
Definition: status_enum.h:289
yang_pcb_t_::searchmode
boolean searchmode
TRUE if just getting ns & version.
Definition: yang.h:214
failed_ptr_t_::revision
xmlChar * revision
module revision
Definition: yang.h:177
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.
yang_consume_keyword
status_t yang_consume_keyword(tk_chain_t *tkc, ncx_module_t *mod, xmlChar **prefix, xmlChar **field)
consume 1 YANG keyword or vendor extension keyword
Definition: yang.c:337
tk_next_val
const xmlChar * tk_next_val(tk_chain_t *tkc)
Get the token type of the next token.
Definition: tk.c:3464
xml_util.h
XML Utilities.
yang_import_ptr_t_::modprefix
xmlChar * modprefix
import module prefix
Definition: yang.h:164
yang_import_ptr_t_::ref
xmlChar * ref
import reference
Definition: yang.h:167
failed_ptr_t_::qhdr
dlq_hdr_t qhdr
queue header
Definition: yang.h:175
tk_free_chain
void tk_free_chain(tk_chain_t *tkc)
Cleanup and deallocate a tk_chain_t.
Definition: tk.c:3205
xpath_new_pcb
xpath_pcb_t * xpath_new_pcb(const xmlChar *xpathstr, xpath_getvar_fn_t getvar_fn)
malloc a new XPath parser control block
Definition: xpath.c:2739
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
TK_CUR_LNUM
#define TK_CUR_LNUM(T)
return the current line number
Definition: tk.h:179
ncx_free_module
void ncx_free_module(ncx_module_t *mod)
Free a YANG module.
Definition: ncx.c:3431
tk.h
NCX Syntax Token Handler.
yang_top_keyword
boolean yang_top_keyword(const xmlChar *keyword)
Check if the string is a top-level YANG keyword.
Definition: yang.c:3479
yang_free_stmt
void yang_free_stmt(yang_stmt_t *stmt)
Delete a YANG statement node.
Definition: yang.c:3199
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.
yang_pcb_t_::topadded
boolean topadded
TRUE if top in registry; F: need free.
Definition: yang.h:218
yang_parsetype_t_
yang_parsetype_t_
YANG parser mode entry types.
Definition: yang.h:104
ncx_num.h
NCX Module Library Number Utility Functions.
yang_is_in_yangdata
boolean yang_is_in_yangdata(const yang_pcb_t *pcb)
Get the in_yangdata mode.
Definition: yang.c:4074
yang_consume_strclause
status_t yang_consume_strclause(tk_chain_t *tkc, ncx_module_t *mod, xmlChar **str, boolean *dupflag, dlq_hdr_t *appinfoQ)
consume one normative string clause
Definition: yang.c:1047
NCX_NT_TYP
@ NCX_NT_TYP
typ_template_t
Definition: ncxtypes.h:274
yang_free_pcb
void yang_free_pcb(yang_pcb_t *pcb)
Delete a YANG parser control block.
Definition: yang.c:2911
yang_new_ext_stmt
yang_stmt_t * yang_new_ext_stmt(ext_template_t *ext)
Create a new YANG stmt node for an extension.
Definition: yang.c:3026
yang_stmt_t_::qhdr
dlq_hdr_t qhdr
queue header
Definition: yang.h:128
ERR_LAST_SYS_ERR
@ ERR_LAST_SYS_ERR
124 – not really used
Definition: status_enum.h:236
yang_clean_stmtQ
void yang_clean_stmtQ(dlq_hdr_t *que)
Delete a Q of YANG statement node.
Definition: yang.c:3223
yang_skip_statement
void yang_skip_statement(tk_chain_t *tkc, ncx_module_t *mod)
Skip past the current invalid statement, starting at an invalid keyword.
Definition: yang.c:3421
yang_pcb_t_::in_grouping
boolean in_grouping
T: resolving datadefs in a grouping.
Definition: yang.h:226
yang_new_feature_stmt
yang_stmt_t * yang_new_feature_stmt(ncx_feature_t *feature)
Create a new YANG stmt node for a feature definition.
Definition: yang.c:3131
YANG_PT_NONE
@ YANG_PT_NONE
not set
Definition: yang.h:105
yang_pcb_t_::stmtmode
boolean stmtmode
save top-level stmt order
Definition: yang.h:210
yang_pcb_t_::trackmode
boolean trackmode
TRUE if yangdump to track re-parse.
Definition: yang.h:221
ncxconst.h
Contains NCX constants.
ncxmod.h
NCX Module Load Manager.
XP_SRC_YANG
@ XP_SRC_YANG
YANG must or when.
Definition: xpath.h:376
YIN_SUFFIX
#define YIN_SUFFIX
YIN file suffix.
Definition: yangconst.h:85
TK_TT_SQSTRING
@ TK_TT_SQSTRING
single quoted string
Definition: tk.h:323
yang_new_deviation_stmt
yang_stmt_t * yang_new_deviation_stmt(obj_deviation_t *deviation)
Create a new YANG stmt node for a deviation definition.
Definition: yang.c:3166
yang_pcb_t_::retmod
struct ncx_module_t_ * retmod
nested [sub]mod being returned
Definition: yang.h:206
yang_pcb_t_::retmod_malloced
boolean retmod_malloced
T: if retmod live ncx_new_module.
Definition: yang.h:228
ERR_NCX_IMPORT_NOT_USED
@ ERR_NCX_IMPORT_NOT_USED
1015
Definition: status_enum.h:504
TK_ADV
#define TK_ADV(T)
advance the current token pointer
Definition: tk.h:107
yang_find_import_ptr
yang_import_ptr_t * yang_find_import_ptr(dlq_hdr_t *que, const xmlChar *name)
Find a YANG import pointer node in the specified Q.
Definition: yang.c:3665
ncx_print_errormsg
void ncx_print_errormsg(tk_chain_t *tkc, ncx_module_t *mod, status_t res)
Print an parse error message to STDOUT.
Definition: ncx.c:7048
yang_consume_string
status_t yang_consume_string(tk_chain_t *tkc, ncx_module_t *mod, xmlChar **field)
consume 1 string token
Definition: yang.c:227
yang_pcb_t_::impchainQ
dlq_hdr_t impchainQ
2 Qs of yang_node_t
Definition: yang.h:239
TK_CUR_VAL
#define TK_CUR_VAL(T)
return the current token value
Definition: tk.h:128
TK_CUR_LPOS
#define TK_CUR_LPOS(T)
return the current line position
Definition: tk.h:182
NCX_NF_DEC
@ NCX_NF_DEC
YANG deciaml format.
Definition: ncxtypes.h:335
failed_ptr_t_::status
status_t status
reason for failure
Definition: yang.h:178
ncx_module_t_::descr
xmlChar * descr
description-stmt (not saved on server)
Definition: ncxtypes.h:918
yang_node_t_
YANG node entry to track if a module has been used already.
Definition: yang.h:147
yang_stmt_t_::s_::obj
obj_template_t * obj
data-def-stmt
Definition: yang.h:138
failed_ptr_t_
pointer to failed modules to track all of them Prevents loading a broken module multiple times
Definition: yang.h:174
ERR_NCX_ENTRY_EXISTS
@ ERR_NCX_ENTRY_EXISTS
223
Definition: status_enum.h:262
yang_pcb_t_::keepmode
boolean keepmode
TRUE to keep new mod even if loaded.
Definition: yang.h:216
ncx_warning_elevated
boolean ncx_warning_elevated(status_t res)
Check if a specific status_t code is elevated.
Definition: ncx.c:9439
ncx_locate_modqual_import
void * ncx_locate_modqual_import(yang_pcb_t *pcb, ncx_import_t *imp, const xmlChar *defname, ncx_node_t *deftyp)
Search the specific module for the specified definition name.
Definition: ncx.c:5748
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.
ERR_NCX_GRPDEF_NOT_USED
@ ERR_NCX_GRPDEF_NOT_USED
1014
Definition: status_enum.h:503
xpath1.h
XPath 1.0 expression support.
def_reg.h
Definition Registry module.
TK_CUR_ID
#define TK_CUR_ID(T)
return TRUE if the current token type is an identifier
Definition: tk.h:171
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
xpath.h
Schema and data model Xpath search support.
TK_TT_RBRACE
@ TK_TT_RBRACE
right brace '}'
Definition: tk.h:287
ERR_NCX_WRONG_TKTYPE
@ ERR_NCX_WRONG_TKTYPE
245
Definition: status_enum.h:284
xml_strndup
xmlChar * xml_strndup(const xmlChar *copyFrom, uint32 maxlen)
String duplicate for max N xmlChars.
Definition: xml_util.c:1663
yang_clean_nodeQ
void yang_clean_nodeQ(dlq_hdr_t *que)
Delete all the node entries in a YANG parser node Q.
Definition: yang.c:2745
ncx_consume_token
status_t ncx_consume_token(tk_chain_t *tkc, ncx_module_t *mod, tk_type_t ttyp)
Consume the next token which should be a 1 or 2 char token without any value.
Definition: ncx.c:7901
TK_CUR_MOD
#define TK_CUR_MOD(T)
return the current token module qualifier value
Definition: tk.h:134
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.
yang_node_t_::failed
xmlChar * failed
saved name for failed entries
Definition: yang.h:153
yang_new_obj_stmt
yang_stmt_t * yang_new_obj_stmt(obj_template_t *obj)
Create a new YANG stmt node for an object.
Definition: yang.c:3061
yang_make_filename
xmlChar * yang_make_filename(const xmlChar *modname, const xmlChar *revision, boolean isyang)
Malloc and construct a YANG filename.
Definition: yang.c:3737
LOGDEBUG2
#define LOGDEBUG2
Check if at least log-level=debug2.
Definition: log.h:292
yang_stmt_t_::s_::feature
ncx_feature_t * feature
feature-stmt
Definition: yang.h:140
dlq_createSQue
void dlq_createSQue(dlq_hdrT *queAddr)
create a static queue header
Definition: dlq.c:177
TK_CUR_LEN
#define TK_CUR_LEN(T)
return the current token value length
Definition: tk.h:131
log_warn
void void void log_warn(const char *fstr,...) __attribute__((format(printf
Generate a new LOG_DEBUG_WARN log entry.
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
LOGWARN
#define LOGWARN
Check if at least log-level=warn.
Definition: log.h:274
yang_pcb_t_::parentparm
struct ncx_module_t_ * parentparm
parent passed for submodule
Definition: yang.h:207
yang_stmt_t_::s_
these node pointers are back-pointers and not malloced here
Definition: yang.h:134
yang_consume_boolean
status_t yang_consume_boolean(tk_chain_t *tkc, ncx_module_t *mod, boolean *boolval, boolean *dupflag, dlq_hdr_t *appinfoQ)
consume one boolean clause Parse the boolean parameter based statement
Definition: yang.c:1756
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
ERR_NCX_DATE_PAST
@ ERR_NCX_DATE_PAST
1020
Definition: status_enum.h:509
yang_find_imp_identity
status_t yang_find_imp_identity(yang_pcb_t *pcb, tk_chain_t *tkc, ncx_module_t *mod, const xmlChar *prefix, const xmlChar *name, ncx_error_t *tkerr, ncx_identity_t **identity)
Find the specified imported identity.
Definition: yang.c:2415
yang_stmt_t_::s_::typ
typ_template_t * typ
typdef-stmt
Definition: yang.h:135
ERR_INTERNAL_MEM
@ ERR_INTERNAL_MEM
003
Definition: status_enum.h:193
ncx_check_warn_idlen
void ncx_check_warn_idlen(tk_chain_t *tkc, ncx_module_t *mod, const xmlChar *id)
Check if the identifier length is greater than the specified amount.
Definition: ncx.c:9198
get_error_string
const char * get_error_string(status_t res)
Get the error message for a specific internal error.
Definition: status.c:239
ERR_INTERNAL_PTR
@ ERR_INTERNAL_PTR
002
Definition: status_enum.h:192
NCX_NT_GRP
@ NCX_NT_GRP
grp_template_t
Definition: ncxtypes.h:275
yang.h
YANG Module parser utilities.
yang_final_memcheck
void yang_final_memcheck(void)
Check the node malloc and free counts.
Definition: yang.c:4042
ncx_module_t_::prefix
xmlChar * prefix
module prefix
Definition: ncxtypes.h:927
yang_pcb_t_::freetop
boolean freetop
T: keeptop=T and wasadd=F and top=live mem.
Definition: yang.h:230
typ.h
Parameter Type Handler.
TK_CUR_STR
#define TK_CUR_STR(T)
return TRUE if the current token type is a string
Definition: tk.h:140
yang_import_ptr_t_::descr
xmlChar * descr
import module revision date
Definition: yang.h:166
yang_clean_import_ptrQ
void yang_clean_import_ptrQ(dlq_hdr_t *que)
Delete all the node entries in a YANG import pointer node Q.
Definition: yang.c:3633
yangconst.h
Contains YANG constants separated to prevent H file include loops.
ncx_find_feature
ncx_feature_t * ncx_find_feature(ncx_module_t *mod, const xmlChar *name)
Find a ncx_feature_t struct in the module and perhaps any of its submodules.
Definition: ncx_feature.c:855
yang_stmt_t_::s_::deviation
obj_deviation_t * deviation
deviation-stmt
Definition: yang.h:141
TK_CUR_MODLEN
#define TK_CUR_MODLEN(T)
return the current token module qualifier value length
Definition: tk.h:137
yang_new_import_ptr
yang_import_ptr_t * yang_new_import_ptr(const xmlChar *modname, const xmlChar *modprefix, const xmlChar *revision, const xmlChar *descr, const xmlChar *ref)
Create a new YANG import pointer node.
Definition: yang.c:3524
yang_consume_descr
status_t yang_consume_descr(tk_chain_t *tkc, ncx_module_t *mod, xmlChar **str, boolean *dupflag, dlq_hdr_t *appinfoQ)
consume one descriptive string clause
Definition: yang.c:888
yang_pcb_t_::in_yangdata
boolean in_yangdata
T: resolving datadefs in rc:yang-data.
Definition: yang.h:227
ncx_get_status_enum
ncx_status_t ncx_get_status_enum(const xmlChar *str)
Get the enum for the string name of a ncx_status_t enum.
Definition: ncx.c:6925
ERR_NCX_EOF
@ ERR_NCX_EOF
244
Definition: status_enum.h:283
dlq_nextEntry
#define dlq_nextEntry(nodeP)
get the next queue entry after the current entry
Definition: dlq.h:265
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
yang_find_imp_typedef
status_t yang_find_imp_typedef(yang_pcb_t *pcb, tk_chain_t *tkc, ncx_module_t *mod, const xmlChar *prefix, const xmlChar *name, ncx_error_t *tkerr, typ_template_t **typ)
Find the specified imported typedef.
Definition: yang.c:2090
yang_pcb_t_::savedevQ
dlq_hdr_t * savedevQ
ptr to Q of ncx_save_deviations_t
Definition: yang.h:234
yang_consume_modifier
status_t yang_consume_modifier(tk_chain_t *tkc, ncx_module_t *mod, boolean *dupflag, dlq_hdr_t *appinfoQ)
consume one modifier-stmt
Definition: yang.c:2013
yang_fileext_is_yin
boolean yang_fileext_is_yin(const xmlChar *filename)
Check if the filespec ends with the .yin extension.
Definition: yang.c:3973
TK_TT_SEMICOL
@ TK_TT_SEMICOL
semi-colon ';'
Definition: tk.h:288
yang_consume_pid_string
status_t yang_consume_pid_string(tk_chain_t *tkc, ncx_module_t *mod, xmlChar **prefix, xmlChar **field)
consume an identifier-ref-str token
Definition: yang.c:581
ncx_set_error
void ncx_set_error(ncx_error_t *tkerr, ncx_module_t *mod, uint32 linenum, uint32 linepos)
Set the fields in an ncx_error_t struct.
Definition: ncx.c:9746
tk_is_wsp_string
boolean tk_is_wsp_string(const tk_token_t *tk)
Check if the current token is a string with whitespace in it.
Definition: tk.c:3582
yang_consume_max_elements
status_t yang_consume_max_elements(tk_chain_t *tkc, ncx_module_t *mod, uint32 *maxelems, boolean *dupflag, dlq_hdr_t *appinfoQ)
consume one max-elements clause
Definition: yang.c:1301
ext_find_extension
ext_template_t * ext_find_extension(ncx_module_t *mod, const xmlChar *name)
Search a module for an ext_template_t structs with a given name Search mod to find extension name.
Definition: ext.c:232
yang_node_t_::revision
const xmlChar * revision
revision date in imp/inc/failed
Definition: yang.h:150
NCX_MAX_NUMLEN
#define NCX_MAX_NUMLEN
max number len to use for static buffer allocation only
Definition: ncxconst.h:136
ERR_NCX_PREFIX_NOT_FOUND
@ ERR_NCX_PREFIX_NOT_FOUND
331
Definition: status_enum.h:374
ncx_module_t_
representation of one module or submodule during and after parsing
Definition: ncxtypes.h:900
yang_find_imp_grouping
status_t yang_find_imp_grouping(yang_pcb_t *pcb, tk_chain_t *tkc, ncx_module_t *mod, const xmlChar *prefix, const xmlChar *name, ncx_error_t *tkerr, grp_template_t **grp)
Find the specified imported grouping.
Definition: yang.c:2169
yang_stmt_t_
YANG statement node to track top-level statement order for doc output.
Definition: yang.h:126
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
yang_pcb_t_::reparse
boolean reparse
TRUE if trackmode + mod already parsed.
Definition: yang.h:222
ncx_module_t_::ref
xmlChar * ref
reference-stmt (not saved on server)
Definition: ncxtypes.h:921
yang_consume_error_stmts
status_t yang_consume_error_stmts(tk_chain_t *tkc, ncx_module_t *mod, ncx_errinfo_t *errinfo, dlq_hdr_t *appinfoQ, boolean allow_modifier, boolean *gotinverted)
consume the range.
Definition: yang.c:752
ncx_module_t_::appinfoQ
dlq_hdr_t appinfoQ
Q of ncx_appinfo_t.
Definition: ncxtypes.h:963
yang_pcb_t_::tkc
tk_chain_t * tkc
live or NULL parse chain
Definition: yang.h:236
yang_pcb_t_::allimpQ
dlq_hdr_t allimpQ
Q of yang_import_ptr_t.
Definition: yang.h:231
yang_pcb_t_::parsemode
boolean parsemode
TRUE if full parse but no reg-load.
Definition: yang.h:215
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
ncx_convert_tkcnum
status_t ncx_convert_tkcnum(tk_chain_t *tkc, ncx_btype_t btyp, ncx_num_t *val)
Convert the current token in a token chain to a ncx_num_t struct.
Definition: ncx_num.c:2640
ncx_module_t_::name
xmlChar * name
module name
Definition: ncxtypes.h:902
yang_import_ptr_t_::qhdr
dlq_hdr_t qhdr
queue header
Definition: yang.h:162
xml_strcmp
int xml_strcmp(const xmlChar *s1, const xmlChar *s2)
String compare for xmlChar.
Definition: xml_util.c:1746
TK_TT_STRING
@ TK_TT_STRING
unquoted string
Definition: tk.h:316
yang_stmt_t_::stmttype
yang_stmttype_t stmttype
statement type
Definition: yang.h:131
TK_TT_LBRACE
@ TK_TT_LBRACE
left brace '{'
Definition: tk.h:286
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
yang_consume_ordered_by
status_t yang_consume_ordered_by(tk_chain_t *tkc, ncx_module_t *mod, boolean *ordsys, boolean *dupflag, dlq_hdr_t *appinfoQ)
consume one ordered-by clause
Definition: yang.c:1206
yang_stmt_t_::s_::ext
ext_template_t * ext
extension-stmt
Definition: yang.h:137
LOGDEBUG4
#define LOGDEBUG4
Check if at least log-level=debug4.
Definition: log.h:302
log.h
NCX System Logging Manager.
yang_find_imp_feature
status_t yang_find_imp_feature(yang_pcb_t *pcb, tk_chain_t *tkc, ncx_module_t *mod, const xmlChar *prefix, const xmlChar *name, ncx_error_t *tkerr, ncx_feature_t **feature)
Find the specified imported feature.
Definition: yang.c:2330
yang_pcb_t_::revision
const xmlChar * revision
back-ptr to rev to match
Definition: yang.h:208
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.
yang_check_obj_used
void yang_check_obj_used(tk_chain_t *tkc, ncx_module_t *mod, dlq_hdr_t *typeQ, dlq_hdr_t *grpQ)
generate warnings if local typedefs/groupings not used
Definition: yang.c:2518
yang_pcb_t_::deviationmode
boolean deviationmode
TRUE if keeping deviations only.
Definition: yang.h:212
yang_import_ptr_t_
YANG import pointer node to track all imports used.
Definition: yang.h:161
yang_new_id_stmt
yang_stmt_t * yang_new_id_stmt(ncx_identity_t *identity)
Create a new YANG stmt node for an identity.
Definition: yang.c:3096
yang_node_t_::qhdr
dlq_hdr_t qhdr
queue header
Definition: yang.h:148
yang_consume_id_string
status_t yang_consume_id_string(tk_chain_t *tkc, ncx_module_t *mod, xmlChar **field)
consume an identifier-str token
Definition: yang.c:510
yang_check_imports_used
void yang_check_imports_used(tk_chain_t *tkc, ncx_module_t *mod)
generate warnings if imports not used
Definition: yang.c:2587
log_error_append
void void log_error_append(const char *fstr,...) __attribute__((format(printf
Append to a LOG_DEBUG_ERROR log entry.
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
yang_node_t_::submod
ncx_module_t * submod
submod for allincQ
Definition: yang.h:152
yang_pcb_t_::topfailedQ
dlq_hdr_t * topfailedQ
ptr to Q of failed_ptr_t
Definition: yang.h:233
NCX_BT_UINT32
@ NCX_BT_UINT32
uint32
Definition: ncxtypes.h:213
dlq_deque
void * dlq_deque(dlq_hdrT *listP)
remove the first queue node from the queue list
Definition: dlq.c:286
ncx_module_t_::status
status_t status
module parse result
Definition: ncxtypes.h:949
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
yang_pcb_t_::failedQ
dlq_hdr_t failedQ
load mod or submod failed
Definition: yang.h:240
yang_node_t_::name
const xmlChar * name
module name in imp/inc/failed
Definition: yang.h:149
dlq_empty
#define dlq_empty(listP)
check if queue list is empty
Definition: dlq.h:367
yang_stmt_t_::s_::grp
grp_template_t * grp
grouping-stmt
Definition: yang.h:136
xml_strcpy
uint32 xml_strcpy(xmlChar *copyTo, const xmlChar *copyFrom)
String copy for xmlChar.
Definition: xml_util.c:1486
yang_consume_semiapp
status_t yang_consume_semiapp(tk_chain_t *tkc, ncx_module_t *mod, dlq_hdr_t *appinfoQ)
consume a stmtsep clause
Definition: yang.c:145
NCX_STATUS_NONE
@ NCX_STATUS_NONE
not set
Definition: ncxtypes.h:419
yang_pcb_t_::topfound
boolean topfound
TRUE if top found, not added.
Definition: yang.h:217
dlq_firstEntry
#define dlq_firstEntry(listP)
get the first entry in the queue list
Definition: dlq.h:337
ncx_mod_exp_err
void ncx_mod_exp_err(tk_chain_t *tkc, ncx_module_t *mod, status_t result, const char *expstr)
Print an error for wrong token, expected a different token.
Definition: ncx.c:7220
yang_consume_nowsp_string
status_t yang_consume_nowsp_string(tk_chain_t *tkc, ncx_module_t *mod, xmlChar **field)
consume 1 string without any whitespace
Definition: yang.c:433
ncx_save_descr
boolean ncx_save_descr(void)
Get the value of the save description strings variable.
Definition: ncx.c:7032
yang_pcb_t_::with_submods
boolean with_submods
include submodules
Definition: yang.h:209
ncx.h
YANG module utility functions.
yang_node_t_::mod
ncx_module_t * mod
back-ptr to module w/ imp/inc
Definition: yang.h:151
yang_pcb_t_::autoloadmode
boolean autoloadmode
TRUE if yangcli autoload.
Definition: yang.h:225
obj.h
Data Object Support.
ncx_module_t_::typeQ
dlq_hdr_t typeQ
Q of typ_template_t.
Definition: ncxtypes.h:956
TK_CUR_TYP
#define TK_CUR_TYP(T)
return the current token type
Definition: tk.h:125
grp.h
YANG Grouping Statement Handler.
yang_new_grp_stmt
yang_stmt_t * yang_new_grp_stmt(grp_template_t *grp)
Create a new YANG stmt node for a grouping.
Definition: yang.c:2991
yang_pcb_t_
YANG parser control block.
Definition: yang.h:204
TK_TT_QSTRING
@ TK_TT_QSTRING
double quoted string
Definition: tk.h:322
CHK_EXIT
#define CHK_EXIT(res, retres)
used in parser routines to decide if processing can continue will exit the function if critical error...
Definition: yangconst.h:221
yang_pcb_t_::diffmode
boolean diffmode
TRUE = yangdiff old ver.
Definition: yang.h:211
yang_split_filename
boolean yang_split_filename(const xmlChar *filename, uint32 *modnamelen)
Split a module parameter into its filename components.
Definition: yang.c:3863
yang_consume_uint32
status_t yang_consume_uint32(tk_chain_t *tkc, ncx_module_t *mod, uint32 *num, boolean *dupflag, dlq_hdr_t *appinfoQ)
consume one uint32 clause
Definition: yang.c:1931
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_pcb_t_::set_supported
boolean set_supported
TRUE: load, FALSE: import only.
Definition: yang.h:223
yang_new_pcb
yang_pcb_t * yang_new_pcb(void)
Create a new YANG parser control block.
Definition: yang.c:2876
ncx_find_pre_import
ncx_import_t * ncx_find_pre_import(const ncx_module_t *mod, const xmlChar *prefix)
Search the importQ for a specified prefix value.
Definition: ncx.c:5619
TK_TYP_STR
#define TK_TYP_STR(T)
return TRUE if the specified token type is a string
Definition: tk.h:144
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
yang_consume_status
status_t yang_consume_status(tk_chain_t *tkc, ncx_module_t *mod, ncx_status_t *status, boolean *dupflag, dlq_hdr_t *appinfoQ)
consume one status clause
Definition: yang.c:1115
TK_CUR_NUM
#define TK_CUR_NUM(T)
return TRUE if the current token type is a number
Definition: tk.h:151
yang_pcb_t_::top
struct ncx_module_t_ * top
top-level file
Definition: yang.h:205
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
yang_dump_nodeQ
void yang_dump_nodeQ(dlq_hdr_t *que, const char *name)
log_debug output for contents of the specified nodeQ
Definition: yang.c:2820
NEED_EXIT
#define NEED_EXIT(res)
used in parser routines to decide if processing can continue does not return, just evaluates to TRUE ...
Definition: yangconst.h:234
ERR_NCX_DATE_FUTURE
@ ERR_NCX_DATE_FUTURE
1021
Definition: status_enum.h:510
yang_consume_must
status_t yang_consume_must(tk_chain_t *tkc, ncx_module_t *mod, dlq_hdr_t *mustQ, dlq_hdr_t *appinfoQ, boolean do_parse)
consume one must-stmt into mustQ
Definition: yang.c:1375
tstamp_date
void tstamp_date(xmlChar *buff)
Set the current date in an XML dateTime string format.
Definition: tstamp.c:218
yang_node_t_::tkerr
ncx_error_t tkerr
file and line infor for compiler
Definition: yang.h:156
yang_extract_filespec_info
status_t yang_extract_filespec_info(const char *filespec, xmlChar **modname, xmlChar **revision, boolean *isyang)
Split a filespec into its filename components.
Definition: yang.c:4099
yang_new_typ_stmt
yang_stmt_t * yang_new_typ_stmt(typ_template_t *typ)
Create a new YANG stmt node for a typedef.
Definition: yang.c:2956
TK_TT_MSTRING
@ TK_TT_MSTRING
module-qualified token string
Definition: tk.h:320
yang_fileext_is_xml
boolean yang_fileext_is_xml(const xmlChar *filename)
Check if the filespec ends with the .xml extension.
Definition: yang.c:4011
status.h
Global error messages for status code enumerations.
yang_validate_date_string
status_t yang_validate_date_string(tk_chain_t *tkc, ncx_module_t *mod, ncx_error_t *tkerr, const xmlChar *datestr)
Validate a YANG date string for a revision entry.
Definition: yang.c:3262
dlq.h
dlq provides general double-linked list and queue support:
ext.h
YANG Extension Handler.
yang_pcb_t_::docmode
boolean docmode
TRUE if saving strings in origtkQ.
Definition: yang.h:220
yang_node_t_::failedrev
xmlChar * failedrev
saved revision for failed entries
Definition: yang.h:154
yang_node_t_::res
status_t res
saved result for 'failed'
Definition: yang.h:155
LOGDEBUG3
#define LOGDEBUG3
Check if at least log-level=debug3.
Definition: log.h:297
yang_pcb_t_::res_dev
boolean res_dev
TRUE: currently resolving a deviation.
Definition: yang.h:224
ncx_consume_appinfo2
status_t ncx_consume_appinfo2(tk_chain_t *tkc, ncx_module_t *mod, dlq_hdr_t *appinfoQ)
Check if an appinfo clause is present Do not backup the current token The TK_TT_MSTRING token has not...
Definition: ncx_appinfo.c:842