yumapro  20.10-12
YumaPro SDK
yang_grp.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_grp
13 #define _H_yang_grp
14 
15 /* FILE: yang_grp.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 14-dec-07 abb Begun; start from yang_typ.h
36 
37 */
38 
39 #ifndef _H_dlq
40 #include "dlq.h"
41 #endif
42 
43 #ifndef _H_grp
44 #include "grp.h"
45 #endif
46 
47 #ifndef _H_ncxtypes
48 #include "ncxtypes.h"
49 #endif
50 
51 #ifndef _H_obj
52 #include "obj.h"
53 #endif
54 
55 #ifndef _H_status
56 #include "status.h"
57 #endif
58 
59 #ifndef _H_tk
60 #include "tk.h"
61 #endif
62 
63 #ifndef _H_yang
64 #include "yang.h"
65 #endif
66 
67 #ifdef __cplusplus
68 extern "C" {
69 #endif
70 
71 /********************************************************************
72 * *
73 * T Y P E S *
74 * *
75 *********************************************************************/
76 
77 
78 /********************************************************************
79 * *
80 * F U N C T I O N S *
81 * *
82 *********************************************************************/
83 
84 /* Group definied in grp.h */
85 
86 
115 extern status_t
116  yang_grp_consume_grouping (yang_pcb_t *pcb,
117  tk_chain_t *tkc,
118  ncx_module_t *mod,
119  dlq_hdr_t *que,
120  obj_template_t *parent);
121 
122 
145 extern status_t
146  yang_grp_resolve_groupings (yang_pcb_t *pcb,
147  tk_chain_t *tkc,
148  ncx_module_t *mod,
149  dlq_hdr_t *groupingQ,
150  obj_template_t *parent);
151 
152 
176 extern status_t
177  yang_grp_resolve_complete (yang_pcb_t *pcb,
178  tk_chain_t *tkc,
179  ncx_module_t *mod,
180  dlq_hdr_t *groupingQ,
181  obj_template_t *parent);
182 
183 
199 extern status_t
200  yang_grp_resolve_final (yang_pcb_t *pcb,
201  tk_chain_t *tkc,
202  ncx_module_t *mod,
203  dlq_hdr_t *groupingQ);
204 
205 
233 extern status_t
234  yang_grp_check_nest_loop (tk_chain_t *tkc,
235  ncx_module_t *mod,
236  obj_template_t *obj,
237  grp_template_t *grp);
238 
242 #ifdef __cplusplus
243 } /* end extern 'C' */
244 #endif
245 
246 #endif /* _H_yang_grp */
ncx_find_grouping
grp_template_t * ncx_find_grouping(ncx_module_t *mod, const xmlChar *grpname, boolean useall)
Find the YANG grouping.
Definition: ncx.c:3651
TK_TT_TSTRING
@ TK_TT_TSTRING
token string
Definition: tk.h:319
grp_new_template
grp_template_t * grp_new_template(void)
Malloc and initialize the fields in a grp_template_t.
Definition: grp.c:100
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_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
obj_find_grouping
grp_template_t * obj_find_grouping(obj_template_t *obj, const xmlChar *grpname)
Check if a grp_template_t in the obj groupingQ hierarchy.
Definition: obj.c:8343
ncx_valid_name2
boolean ncx_valid_name2(const xmlChar *str)
Check if an xmlChar string is a valid NCX name.
Definition: ncx.c:7637
yang_grp.h
YANG Module parser grouping statement support.
LOG_DEBUG_DEBUG4
@ LOG_DEBUG_DEBUG4
debug level 4
Definition: log.h:397
log_error
void log_error(const char *fstr,...) __attribute__((format(printf
Generate a new LOG_DEBUG_ERROR log entry.
xml_util.h
XML Utilities.
TK_CUR_LNUM
#define TK_CUR_LNUM(T)
return the current line number
Definition: tk.h:179
tk.h
NCX Syntax Token Handler.
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
yang_obj_consume_datadef_grp
status_t yang_obj_consume_datadef_grp(yang_pcb_t *pcb, tk_chain_t *tkc, ncx_module_t *mod, dlq_hdr_t *que, obj_template_t *parent, grp_template_t *grp)
Parse the next N tokens as a data-def-stmt (in a grouping)
Definition: yang_obj.c:11187
obj_dump_child_list
void obj_dump_child_list(log_debug_t lvl, dlq_hdr_t *datadefQ, uint32 startindent, uint32 indent)
Dump the object names in a datadefQ – just child level uses log_write_level() for writing ....
Definition: obj.c:15711
ERR_NCX_DUP_ENTRY
@ ERR_NCX_DUP_ENTRY
224
Definition: status_enum.h:263
ncxconst.h
Contains NCX constants.
ncx_module_t_::groupingQ
dlq_hdr_t groupingQ
Q of grp_template_t.
Definition: ncxtypes.h:957
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
yang_grp_check_nest_loop
status_t yang_grp_check_nest_loop(tk_chain_t *tkc, ncx_module_t *mod, obj_template_t *obj, grp_template_t *grp)
Check the 'uses' object and determine if it is contained within the group being used.
Definition: yang_grp.c:853
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
yang_typ_resolve_typedefs_grp
status_t yang_typ_resolve_typedefs_grp(yang_pcb_t *pcb, tk_chain_t *tkc, ncx_module_t *mod, dlq_hdr_t *typeQ, obj_template_t *parent, grp_template_t *grp)
Resolve typedefs in a grouping (final pass)
Definition: yang_typ.c:5423
def_reg.h
Definition Registry module.
NO_ERR
@ NO_ERR
000
Definition: status_enum.h:188
TK_TT_RBRACE
@ TK_TT_RBRACE
right brace '}'
Definition: tk.h:287
ncx_module_t_::parent
struct ncx_module_t_ * parent
if this is a submodule
Definition: ncxtypes.h:970
ERR_NCX_WRONG_TKTYPE
@ ERR_NCX_WRONG_TKTYPE
245
Definition: status_enum.h:284
yang_typ.h
YANG Module parser typedef and type statement support.
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.
ncx_find_grouping_que
grp_template_t * ncx_find_grouping_que(const dlq_hdr_t *groupingQ, const xmlChar *grpname)
Check if a grp_template_t in the specified Q.
Definition: ncx.c:3746
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
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
ERR_INTERNAL_MEM
@ ERR_INTERNAL_MEM
003
Definition: status_enum.h:193
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.
typ.h
Parameter Type Handler.
yangconst.h
Contains YANG constants separated to prevent H file include loops.
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
TK_TT_SEMICOL
@ TK_TT_SEMICOL
semi-colon ';'
Definition: tk.h:288
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
ncx_module_t_::ref
xmlChar * ref
reference-stmt (not saved on server)
Definition: ncxtypes.h:921
EMPTY_STRING
#define EMPTY_STRING
empty string used to get const xmlChar * cast
Definition: ncxconst.h:289
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
LOGDEBUG4
#define LOGDEBUG4
Check if at least log-level=debug4.
Definition: log.h:302
log.h
NCX System Logging Manager.
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_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
OBJ_TYP_USES
@ OBJ_TYP_USES
uses-stmt has no name
Definition: obj.h:620
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
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
grp_free_template
void grp_free_template(grp_template_t *grp)
Scrub the memory in a grp_template_t by freeing all the sub-fields and then freeing the entire struct...
Definition: grp.c:131
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.h
YANG module utility functions.
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.
ERR_NCX_DEF_LOOP
@ ERR_NCX_DEF_LOOP
325
Definition: status_enum.h:368
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
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
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_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
SET_ERROR
#define SET_ERROR(E)
macro SET_ERROR
Definition: status_enum.h:103
ncx_resolve_appinfoQ_ex
status_t ncx_resolve_appinfoQ_ex(yang_pcb_t *pcb, tk_chain_t *tkc, ncx_module_t *mod, dlq_hdr_t *appinfoQ, ncx_node_t node_type, void *node)
Validate all the appinfo clauses present in the specified Q.
Definition: ncx_appinfo.c:911
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
status.h
Global error messages for status code enumerations.
dlq.h
dlq provides general double-linked list and queue support:
NCX_DEF_INDENT
#define NCX_DEF_INDENT
default indent amount for nesting XML or other structured output
Definition: ncxconst.h:441