yumapro  20.10-12
YumaPro SDK
ncx_appinfo.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_ncx_appinfo
13 #define _H_ncx_appinfo
14 
15 /* FILE: ncx_appinfo.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 17-feb-10 abb Begun; split out from ncx.c
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_ncx
50 #include "ncx.h"
51 #endif
52 
53 #ifndef _H_ncx_appinfo
54 #include "ncx_appinfo.h"
55 #endif
56 
57 #ifndef _H_ncxtypes
58 #include "ncxtypes.h"
59 #endif
60 
61 #ifndef _H_tk
62 #include "tk.h"
63 #endif
64 
65 #ifndef _H_typ
66 #include "typ.h"
67 #endif
68 
69 #ifndef _H_val
70 #include "val.h"
71 #endif
72 
73 #ifndef _H_xmlns
74 #include "xmlns.h"
75 #endif
76 
77 #ifndef _H_yang
78 #include "yang.h"
79 #endif
80 
81 #ifdef __cplusplus
82 extern "C" {
83 #endif
84 
85 /********************************************************************
86 * *
87 * F U N C T I O N S *
88 * *
89 *********************************************************************/
90 
108 extern ncx_appinfo_t *
109  ncx_new_appinfo (boolean isclone);
110 
111 
117 extern void
118  ncx_free_appinfo (ncx_appinfo_t *appinfo);
119 
120 
139 extern ncx_appinfo_t *
140  ncx_find_appinfo (dlq_hdr_t *appinfoQ,
141  const xmlChar *prefix,
142  const xmlChar *varname);
143 
144 
157 extern const ncx_appinfo_t *
158  ncx_find_const_appinfo (const dlq_hdr_t *appinfoQ,
159  const xmlChar *prefix,
160  const xmlChar *varname);
161 
162 
176 extern const ncx_appinfo_t *
177  ncx_find_next_appinfo (const ncx_appinfo_t *current,
178  const xmlChar *prefix,
179  const xmlChar *varname);
180 
181 
195 extern ncx_appinfo_t *
196  ncx_find_next_appinfo2 (ncx_appinfo_t *current,
197  const xmlChar *prefix,
198  const xmlChar *varname);
199 
200 
208 extern ncx_appinfo_t *
209  ncx_clone_appinfo (ncx_appinfo_t *appinfo);
210 
211 
218 extern void
219  ncx_clean_appinfoQ (dlq_hdr_t *appinfoQ);
220 
221 
235 extern status_t
236  ncx_consume_appinfo (tk_chain_t *tkc,
237  ncx_module_t *mod,
238  dlq_hdr_t *appinfoQ);
239 
240 
258 extern status_t
259  ncx_consume_top_appinfo (yang_pcb_t *pcb,
260  tk_chain_t *tkc,
261  ncx_module_t *mod,
262  dlq_hdr_t *appinfoQ);
263 
264 
281 extern status_t
282  ncx_consume_appinfo2 (tk_chain_t *tkc,
283  ncx_module_t *mod,
284  dlq_hdr_t *appinfoQ);
285 
286 
299 extern status_t
300  ncx_resolve_appinfoQ (yang_pcb_t *pcb,
301  tk_chain_t *tkc,
302  ncx_module_t *mod,
303  dlq_hdr_t *appinfoQ);
304 
305 
320 extern status_t
321  ncx_resolve_appinfoQ_ex (yang_pcb_t *pcb,
322  tk_chain_t *tkc,
323  ncx_module_t *mod,
324  dlq_hdr_t *appinfoQ,
325  ncx_node_t node_type,
326  void *node);
327 
328 
341 extern const xmlChar *
342  ncx_get_appinfo_value (const ncx_appinfo_t *appinfo);
343 
344 
345 
349 #ifdef __cplusplus
350 } /* end extern 'C' */
351 #endif
352 
353 #endif /* _H_ncx_appinfo */
ERR_NCX_SKIPPED
@ ERR_NCX_SKIPPED
2001
Definition: status_enum.h:551
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
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_find_next_appinfo2
ncx_appinfo_t * ncx_find_next_appinfo2(ncx_appinfo_t *current, const xmlChar *prefix, const xmlChar *varname)
Find the next instance of an appinfo entry by name (First match is returned, not const version) The e...
Definition: ncx_appinfo.c:644
ncx_appinfo.h
NCX Module Library Extension (Application Info) Utility Functions.
TK_BKUP
#define TK_BKUP(T)
back-up the current token pointer
Definition: tk.h:112
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
ncx_force_ocpattern_mode
void ncx_force_ocpattern_mode(ncx_module_t *mod)
Force the openconfig pattern mode to TRUE.
Definition: ncx.c:13847
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
ERR_NCX_DEF_NOT_FOUND
@ ERR_NCX_DEF_NOT_FOUND
250
Definition: status_enum.h:289
ncx_find_appinfo
ncx_appinfo_t * ncx_find_appinfo(dlq_hdr_t *appinfoQ, const xmlChar *prefix, const xmlChar *varname)
Find an appinfo entry by name (First match is returned) The entry returned is not removed from the Q.
Definition: ncx_appinfo.c:495
log_error
void log_error(const char *fstr,...) __attribute__((format(printf
Generate a new LOG_DEBUG_ERROR log entry.
ncx_get_modname
const xmlChar * ncx_get_modname(const ncx_module_t *mod)
Get the main module name.
Definition: ncx.c:4834
val.h
Value Node Basic Support.
xml_util.h
XML Utilities.
ncx_clean_appinfoQ
void ncx_clean_appinfoQ(dlq_hdr_t *appinfoQ)
Check an initialized appinfoQ for any entries Remove them from the queue and delete them.
Definition: ncx_appinfo.c:723
TK_CUR_LNUM
#define TK_CUR_LNUM(T)
return the current line number
Definition: tk.h:179
ncx_find_const_appinfo
const ncx_appinfo_t * ncx_find_const_appinfo(const dlq_hdr_t *appinfoQ, const xmlChar *prefix, const xmlChar *varname)
Find an appinfo entry by name (First match is returned) The entry returned is not removed from the Q ...
Definition: ncx_appinfo.c:544
tk.h
NCX Syntax Token Handler.
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_SOURCE_YANG
@ TK_SOURCE_YANG
YANG.
Definition: tk.h:339
ncxconst.h
Contains NCX constants.
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
TK_CUR_LPOS
#define TK_CUR_LPOS(T)
return the current line position
Definition: tk.h:182
xmlns_get_module
const xmlChar * xmlns_get_module(xmlns_id_t nsid)
get the module name of the namespace ID
Definition: xmlns.c:1126
ncx_get_appinfo_value
const xmlChar * ncx_get_appinfo_value(const ncx_appinfo_t *appinfo)
Get the value string from an appinfo struct.
Definition: ncx_appinfo.c:1051
ERR_NCX_MISSING_PARM
@ ERR_NCX_MISSING_PARM
233
Definition: status_enum.h:272
NO_ERR
@ NO_ERR
000
Definition: status_enum.h:188
TK_TT_RBRACE
@ TK_TT_RBRACE
right brace '}'
Definition: tk.h:287
dlq_createQue
dlq_hdrT * dlq_createQue(void)
create a dynamic queue header
Definition: dlq.c:146
ncx_set_mod_ocversion
status_t ncx_set_mod_ocversion(ncx_module_t *mod, const xmlChar *ocversion)
Set the module openconfig-version string for the specified module.
Definition: ncx.c:9015
ERR_NCX_INVALID_VALUE
@ ERR_NCX_INVALID_VALUE
258
Definition: status_enum.h:299
ERR_INTERNAL_MEM
@ ERR_INTERNAL_MEM
003
Definition: status_enum.h:193
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
yang.h
YANG Module parser utilities.
ncx_new_appinfo
ncx_appinfo_t * ncx_new_appinfo(boolean isclone)
Create an appinfo entry.
Definition: ncx_appinfo.c:415
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.
yangconst.h
Contains YANG constants separated to prevent H file include loops.
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
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
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
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
ncx_free_appinfo
void ncx_free_appinfo(ncx_appinfo_t *appinfo)
Free an appinfo entry.
Definition: ncx_appinfo.c:448
ncx_netconfd_running
boolean ncx_netconfd_running(void)
Check if netconfd running.
Definition: ncx.c:11805
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
log.h
NCX System Logging Manager.
ncxtypes.h
YANG module data structures Many internal representations of YANG module constructs.
LOGDEBUG
#define LOGDEBUG
Check if at least log-level=debug.
Definition: log.h:287
dlq_deque
void * dlq_deque(dlq_hdrT *listP)
remove the first queue node from the queue list
Definition: dlq.c:286
NCX_NT_NONE
@ NCX_NT_NONE
not set
Definition: ncxtypes.h:273
dlq_empty
#define dlq_empty(listP)
check if queue list is empty
Definition: dlq.h:367
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
dlq_firstEntry
#define dlq_firstEntry(listP)
get the first entry in the queue list
Definition: dlq.h:337
ncx.h
YANG module utility functions.
ncx_find_next_appinfo
const ncx_appinfo_t * ncx_find_next_appinfo(const ncx_appinfo_t *current, const xmlChar *prefix, const xmlChar *varname)
Find the next instance of an appinfo entry by name (First match is returned) The entry returned is no...
Definition: ncx_appinfo.c:594
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
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
SET_ERROR
#define SET_ERROR(E)
macro SET_ERROR
Definition: status_enum.h:103
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_EXTRA_PARM
@ ERR_NCX_EXTRA_PARM
234
Definition: status_enum.h:273
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
xmlns.h
XML namespace support.
dlq_destroyQue
void dlq_destroyQue(dlq_hdrT *listP)
free a dynamic queue header previously allocated with dlq_createQue
Definition: dlq.c:206
status.h
Global error messages for status code enumerations.
dlq.h
dlq provides general double-linked list and queue support:
ncx_clone_appinfo
ncx_appinfo_t * ncx_clone_appinfo(ncx_appinfo_t *appinfo)
Clone an appinfo value.
Definition: ncx_appinfo.c:688
ext.h
YANG Extension Handler.
LOGDEBUG3
#define LOGDEBUG3
Check if at least log-level=debug3.
Definition: log.h:297
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