yumapro  20.10-12
YumaPro SDK
yang_parse.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_parse
13 #define _H_yang_parse
14 
15 /* FILE: yang_parse.h
16 *********************************************************************
17 * *
18 * P U R P O S E *
19 * *
20 *********************************************************************/
21 
28 /*********************************************************************
29 * *
30 * C H A N G E H I S T O R Y *
31 * *
32 *********************************************************************
33 
34 date init comment
35 ----------------------------------------------------------------------
36 26-oct-07 abb Begun; start from ncx_parse.h
37 
38 */
39 
40 #include <xmlstring.h>
41 
42 #ifndef _H_status
43 #include "status.h"
44 #endif
45 
46 #ifdef __cplusplus
47 extern "C" {
48 #endif
49 
50 /********************************************************************
51 * *
52 * T Y P E S *
53 * *
54 *********************************************************************/
55 
56 
57 /********************************************************************
58 * *
59 * F U N C T I O N S *
60 * *
61 *********************************************************************/
62 
63 /* Group yangcomp-parse defined in yang.h */
64 
65 
106 extern status_t
107  yang_parse_from_filespec (const xmlChar *filespec,
108  yang_pcb_t *pcb,
109  yang_parsetype_t ptyp,
110  boolean isyang);
111 
112 
115 #ifdef __cplusplus
116 } /* end extern 'C' */
117 #endif
118 
119 #endif /* _H_yang_parse */
yang_parse_from_filespec
status_t yang_parse_from_filespec(const xmlChar *filespec, yang_pcb_t *pcb, yang_parsetype_t ptyp, boolean isyang)
Parse a file as a YANG module.
Definition: yang_parse.c:4582
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
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_TT_DNUM
@ TK_TT_DNUM
decimal number
Definition: tk.h:331
ncx_next_identity_base
ncx_identity_base_t * ncx_next_identity_base(ncx_identity_base_t *idbase)
Get the next base record for an identity.
Definition: ncx.c:6018
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
ERR_NCX_EXTRA_NODE
@ ERR_NCX_EXTRA_NODE
281
Definition: status_enum.h:324
ncx_feature.h
NCX Module Library YANG Feature Utility Functions.
ERR_NCX_DUP_IMPORT
@ ERR_NCX_DUP_IMPORT
1011
Definition: status_enum.h:500
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_appinfo.h
NCX Module Library Extension (Application Info) Utility Functions.
YANG_VERSION_STR
#define YANG_VERSION_STR
YANG 1.0 version.
Definition: yangconst.h:88
ncx_add_namespace_to_registry
status_t ncx_add_namespace_to_registry(ncx_module_t *mod, boolean tempmod)
Add the namespace and prefix to the registry or retrieve it if already set.
Definition: ncx.c:4391
ncx_save_deviation_module
void ncx_save_deviation_module(ncx_module_t *mod)
Save the deviations for the YANG module.
Definition: ncx.c:12778
yang_grp_resolve_groupings
status_t yang_grp_resolve_groupings(yang_pcb_t *pcb, tk_chain_t *tkc, ncx_module_t *mod, dlq_hdr_t *groupingQ, obj_template_t *parent)
Resolve grouping-stmts (first pass)
Definition: yang_grp.c:477
TK_BKUP
#define TK_BKUP(T)
back-up the current token pointer
Definition: tk.h:112
ncx_first_identity_base
ncx_identity_base_t * ncx_first_identity_base(ncx_identity_t *identity)
Get the first base record for an identity.
Definition: ncx.c:6003
ncx_module_t_::ocversion
xmlChar * ocversion
oc-ext:openconfig-version
Definition: ncxtypes.h:909
ncx_new_identity_base
ncx_identity_base_t * ncx_new_identity_base(void)
Get a new ncx_identity_base_t struct.
Definition: ncx.c:5964
ERR_NCX_IMPORT_ERRORS
@ ERR_NCX_IMPORT_ERRORS
332
Definition: status_enum.h:375
tstamp.h
Timestamp utilities.
tk_new_chain
tk_chain_t * tk_new_chain(void)
Allocatate a new token parse chain.
Definition: tk.c:2919
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_free_identity_base
void ncx_free_identity_base(ncx_identity_base_t *identity_base)
Free a malloced ncx_identity_base_t struct.
Definition: ncx.c:5984
ERR_NCX_WRONG_TKVAL
@ ERR_NCX_WRONG_TKVAL
246
Definition: status_enum.h:285
ncx_consume_name
status_t ncx_consume_name(tk_chain_t *tkc, ncx_module_t *mod, const xmlChar *name, xmlChar **namebuff, ncx_opt_t opt, tk_type_t ctyp)
Consume a TK_TSTRING that matches the 'name', then retrieve the next TK_TSTRING token into the namebu...
Definition: ncx.c:7801
ncx_valid_name2
boolean ncx_valid_name2(const xmlChar *str)
Check if an xmlChar string is a valid NCX name.
Definition: ncx.c:7637
ncxmod_test_filespec
boolean ncxmod_test_filespec(const xmlChar *filespec)
Check the exact filespec to see if it a file.
Definition: ncxmod.c:8275
yang_grp.h
YANG Module parser grouping statement support.
yang_feature_check_feature_loop
status_t yang_feature_check_feature_loop(tk_chain_t *tkc, ncx_module_t *mod, ncx_feature_t *feature, ncx_feature_t *startfeature)
Check for a feature loop.
Definition: yang_feature.c:1410
ncx_free_include
void ncx_free_include(ncx_include_t *inc)
Free a ncx_include_t.
Definition: ncx.c:5796
yang_typ_resolve_typedefs
status_t yang_typ_resolve_typedefs(yang_pcb_t *pcb, tk_chain_t *tkc, ncx_module_t *mod, dlq_hdr_t *typeQ, obj_template_t *parent)
Resovlve the typeQ of typedefs.
Definition: yang_typ.c:5305
ncx_resolve_appinfoQ
status_t ncx_resolve_appinfoQ(yang_pcb_t *pcb, tk_chain_t *tkc, ncx_module_t *mod, dlq_hdr_t *appinfoQ)
Validate all the appinfo clauses present in the specified Q.
Definition: ncx_appinfo.c:877
ncx_collapse_submod_defs
void ncx_collapse_submod_defs(ncx_module_t *mod)
Collapse submodule definitions into the main module.
Definition: ncx.c:11287
ncx_collapse_submodules_ok
boolean ncx_collapse_submodules_ok(void)
Check if it is OK to collapse submodule definitions into the main module.
Definition: ncx.c:11264
ERR_NCX_DEF_NOT_FOUND
@ ERR_NCX_DEF_NOT_FOUND
250
Definition: status_enum.h:289
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.
ERR_NCX_INCLUDE_LOOP
@ ERR_NCX_INCLUDE_LOOP
328
Definition: status_enum.h:371
yang_feature.h
YANG feature statement support.
ncx_get_modname
const xmlChar * ncx_get_modname(const ncx_module_t *mod)
Get the main module name.
Definition: ncx.c:4834
ERR_NCX_FILE_MOD_MISMATCH
@ ERR_NCX_FILE_MOD_MISMATCH
1049
Definition: status_enum.h:538
tk_clone_chain
tk_chain_t * tk_clone_chain(tk_chain_t *oldtkc)
Allocatate and a new token parse chain and fill it with the specified token chain contents.
Definition: tk.c:4068
ncxmod_load_imodule
status_t ncxmod_load_imodule(const xmlChar *modname, const xmlChar *revision, yang_pcb_t *pcb, yang_parsetype_t ptyp, ncx_module_t *parent, ncx_module_t **retmod)
Load an import module (special compiler processing)
Definition: ncxmod.c:4828
xml_util.h
XML Utilities.
yang_obj_consume_datadef
status_t yang_obj_consume_datadef(yang_pcb_t *pcb, tk_chain_t *tkc, ncx_module_t *mod, dlq_hdr_t *que, obj_template_t *parent)
Parse the next N tokens as a data-def-stmt.
Definition: yang_obj.c:11141
tk_free_chain
void tk_free_chain(tk_chain_t *tkc)
Cleanup and deallocate a tk_chain_t.
Definition: tk.c:3205
TK_CUR_LNUM
#define TK_CUR_LNUM(T)
return the current line number
Definition: tk.h:179
xmlns_unregister_ns
void xmlns_unregister_ns(xmlns_id_t ns_id)
Unregister the specified namespace.
Definition: xmlns.c:525
ncx_free_module
void ncx_free_module(ncx_module_t *mod)
Free a YANG module.
Definition: ncx.c:3431
yang_obj_consume_augment
status_t yang_obj_consume_augment(yang_pcb_t *pcb, tk_chain_t *tkc, ncx_module_t *mod)
Parse the next N tokens as a top-level augment-stmt.
Definition: yang_obj.c:11324
yang_top_keyword
boolean yang_top_keyword(const xmlChar *keyword)
Check if the string is a top-level YANG keyword.
Definition: yang.c:3479
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.
tk_dump_chain
void tk_dump_chain(const tk_chain_t *tkc)
Debug printf the token chain !!! Very verbose !!!
Definition: tk.c:3532
ncx_new_revhist
ncx_revhist_t * ncx_new_revhist(void)
Create a revision history entry.
Definition: ncx.c:6302
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
YANG11_VERSION_STR
#define YANG11_VERSION_STR
YANG 1.1 version.
Definition: yangconst.h:94
yang_typ_consume_typedef
status_t yang_typ_consume_typedef(yang_pcb_t *pcb, tk_chain_t *tkc, ncx_module_t *mod, dlq_hdr_t *que)
Consume a typedef-stmt.
Definition: yang_typ.c:5016
ERR_NCX_WRONG_VERSION
@ ERR_NCX_WRONG_VERSION
314
Definition: status_enum.h:357
ncx_set_mod_hidden
void ncx_set_mod_hidden(ncx_module_t *mod)
Force the module to be hidden from advertisement.
Definition: ncx.c:13117
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
dlq_lastEntry
#define dlq_lastEntry(listP)
get the last entry in the queue list
Definition: dlq.h:352
ERR_NCX_DUP_ENTRY
@ ERR_NCX_DUP_ENTRY
224
Definition: status_enum.h:263
ncx_get_mod_ocversion
const xmlChar * ncx_get_mod_ocversion(const ncx_module_t *mod)
Get the module openconfig-version string for the specified module.
Definition: ncx.c:8994
ncxconst.h
Contains NCX constants.
ncxmod.h
NCX Module Load Manager.
ncxmod_use_bestmatch_now
boolean ncxmod_use_bestmatch_now(const xmlChar *revision)
Check if the bestmatch can be used for this module.
Definition: ncxmod.c:9015
yinyang.h
Convert YIN format to YANG format for input.
yang_obj_resolve_xpath
status_t yang_obj_resolve_xpath(yang_pcb_t *pcb, tk_chain_t *tkc, ncx_module_t *mod, dlq_hdr_t *datadefQ)
Resolve XPath statements.
Definition: yang_obj.c:12293
TK_ADV
#define TK_ADV(T)
advance the current token pointer
Definition: tk.h:107
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
ncx_free_revhist
void ncx_free_revhist(ncx_revhist_t *revhist)
Free a revision history entry.
Definition: ncx.c:6322
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
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
yang_grp_resolve_final
status_t yang_grp_resolve_final(yang_pcb_t *pcb, tk_chain_t *tkc, ncx_module_t *mod, dlq_hdr_t *groupingQ)
Resolve Q of groupings.
Definition: yang_grp.c:770
tk_setup_chain_docmode
void tk_setup_chain_docmode(tk_chain_t *tkc)
Setup a previously allocated chain for a yangdump docmode output.
Definition: tk.c:3163
ncx_module_t_::descr
xmlChar * descr
description-stmt (not saved on server)
Definition: ncxtypes.h:918
ERR_NCX_ENTRY_EXISTS
@ ERR_NCX_ENTRY_EXISTS
223
Definition: status_enum.h:262
yang_obj_consume_rpc
status_t yang_obj_consume_rpc(yang_pcb_t *pcb, tk_chain_t *tkc, ncx_module_t *mod)
Parse the next N tokens as a rpc-stmt.
Definition: yang_obj.c:11233
ncx_warning_elevated
boolean ncx_warning_elevated(status_t res)
Check if a specific status_t code is elevated.
Definition: ncx.c:9439
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.
ncx_find_pre_import_test
ncx_import_t * ncx_find_pre_import_test(const ncx_module_t *mod, const xmlChar *prefix)
Search the importQ for a specified prefix value.
Definition: ncx.c:5668
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
yang_ext_consume_extension
status_t yang_ext_consume_extension(tk_chain_t *tkc, ncx_module_t *mod)
Parse the next N tokens as an extension-stmt.
Definition: yang_ext.c:267
NO_ERR
@ NO_ERR
000
Definition: status_enum.h:188
TK_TT_RBRACE
@ TK_TT_RBRACE
right brace '}'
Definition: tk.h:287
ncx_add_ydtrace
status_t ncx_add_ydtrace(const xmlChar *fspec)
Add the filespec of a yangdump file being processed.
Definition: ncx.c:12335
ncx_get_yang_version
ncx_yang_version_t ncx_get_yang_version(const ncx_module_t *mod)
Get the yang-version used in the module.
Definition: ncx.c:12937
ncx_set_ocpattern_mode
void ncx_set_ocpattern_mode(ncx_module_t *mod, boolean mode)
Set the openconfig pattern mode.
Definition: ncx.c:13823
ERR_NCX_WRONG_TKTYPE
@ ERR_NCX_WRONG_TKTYPE
245
Definition: status_enum.h:284
ERR_NCX_MOD_NOT_FOUND
@ ERR_NCX_MOD_NOT_FOUND
236
Definition: status_enum.h:275
yang_typ.h
YANG Module parser typedef and type statement support.
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
ERR_NCX_MISSING_FILE
@ ERR_NCX_MISSING_FILE
226
Definition: status_enum.h:265
log_debug4
void void void void void void void void void void void void void log_debug4(const char *fstr,...) __attribute__((format(printf
Generate a new LOG_DEBUG_DEBUG4 log entry.
ERR_NCX_OPERATION_FAILED
@ ERR_NCX_OPERATION_FAILED
274
Definition: status_enum.h:315
LOGDEBUG2
#define LOGDEBUG2
Check if at least log-level=debug2.
Definition: log.h:292
log_warn
void void void log_warn(const char *fstr,...) __attribute__((format(printf
Generate a new LOG_DEBUG_WARN log entry.
ERR_INTERNAL_VAL
@ ERR_INTERNAL_VAL
004
Definition: status_enum.h:194
yang_obj_remove_deleted_nodes
status_t yang_obj_remove_deleted_nodes(yang_pcb_t *pcb, tk_chain_t *tkc, ncx_module_t *mod, dlq_hdr_t *datadefQ)
Find any nodes marked for deletion and remove them.
Definition: yang_obj.c:12476
ncx_modname_is_ocpattern
boolean ncx_modname_is_ocpattern(const xmlChar *modname)
Check if the module name is an openconfig file.
Definition: ncx.c:13888
dlq_remove
void dlq_remove(void *nodeP)
remove the queue entry from its queue list entry MUST have been enqueued somehow before this function...
Definition: dlq.c:519
ncx_add_to_modQ
status_t ncx_add_to_modQ(ncx_module_t *mod, dlq_hdr_t *modQ)
Add module to the current module Q.
Definition: ncx.c:4678
ncx_find_ydtrace
boolean ncx_find_ydtrace(const xmlChar *fspec)
Find the filespec of a yangdump file being processed.
Definition: ncx.c:12361
ncx_number_all_objects
void ncx_number_all_objects(ncx_module_t *mod)
Number all objects for internal ordering comparisons.
Definition: ncx.c:13025
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_PREFIX_DUP_IMPORT
@ ERR_NCX_PREFIX_DUP_IMPORT
1012
Definition: status_enum.h:501
yang_obj_resolve_final
status_t yang_obj_resolve_final(yang_pcb_t *pcb, tk_chain_t *tkc, ncx_module_t *mod, dlq_hdr_t *datadefQ, boolean ingrouping, boolean is_top)
Resolve objects (final pass)
Definition: yang_obj.c:11963
ncx_find_import_test
ncx_import_t * ncx_find_import_test(const ncx_module_t *mod, const xmlChar *module)
Search the importQ for a specified module name.
Definition: ncx.c:5591
TK_GET_ESCERR
#define TK_GET_ESCERR(TK)
GET access the escaped string error fields.
Definition: tk.h:208
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
log_debug_append
void void void void void void void void log_debug_append(const char *fstr,...) __attribute__((format(printf
Append to a LOG_DEBUG_DEBUG log entry.
yang_obj_resolve_deviations
status_t yang_obj_resolve_deviations(yang_pcb_t *pcb, tk_chain_t *tkc, ncx_module_t *mod)
Resolve deviation-stmts.
Definition: yang_obj.c:11811
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
xml_strncmp
int xml_strncmp(const xmlChar *s1, const xmlChar *s2, uint32 maxlen)
String compare for xmlChar for at most 'maxlen' xmlChars.
Definition: xml_util.c:1824
get_error_string
const char * get_error_string(status_t res)
Get the error message for a specific internal error.
Definition: status.c:239
yang.h
YANG Module parser utilities.
log_debug
void void void void void void void log_debug(const char *fstr,...) __attribute__((format(printf
Generate a new LOG_DEBUG_DEBUG log entry.
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_obj_consume_deviation
status_t yang_obj_consume_deviation(yang_pcb_t *pcb, tk_chain_t *tkc, ncx_module_t *mod)
Parse the next N tokens as a top-level deviation-stmt.
Definition: yang_obj.c:11366
yangconst.h
Contains YANG constants separated to prevent H file include loops.
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
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
get_errtyp
errtyp_t get_errtyp(status_t res)
Get the error classification for the result code.
Definition: status.c:207
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
ncx_add_to_registry
status_t ncx_add_to_registry(ncx_module_t *mod)
Add all the definitions stored in an ncx_module_t to the registry.
Definition: ncx.c:4568
TK_TT_SEMICOL
@ TK_TT_SEMICOL
semi-colon ';'
Definition: tk.h:288
yang_obj_resolve_augments_final
status_t yang_obj_resolve_augments_final(yang_pcb_t *pcb, tk_chain_t *tkc, ncx_module_t *mod, dlq_hdr_t *datadefQ)
Resolve augmnet statements (final pass)
Definition: yang_obj.c:11759
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
yang_obj_resolve_xpath_final
status_t yang_obj_resolve_xpath_final(yang_pcb_t *pcb, tk_chain_t *tkc, ncx_module_t *mod, dlq_hdr_t *datadefQ)
Resolve XPath statements (final pass)
Definition: yang_obj.c:12327
yang_obj_resolve_augments
status_t yang_obj_resolve_augments(yang_pcb_t *pcb, tk_chain_t *tkc, ncx_module_t *mod, dlq_hdr_t *datadefQ)
Resolve augment statements.
Definition: yang_obj.c:11722
ncx_new_include
ncx_include_t * ncx_new_include(void)
Malloc and initialize the fields in a ncx_include_t.
Definition: ncx.c:5772
ncx_set_module_supported
void ncx_set_module_supported(ncx_module_t *mod, boolean supported)
Set the module supported field.
Definition: ncx.c:12505
yinyang_convert_token_chain
tk_chain_t * yinyang_convert_token_chain(const xmlChar *sourcespec, status_t *res)
Try to open a file as a YIN formatted XML file and convert it to a token chain for processing by yang...
Definition: yinyang.c:387
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
ncx_consume_top_appinfo
status_t ncx_consume_top_appinfo(yang_pcb_t *pcb, tk_chain_t *tkc, ncx_module_t *mod, dlq_hdr_t *appinfoQ)
Check if an appinfo clause is present Called from the body_stmt handler Only top-level extension hand...
Definition: ncx_appinfo.c:800
yang_ext.h
YANG Module parser extension statement support.
ncx_module_t_::ref
xmlChar * ref
reference-stmt (not saved on server)
Definition: ncxtypes.h:921
ERR_NCX_EXP_MODULE
@ ERR_NCX_EXP_MODULE
329
Definition: status_enum.h:372
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_mod_missing_err
void ncx_mod_missing_err(tk_chain_t *tkc, ncx_module_t *mod, const char *stmtstr, const char *expstr)
Print an error for wrong token, mandatory sub-statement is missing.
Definition: ncx.c:7316
xml_strcmp
int xml_strcmp(const xmlChar *s1, const xmlChar *s2)
String compare for xmlChar.
Definition: xml_util.c:1746
TK_TT_LBRACE
@ TK_TT_LBRACE
left brace '{'
Definition: tk.h:286
YANG_PT_IMPORT
@ YANG_PT_IMPORT
called from module import-stmt
Definition: yang.h:108
LOGDEBUG4
#define LOGDEBUG4
Check if at least log-level=debug4.
Definition: log.h:302
log.h
NCX System Logging Manager.
ERR_NCX_NO_REVISION
@ ERR_NCX_NO_REVISION
1046
Definition: status_enum.h:535
ncxtypes.h
YANG module data structures Many internal representations of YANG module constructs.
ncx_free_identity
void ncx_free_identity(ncx_identity_t *identity)
Free a malloced ncx_identity_t struct.
Definition: ncx.c:6033
xmlns_nc_id
xmlns_id_t xmlns_nc_id(void)
Get the ID for the NETCONF namespace or 0 if it doesn't exist.
Definition: xmlns.c:880
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
LOGDEBUG
#define LOGDEBUG
Check if at least log-level=debug.
Definition: log.h:287
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
ERR_TYP_WARN
@ ERR_TYP_WARN
warning
Definition: status_enum.h:179
ERR_NCX_DUP_INCLUDE
@ ERR_NCX_DUP_INCLUDE
1018
Definition: status_enum.h:507
yang_feature_consume_iffeature
status_t yang_feature_consume_iffeature(tk_chain_t *tkc, ncx_module_t *mod, dlq_hdr_t *iffeatureQ, dlq_hdr_t *appinfoQ)
Consume an if-feature-stmt.
Definition: yang_feature.c:1311
ncx_find_include
ncx_include_t * ncx_find_include(const ncx_module_t *mod, const xmlChar *submodule)
Search the includeQ for a specified submodule name.
Definition: ncx.c:5833
ERR_NCX_DUP_REVISION
@ ERR_NCX_DUP_REVISION
1054
Definition: status_enum.h:543
ncx_new_identity
ncx_identity_t * ncx_new_identity(void)
Get a new ncx_identity_t struct.
Definition: ncx.c:5938
ERR_NCX_EXP_SUBMODULE
@ ERR_NCX_EXP_SUBMODULE
330
Definition: status_enum.h:373
tk_tokenize_input
status_t tk_tokenize_input(tk_chain_t *tkc, ncx_module_t *mod)
Parse the input (FILE or buffer) into tk_token_t structs.
Definition: tk.c:3641
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
ERR_NCX_IMPORT_LOOP
@ ERR_NCX_IMPORT_LOOP
327
Definition: status_enum.h:370
ERR_NCX_INVALID_DUP_IMPORT
@ ERR_NCX_INVALID_DUP_IMPORT
353
Definition: status_enum.h:396
dlq_empty
#define dlq_empty(listP)
check if queue list is empty
Definition: dlq.h:367
ERR_NCX_SUBMOD_NOT_LOADED
@ ERR_NCX_SUBMOD_NOT_LOADED
374
Definition: status_enum.h:417
yang_parse.h
YANG Module parser module.
yang_grp_consume_grouping
status_t yang_grp_consume_grouping(yang_pcb_t *pcb, tk_chain_t *tkc, ncx_module_t *mod, dlq_hdr_t *que, obj_template_t *parent)
Consume a grouping-stmt.
Definition: yang_grp.c:230
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_free_import
void ncx_free_import(ncx_import_t *import)
Free an ncx_import_t.
Definition: ncx.c:5498
log_debug2_append
void void void void void void void void void void log_debug2_append(const char *fstr,...) __attribute__((format(printf
Append to a LOG_DEBUG_DEBUG2 log entry.
yang_obj_resolve_uses
status_t yang_obj_resolve_uses(yang_pcb_t *pcb, tk_chain_t *tkc, ncx_module_t *mod, dlq_hdr_t *datadefQ)
Resolves uses-stmts.
Definition: yang_obj.c:11575
yang_obj_resolve_datadefs
status_t yang_obj_resolve_datadefs(yang_pcb_t *pcb, tk_chain_t *tkc, ncx_module_t *mod, dlq_hdr_t *datadefQ)
Resolve data-def-stmts.
Definition: yang_obj.c:11531
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
ncx_get_source
xmlChar * ncx_get_source(const xmlChar *fspec, status_t *res)
Expand a filespec into an absolute path.
Definition: ncx.c:8362
ncx.h
YANG module utility functions.
yang_feature_resolve_feature
status_t yang_feature_resolve_feature(yang_pcb_t *pcb, tk_chain_t *tkc, ncx_module_t *mod, ncx_feature_t *feature)
Validate all the if-feature clauses present in the specified feature.
Definition: yang_feature.c:1359
obj.h
Data Object Support.
TK_CUR_TYP
#define TK_CUR_TYP(T)
return the current token type
Definition: tk.h:125
yang_obj.h
YANG Module parser support for data-def-stmt.
NCX_REQ
@ NCX_REQ
clause is required
Definition: ncxtypes.h:1082
ERR_NCX_DEF_LOOP
@ ERR_NCX_DEF_LOOP
325
Definition: status_enum.h:368
ERR_NCX_IN_USE
@ ERR_NCX_IN_USE
match netconf errors (257 - 275)
Definition: status_enum.h:298
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
ERR_NCX_BAD_REV_ORDER
@ ERR_NCX_BAD_REV_ORDER
1035
Definition: status_enum.h:524
ncx_file_close
void ncx_file_close(FILE *fp)
Close a file; check result.
Definition: ncx.c:13235
dlq_enque
void dlq_enque(REG void *newP, REG dlq_hdrT *listP)
add a queue node to the end of a queue list Add newP to listP
Definition: dlq.c:246
NCX_FL_MOD_DONE
#define NCX_FL_MOD_DONE
bit definitions for the ncx_module_t 32-bit flags field
Definition: ncxconst.h:1593
yang_obj_consume_notification
status_t yang_obj_consume_notification(yang_pcb_t *pcb, tk_chain_t *tkc, ncx_module_t *mod)
Parse the next N tokens as a notification-stmt.
Definition: yang_obj.c:11277
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
yang_obj_check_leafref_loops
status_t yang_obj_check_leafref_loops(tk_chain_t *tkc, ncx_module_t *mod, dlq_hdr_t *datadefQ)
Check all leafref objects for hard-wired object loops Must be done after yang_obj_resolve_xpath.
Definition: yang_obj.c:12361
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
ERR_NCX_DATA_MISSING
@ ERR_NCX_DATA_MISSING
272
Definition: status_enum.h:313
tk_setup_chain_yang
void tk_setup_chain_yang(tk_chain_t *tkc, FILE *fp, const xmlChar *filename)
Setup a previously allocated chain for a YANG file.
Definition: tk.c:3046
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
ncx_new_import
ncx_import_t * ncx_new_import(void)
Malloc and initialize the fields in a ncx_import_t.
Definition: ncx.c:5474
xmlns_find_ns_by_name
xmlns_id_t xmlns_find_ns_by_name(const xmlChar *name)
Find the NS ID from its name.
Definition: xmlns.c:797
yang_feature_consume_feature
status_t yang_feature_consume_feature(tk_chain_t *tkc, ncx_module_t *mod)
Parse the next N tokens as a feature statement.
Definition: yang_feature.c:1114
ERR_NCX_INVALID_ESCSTR
@ ERR_NCX_INVALID_ESCSTR
415
Definition: status_enum.h:458
ERR_NCX_INVALID_DUP_INCLUDE
@ ERR_NCX_INVALID_DUP_INCLUDE
354
Definition: status_enum.h:397
yang_obj_top_resolve_final
status_t yang_obj_top_resolve_final(yang_pcb_t *pcb, tk_chain_t *tkc, ncx_module_t *mod, dlq_hdr_t *datadefQ)
Resolve top-level objects (final pass)
Definition: yang_obj.c:12225
TK_TT_MSTRING
@ TK_TT_MSTRING
module-qualified token string
Definition: tk.h:320
yang_grp_resolve_complete
status_t yang_grp_resolve_complete(yang_pcb_t *pcb, tk_chain_t *tkc, ncx_module_t *mod, dlq_hdr_t *groupingQ, obj_template_t *parent)
Resolve grouping-stmts (second pass)
Definition: yang_grp.c:671
ncx_new_module
ncx_module_t * ncx_new_module(void)
Malloc and initialize the fields in a ncx_module_t.
Definition: ncx.c:3177
ERR_NCX_MISSING_RBRACE
@ ERR_NCX_MISSING_RBRACE
377
Definition: status_enum.h:420
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
log_debug3_append
void void void void void void void void void void void void log_debug3_append(const char *fstr,...) __attribute__((format(printf
Append to a LOG_DEBUG_DEBUG3 log entry.
yang_feature_resolve_iffeatureQ2
status_t yang_feature_resolve_iffeatureQ2(yang_pcb_t *pcb, tk_chain_t *tkc, ncx_module_t *mod, dlq_hdr_t *iffeatureQ)
Check the Q of if-feature statements for the specified object.
Definition: yang_feature.c:1519
dlq.h
dlq provides general double-linked list and queue support:
ncx_module_t_::ns
xmlChar * ns
namespace URI
Definition: ncxtypes.h:924
LOGDEBUG3
#define LOGDEBUG3
Check if at least log-level=debug3.
Definition: log.h:297
ncx_find_revhist
ncx_revhist_t * ncx_find_revhist(const ncx_module_t *mod, const xmlChar *ver)
Search the revhistQ for a specified revision.
Definition: ncx.c:6351
yang_typ_resolve_typedefs_final
status_t yang_typ_resolve_typedefs_final(tk_chain_t *tkc, ncx_module_t *mod, dlq_hdr_t *typeQ)
Resolve typedefs (final pass)
Definition: yang_typ.c:5357
GET_MOD_ABORTED
#define GET_MOD_ABORTED(M)
Check module aborted flag.
Definition: ncxtypes.h:70