yumapro  23.10T-7
YumaPro SDK
Loading...
Searching...
No Matches
ext.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_ext
13#define _H_ext
14
15/* FILE: ext.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
33date init comment
34----------------------------------------------------------------------
3505-jan-08 abb Begun
36
37*/
38
39#include <xmlstring.h>
40#include <xmlregexp.h>
41
42#ifndef _H_ncxconst
43#include "ncxconst.h"
44#endif
45
46#ifndef _H_ncxtypes
47#include "ncxtypes.h"
48#endif
49
50#ifndef _H_status
51#include "status.h"
52#endif
53
54#ifndef _H_tk
55#include "tk.h"
56#endif
57
58#ifndef _H_xmlns
59#include "xmlns.h"
60#endif
61
62
63#ifdef __cplusplus
64extern "C" {
65#endif
66
67/********************************************************************
68* *
69* C O N S T A N T S *
70* *
71*********************************************************************/
72
73#define EXT_CBFN_COOKIE(E) (E)->cbfn_cookie
74
75/********************************************************************
76* *
77* T Y P E S *
78* *
79*********************************************************************/
80
81
82
119 (void *rawpcb, // struct yang_pcb_t_ *pcb
120 ncx_module_t *mod,
121 tk_chain_t *tkc,
122 struct ext_template_t_ *ext,
123 void *cookie,
124 const xmlChar *arg,
125 ncx_node_t node_type,
126 void *node);
127
128
130typedef struct ext_template_t_ {
131 dlq_hdr_t qhdr;
132 xmlChar *name;
133 xmlChar *descr;
134 xmlChar *ref;
135 xmlChar *arg;
138 boolean argel;
139 boolean used;
140 dlq_hdr_t appinfoQ;
145
146
147/********************************************************************
148* *
149* F U N C T I O N S *
150* *
151*********************************************************************/
152
153
159extern ext_template_t *
160 ext_new_template (void);
161
162
172extern void
174
175
181extern void
182 ext_clean_extensionQ (dlq_hdr_t *que);
183
184
193extern ext_template_t *
195 const xmlChar *name);
196
197
205extern ext_template_t *
206 ext_find_extension_que (dlq_hdr_t *extensionQ,
207 const xmlChar *name);
208
209
218extern ext_template_t *
220 const xmlChar *name);
221
222
227extern void
228 ext_init (void);
229
234extern void
235 ext_cleanup (void);
236
237
251extern status_t
252 ext_register_cbfn (const xmlChar *modname,
253 const xmlChar *extname,
254 ext_cbfn_t cbfn,
255 void *cbfn_cookie);
256
257
266extern void
267 ext_find_cbfn (const xmlChar *modname,
268 const xmlChar *extname,
269 ext_template_t *ext);
270
271
274#ifdef __cplusplus
275} /* end extern 'C' */
276#endif
277
278#endif /* _H_ext */
status_t
global error return code
Definition: status_enum.h:210
uint16 xmlns_id_t
integer handle for registered namespaces
Definition: xmlns.h:89
ncx_node_t
NCX Internal Node Types.
Definition: ncxtypes.h:437
ncx_status_t
enumeration for different YANG data-def status values
Definition: ncxtypes.h:583
void ext_clean_extensionQ(dlq_hdr_t *que)
Clean a queue of ext_template_t structs.
Definition: ext.c:196
ext_template_t * ext_new_template(void)
Malloc and initialize the fields in a ext_template_t.
Definition: ext.c:133
status_t ext_register_cbfn(const xmlChar *modname, const xmlChar *extname, ext_cbfn_t cbfn, void *cbfn_cookie)
Register a callback function for the specified extension If multiple callbacks for same extension,...
Definition: ext.c:454
void ext_cleanup(void)
Cleanup the extension callback handler queue.
Definition: ext.c:423
status_t(* ext_cbfn_t)(void *rawpcb, ncx_module_t *mod, tk_chain_t *tkc, struct ext_template_t_ *ext, void *cookie, const xmlChar *arg, ncx_node_t node_type, void *node)
One YANG Extension Handler Callback.
Definition: ext.h:119
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:225
void ext_init(void)
Init the extension callback handler queue.
Definition: ext.c:406
ext_template_t * ext_find_extension_que(dlq_hdr_t *extensionQ, const xmlChar *name)
Find an ext_template_t struct in the specified Q.
Definition: ext.c:322
ext_template_t * ext_find_extension_all(ncx_module_t *mod, const xmlChar *name)
Search a module of ext_template_t structs for a given name Check all submodules as well.
Definition: ext.c:359
void ext_free_template(ext_template_t *ext)
Scrub the memory in a ext_template_t by freeing all the sub-fields and then freeing the entire struct...
Definition: ext.c:161
void ext_find_cbfn(const xmlChar *modname, const xmlChar *extname, ext_template_t *ext)
Find the registered callback for the specified extension Set the callback handler if found.
Definition: ext.c:504
Contains NCX constants.
YANG module data structures Many internal representations of YANG module constructs.
Global error messages for status code enumerations.
One YANG 'extension' definition – language extension template.
Definition: ext.h:130
ncx_error_t tkerr
file and line infor for compiler
Definition: ext.h:141
dlq_hdr_t appinfoQ
Q of ncx_appinfo_t.
Definition: ext.h:140
xmlChar * name
malloced name
Definition: ext.h:132
boolean argel
T:arg is an element, F: attribute.
Definition: ext.h:138
ncx_status_t status
status of parse
Definition: ext.h:137
xmlChar * ref
malloced reference-stmt
Definition: ext.h:134
void * cbfn_cookie
managed by callback
Definition: ext.h:143
dlq_hdr_t qhdr
queue header
Definition: ext.h:131
xmlChar * descr
malloced description-stmt
Definition: ext.h:133
ext_cbfn_t cbfn
callback function
Definition: ext.h:142
boolean used
needed by yangdiff
Definition: ext.h:139
xmlChar * arg
malloced argument name
Definition: ext.h:135
xmlns_id_t nsid
namespace ID
Definition: ext.h:136
struct to remember error info tkc->cur_err will be checked before tkc->cur for error information
Definition: ncxtypes.h:873
representation of one module or submodule during and after parsing
Definition: ncxtypes.h:1134
token parsing chain (main parser control block)
Definition: tk.h:415
NCX Syntax Token Handler.
XML namespace support.