yumapro  21.10T-8
YumaPro SDK
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 
33 date init comment
34 ----------------------------------------------------------------------
35 05-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
64 extern "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 
118 typedef status_t (*ext_cbfn_t)
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 
130 typedef 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;
143  void *cbfn_cookie;
145 
146 
147 /********************************************************************
148 * *
149 * F U N C T I O N S *
150 * *
151 *********************************************************************/
152 
153 
159 extern ext_template_t *
160  ext_new_template (void);
161 
162 
172 extern void
174 
175 
181 extern void
182  ext_clean_extensionQ (dlq_hdr_t *que);
183 
184 
193 extern ext_template_t *
195  const xmlChar *name);
196 
197 
205 extern ext_template_t *
206  ext_find_extension_que (dlq_hdr_t *extensionQ,
207  const xmlChar *name);
208 
209 
218 extern ext_template_t *
220  const xmlChar *name);
221 
222 
227 extern void
228  ext_init (void);
229 
234 extern void
235  ext_cleanup (void);
236 
237 
251 extern status_t
252  ext_register_cbfn (const xmlChar *modname,
253  const xmlChar *extname,
254  ext_cbfn_t cbfn,
255  void *cbfn_cookie);
256 
257 
266 extern 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 */
void * cbfn_cookie
managed by callback
Definition: ext.h:143
xmlChar * ref
malloced reference-stmt
Definition: ext.h:134
void ext_cleanup(void)
Cleanup the extension callback handler queue.
Definition: ext.c:436
boolean used
needed by yangdiff
Definition: ext.h:139
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:467
uint16 xmlns_id_t
integer handle for registered namespaces
Definition: xmlns.h:89
Contains NCX constants.
representation of one module or submodule during and after parsing
Definition: ncxtypes.h:1052
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 module data structures Many internal representations of YANG module constructs.
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:812
token parsing chain (main parser control block)
Definition: tk.h:415
ncx_status_t status
status of parse
Definition: ext.h:137
ext_cbfn_t cbfn
callback function
Definition: ext.h:142
boolean argel
T:arg is an element, F: attribute.
Definition: ext.h:138
ext_template_t * ext_new_template(void)
Malloc and initialize the fields in a ext_template_t.
Definition: ext.c:134
void ext_init(void)
Init the extension callback handler queue.
Definition: ext.c:419
status_t
global error return code
Definition: status_enum.h:186
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:162
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:370
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
NCX Syntax Token Handler.
Global error messages for status code enumerations.
xmlChar * arg
malloced argument name
Definition: ext.h:135
ncx_error_t tkerr
file and line infor for compiler
Definition: ext.h:141
xmlChar * name
malloced name
Definition: ext.h:132
ncx_node_t
NCX Internal Node Types.
Definition: ncxtypes.h:424
One YANG &#39;extension&#39; definition – language extension template.
Definition: ext.h:130
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:331
XML namespace support.
xmlChar * descr
malloced description-stmt
Definition: ext.h:133
ncx_status_t
enumeration for different YANG data-def status values
Definition: ncxtypes.h:570
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:517
void ext_clean_extensionQ(dlq_hdr_t *que)
Clean a queue of ext_template_t structs.
Definition: ext.c:200