yumapro  20.10-14
YumaPro SDK
ncx_feature.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_feature
13 #define _H_ncx_feature
14 
15 /* FILE: ncx_feature.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_ncxtypes
46 #include "ncxtypes.h"
47 #endif
48 
49 #ifndef _H_tk
50 #include "tk.h"
51 #endif
52 
53 #ifndef _H_typ
54 #include "typ.h"
55 #endif
56 
57 #ifndef _H_val
58 #include "val.h"
59 #endif
60 
61 #ifndef _H_xmlns
62 #include "xmlns.h"
63 #endif
64 
65 #ifndef _H_yang
66 #include "yang.h"
67 #endif
68 
69 #ifdef __cplusplus
70 extern "C" {
71 #endif
72 
73 
74 /********************************************************************
75 * *
76 * C O N S T A N T S *
77 * *
78 *********************************************************************/
79 
80 #define SET_FEAT(F) F |= NCX_FL_FEAT_SET
81 #define CLR_FEAT(F) F &= ~NCX_FL_FEAT_SET
82 #define IS_FEAT_SET(F) (F & NCX_FL_FEAT_SET)
83 
84 #define SET_FEAT_ENA(F) F |= NCX_FL_FEAT_ENABLED
85 #define CLR_FEAT_ENA(F) F &= ~NCX_FL_FEAT_ENABLED
86 #define IS_FEAT_ENA(F) (F & NCX_FL_FEAT_ENABLED)
87 
88 
89 /********************************************************************
90 * *
91 * F U N C T I O N S *
92 * *
93 *********************************************************************/
94 
95 
96 
107 extern void
108  ncx_feature_init (void);
109 
110 
114 extern void
115  ncx_feature_cleanup (void);
116 
117 
124 extern ncx_iffeature_t *
125  ncx_new_iffeature (void);
126 
127 
132 extern void
134 
135 
145 extern ncx_iff_ref_t *
146  ncx_new_iff_ref (const xmlChar *prefix,
147  uint32 prefix_len,
148  const xmlChar *featname);
149 
150 
156 extern void
157  ncx_free_iff_ref (ncx_iff_ref_t *iff_ref);
158 
159 
170 extern ncx_iff_ref_t *
171  ncx_find_iff_ref (dlq_hdr_t *iff_refQ,
172  const xmlChar *prefix,
173  uint32 prefix_len,
174  const xmlChar *featname);
175 
176 
184 extern ncx_iffeature_t *
186 
187 
193 extern void
194  ncx_clean_iffeatureQ (dlq_hdr_t *iffeatureQ);
195 
196 
206 extern ncx_iffeature_t *
207  ncx_find_iffeature (dlq_hdr_t *iffeatureQ,
208  const xmlChar *prefix,
209  const xmlChar *name,
210  const xmlChar *modprefix);
211 
212 
219 extern ncx_feature_t *
220  ncx_new_feature (void);
221 
222 
228 extern void
229  ncx_free_feature (ncx_feature_t *feature);
230 
231 
240 extern ncx_feature_t *
242  const xmlChar *name);
243 
244 
252 extern ncx_feature_t *
253  ncx_find_feature_que (dlq_hdr_t *featureQ,
254  const xmlChar *name);
255 
256 
265 extern ncx_feature_t *
267  const xmlChar *name);
268 
269 
280 extern void
282  ncx_feature_cbfn_t cbfn,
283  void *cookie,
284  boolean enabledonly);
285 
286 
296 extern uint32
297  ncx_feature_count (const ncx_module_t *mod,
298  boolean enabledonly);
299 
300 
309 extern boolean
311 
312 
321 extern boolean
322  ncx_feature_enabled_str (const xmlChar *modname,
323  const xmlChar *revision,
324  const xmlChar *name);
325 
326 
334 extern void
335  ncx_set_feature_enable_default (boolean flag);
336 
337 
347 extern void
349 
350 
363 extern status_t
364  ncx_set_feature_code_entry (const xmlChar *featstr,
365  ncx_feature_code_t featcode);
366 
367 
378 extern status_t
379  ncx_set_feature_enable_entry (const xmlChar *featstr,
380  boolean flag);
381 
382 
394 extern status_t
395  ncx_set_feature_enable (const xmlChar *modname,
396  const xmlChar *name,
397  boolean flag);
398 
399 
412 extern status_t
413  ncx_set_feature_enable_ex (const xmlChar *modname,
414  const xmlChar *name,
415  boolean flag,
416  boolean force);
417 
418 
426 extern void
428 
429 
437 extern void
439 
440 
451 extern ncx_feature_t *
453 
454 
458 #ifdef __cplusplus
459 } /* end extern 'C' */
460 #endif
461 
462 #endif /* _H_ncx_feature */
ncx_iff_ref_t * ncx_new_iff_ref(const xmlChar *prefix, uint32 prefix_len, const xmlChar *featname)
Get a new ncx_iff_ref_t struct.
Definition: ncx_feature.c:515
ncx_iff_ref_t * ncx_find_iff_ref(dlq_hdr_t *iff_refQ, const xmlChar *prefix, uint32 prefix_len, const xmlChar *featname)
Find a ncx_iff_ref_t struct.
Definition: ncx_feature.c:562
void ncx_clean_iffeatureQ(dlq_hdr_t *iffeatureQ)
Clean a Q of malloced ncx_iffeature_t struct.
Definition: ncx_feature.c:720
dlq provides general double-linked list and queue support:
ncx_iffeature_t * ncx_new_iffeature(void)
Get a new ncx_iffeature_t struct.
Definition: ncx_feature.c:455
status_t ncx_set_feature_enable(const xmlChar *modname, const xmlChar *name, boolean flag)
Create or set a feature_entry struct for the specified feature enabled parameter. ...
Definition: ncx_feature.c:1437
YANG Module parser utilities.
ncx_feature_t * ncx_first_feature_from_iff(ncx_iffeature_t *iff)
Get the feature in the first ncx_iff_ref_t struct.
Definition: ncx_feature.c:1596
YANG if-feature entry.
Definition: ncxtypes.h:736
void ncx_free_feature(ncx_feature_t *feature)
Free a malloced ncx_feature_t struct.
Definition: ncx_feature.c:823
void ncx_set_features_for_mod(ncx_module_t *mod)
Check if any feature parameters were set for the specified feature struct for all features in a modul...
Definition: ncx_feature.c:1572
uint32 ncx_feature_count(const ncx_module_t *mod, boolean enabledonly)
Get the total feature count for this module and any submodules.
Definition: ncx_feature.c:1107
void ncx_feature_cleanup(void)
Cleanup the ncx_feature module.
Definition: ncx_feature.c:425
void ncx_free_iff_ref(ncx_iff_ref_t *iff_ref)
Free a malloced ncx_iff_ref_t struct.
Definition: ncx_feature.c:614
ncx_feature_t * ncx_new_feature(void)
Get a new ncx_feature_t struct.
Definition: ncx_feature.c:789
representation of one module or submodule during and after parsing
Definition: ncxtypes.h:900
ncx_feature_t * ncx_find_feature_all(ncx_module_t *mod, const xmlChar *name)
Find a ncx_feature_t struct in the module and perhaps any of its submodules.
Definition: ncx_feature.c:983
boolean(* ncx_feature_cbfn_t)(const ncx_module_t *mod, ncx_feature_t *feature, void *cookie)
user function callback template to traverse all module features for a specified module ...
Definition: ncxtypes.h:1194
status_t ncx_set_feature_code_entry(const xmlChar *featstr, ncx_feature_code_t featcode)
Create or set a feature_entry struct for the specified feature code parameter (deprecated) ...
Definition: ncx_feature.c:1328
Value Node Basic Support.
void ncx_set_feature_code_default(ncx_feature_code_t code)
Set the feature_code_default enumeration (deprecated)
Definition: ncx_feature.c:1304
void ncx_set_feature_parms(ncx_feature_t *feature)
Check if any feature parameters were set for the specified feature struct.
Definition: ncx_feature.c:1526
YANG module data structures Many internal representations of YANG module constructs.
YANG feature entry.
Definition: ncxtypes.h:801
ncx_feature_t * ncx_find_feature_que(dlq_hdr_t *featureQ, const xmlChar *name)
Find a ncx_feature_t struct in the specified Q.
Definition: ncx_feature.c:949
YANG 1.1 identifier-ref-arg that within an if-feature expression.
Definition: ncxtypes.h:720
ncx_feature_t * ncx_find_feature(ncx_module_t *mod, const xmlChar *name)
Find a ncx_feature_t struct in the module and perhaps any of its submodules.
Definition: ncx_feature.c:855
void ncx_free_iffeature(ncx_iffeature_t *iff)
Free a malloced ncx_iffeature_t struct.
Definition: ncx_feature.c:479
void ncx_for_all_features(const ncx_module_t *mod, ncx_feature_cbfn_t cbfn, void *cookie, boolean enabledonly)
Execute a callback function for all features in this module and any submodules.
Definition: ncx_feature.c:1030
status_t
global error return code
Definition: status_enum.h:186
void ncx_set_feature_enable_default(boolean flag)
Set the feature_enable_default flag.
Definition: ncx_feature.c:1285
ncx_iffeature_t * ncx_clone_iffeature(ncx_iffeature_t *srciff)
Clone a new ncx_iffeature_t struct.
Definition: ncx_feature.c:639
NCX Syntax Token Handler.
Parameter Type Handler.
ncx_feature_code_t
Feature code generation type (deprecated)
Definition: ncxtypes.h:773
status_t ncx_set_feature_enable_entry(const xmlChar *featstr, boolean flag)
Create or set a feature_entry struct for the specified feature enabled parameter. ...
Definition: ncx_feature.c:1387
boolean ncx_feature_enabled_str(const xmlChar *modname, const xmlChar *revision, const xmlChar *name)
Find a ncx_feature_t struct and check if it is enabled.
Definition: ncx_feature.c:1255
boolean ncx_feature_enabled(ncx_feature_t *feature)
Check if the specified feature and any referenced if-features are enabled.
Definition: ncx_feature.c:1181
XML namespace support.
status_t ncx_set_feature_enable_ex(const xmlChar *modname, const xmlChar *name, boolean flag, boolean force)
Create or set a feature_entry struct for the specified feature enabled parameter (extended) ...
Definition: ncx_feature.c:1466
ncx_iffeature_t * ncx_find_iffeature(dlq_hdr_t *iffeatureQ, const xmlChar *prefix, const xmlChar *name, const xmlChar *modprefix)
Search a Q of ncx_iffeature_t structs for a match.
Definition: ncx_feature.c:745
void ncx_feature_init(void)
Init the ncx_feature module.
Definition: ncx_feature.c:399