yumapro  20.10-12
YumaPro SDK
YANG Feature Statement
Collaboration diagram for YANG Feature Statement:

Functions

void ncx_feature_init (void)
 Init the ncx_feature module.
 
void ncx_feature_cleanup (void)
 Cleanup the ncx_feature module.
 
ncx_iffeature_t * ncx_new_iffeature (void)
 Get a new ncx_iffeature_t struct. More...
 
void ncx_free_iffeature (ncx_iffeature_t *iff)
 Free a malloced ncx_iffeature_t struct. More...
 
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. More...
 
void ncx_free_iff_ref (ncx_iff_ref_t *iff_ref)
 Free a malloced ncx_iff_ref_t struct. More...
 
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. More...
 
ncx_iffeature_t * ncx_clone_iffeature (ncx_iffeature_t *srciff)
 Clone a new ncx_iffeature_t struct. More...
 
void ncx_clean_iffeatureQ (dlq_hdr_t *iffeatureQ)
 Clean a Q of malloced ncx_iffeature_t struct. More...
 
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. More...
 
ncx_feature_t * ncx_new_feature (void)
 Get a new ncx_feature_t struct. More...
 
void ncx_free_feature (ncx_feature_t *feature)
 Free a malloced ncx_feature_t struct. More...
 
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. More...
 
ncx_feature_t * ncx_find_feature_que (dlq_hdr_t *featureQ, const xmlChar *name)
 Find a ncx_feature_t struct in the specified Q. More...
 
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. More...
 
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. More...
 
uint32 ncx_feature_count (const ncx_module_t *mod, boolean enabledonly)
 Get the total feature count for this module and any submodules. More...
 
boolean ncx_feature_enabled (ncx_feature_t *feature)
 Check if the specified feature and any referenced if-features are enabled. More...
 
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. More...
 
void ncx_set_feature_enable_default (boolean flag)
 Set the feature_enable_default flag. More...
 
void ncx_set_feature_code_default (ncx_feature_code_t code)
 Set the feature_code_default enumeration (deprecated) More...
 
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) More...
 
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. More...
 
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. More...
 
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) More...
 
void ncx_set_feature_parms (ncx_feature_t *feature)
 Check if any feature parameters were set for the specified feature struct. More...
 
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 module. More...
 
ncx_feature_t * ncx_first_feature_from_iff (ncx_iffeature_t *iff)
 Get the feature in the first ncx_iff_ref_t struct. More...
 
status_t yang_feature_consume_iffeature (tk_chain_t *tkc, ncx_module_t *mod, dlq_hdr_t *iffeatureQ, dlq_hdr_t *appinfoQ)
 Consume an if-feature-stmt. More...
 
status_t yang_feature_consume_feature (tk_chain_t *tkc, ncx_module_t *mod)
 Parse the next N tokens as a feature statement. More...
 
status_t yang_feature_resolve_feature (yang_pcb_t *pcb, tk_chain_t *tkc, ncx_module_t *mod, ncx_feature_t *feature)
 Validate all the if-feature clauses present in the specified feature. More...
 
status_t yang_feature_check_feature_loop (tk_chain_t *tkc, ncx_module_t *mod, ncx_feature_t *feature, ncx_feature_t *startfeature)
 Check for a feature loop. More...
 
status_t yang_feature_resolve_iffeatureQ (yang_pcb_t *pcb, tk_chain_t *tkc, ncx_module_t *mod, obj_template_t *obj)
 Check the Q of if-feature statements for the specified object. More...
 
status_t yang_feature_resolve_iffeatureQ2 (yang_pcb_t *pcb, tk_chain_t *tkc, ncx_module_t *mod, dlq_hdr_t *iffeatureQ)
 Check the Q of if-feature statements for the specified object. More...
 
status_t yang_feature_check_iffeature_mismatch (tk_chain_t *tkc, ncx_module_t *mod, obj_template_t *ancestor, obj_template_t *testobj, ncx_iffeature_t *iff, boolean iserror)
 Check the child object against the ancestor node for 1 if-feature. More...
 
boolean yang_feature_eval_iffeature (ncx_module_t *mod, ncx_iffeature_t *iff)
 Evaluate the if-feature expression. More...
 
boolean yang_feature_eval_iffeatureQ (ncx_module_t *mod, dlq_hdr_t *iffQ)
 Evaluate a Q ofif-feature expressions. More...
 

Detailed Description

Support YANG Module parser feature statement

Function Documentation

◆ ncx_clean_iffeatureQ()

void ncx_clean_iffeatureQ ( dlq_hdr_t *  iffeatureQ)

Clean a Q of malloced ncx_iffeature_t struct.

Parameters
iffeatureQaddress of Q of ncx_iffeature_t to clean
Here is the caller graph for this function:

◆ ncx_clone_iffeature()

ncx_iffeature_t* ncx_clone_iffeature ( ncx_iffeature_t *  srciff)

Clone a new ncx_iffeature_t struct.

Parameters
srciffifffeature struct to clone
Returns
pointer to a malloced ncx_iffeature_t struct, or NULL if malloc error
Here is the call graph for this function:

◆ ncx_feature_count()

uint32 ncx_feature_count ( const ncx_module_t *  mod,
boolean  enabledonly 
)

Get the total feature count for this module and any submodules.

Parameters
modmodule to search for features
enabledonlyTRUE to only count enabled features
FALSE to count all features
Returns
total number of features
Here is the call graph for this function:

◆ ncx_feature_enabled()

boolean ncx_feature_enabled ( ncx_feature_t *  feature)

Check if the specified feature and any referenced if-features are enabled.

Parameters
featurefeature to check
Returns
TRUE if feature is completely enabled
FALSE if feature is not enabled, or partially enabled
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ncx_feature_enabled_str()

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.

Parameters
modnamename of module to search
revisionmodule revision string (may be NULL)
namefeature name to find
Returns
TRUE if feature is enabled
Here is the call graph for this function:

◆ ncx_find_feature()

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.

Parameters
modmodule to search
namefeature name to find
Returns
pointer to found feature or NULL if not found
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ncx_find_feature_all()

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.

Parameters
modmodule to search (plus allincQ of submodules
namefeature name to find
Returns
pointer to found feature or NULL if not found
Here is the call graph for this function:

◆ ncx_find_feature_que()

ncx_feature_t* ncx_find_feature_que ( dlq_hdr_t *  featureQ,
const xmlChar *  name 
)

Find a ncx_feature_t struct in the specified Q.

Parameters
featureQQ of ncx_feature_t to search
namefeature name to find
Returns
pointer to found feature or NULL if not found
Here is the caller graph for this function:

◆ ncx_find_iff_ref()

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.

Parameters
iff_refQQ of ncx_iff_ref_t to check
prefixprefix used in identifier-ref-arg (may be NULL)
prefix_lenlength of prefix if it is used
featnamefeature name used in identifier-ref-arg (may be NULL)
Returns
pointer to found entry of NULL if not found or NULL if malloc error

◆ ncx_find_iffeature()

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.

Parameters
iffeatureQaddress of Q of ncx_iffeature_t to search
prefixprefix to check for; a NULL value indicates the current module
namefeature name string to find
modprefixmodule prefix to use
Here is the caller graph for this function:

◆ ncx_first_feature_from_iff()

ncx_feature_t* ncx_first_feature_from_iff ( ncx_iffeature_t *  iff)

Get the feature in the first ncx_iff_ref_t struct.

if_feature record

Parameters
iffiff record to check
Returns
pointer to found feature in the if-feature ref or NULL if none found

◆ ncx_for_all_features()

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.

Parameters
modmodule to search for features
cbfnfeature callback function
cookiecookie value to pass to each iteration of the callback
enabledonlyTRUE if only callbacks for enabled features
FALSE if all features should invoke callbacks
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ncx_free_feature()

void ncx_free_feature ( ncx_feature_t *  feature)

Free a malloced ncx_feature_t struct.

Parameters
featurestruct to free
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ncx_free_iff_ref()

void ncx_free_iff_ref ( ncx_iff_ref_t *  iff_ref)

Free a malloced ncx_iff_ref_t struct.

Parameters
iff_refstruct to free
Here is the caller graph for this function:

◆ ncx_free_iffeature()

void ncx_free_iffeature ( ncx_iffeature_t *  iff)

Free a malloced ncx_iffeature_t struct.

Parameters
iffstruct to free
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ncx_new_feature()

ncx_feature_t* ncx_new_feature ( void  )

Get a new ncx_feature_t struct.

Returns
pointer to a malloced ncx_feature_t struct, or NULL if malloc error
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ncx_new_iff_ref()

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.

Parameters
prefixprefix used in identifier-ref-arg (may be NULL)
prefix_lenlength of prefix if it is used
featnamefeature name used in identifier-ref-arg (may be NULL)
Returns
pointer to a malloced ncx_iff_ref_t struct, or NULL if malloc error
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ncx_new_iffeature()

ncx_iffeature_t* ncx_new_iffeature ( void  )

Get a new ncx_iffeature_t struct.

Returns
pointer to a malloced ncx_iffeature_t struct, or NULL if malloc error
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ncx_set_feature_code_default()

void ncx_set_feature_code_default ( ncx_feature_code_t  code)

Set the feature_code_default enumeration (deprecated)

!!! THIS FUNCTION IS DEPRECATED!!! !!! The –feature-code and –feature-code-default parameters are ignored !!! Feature code generation is not controlled by this parameter

Parameters
codefeature code value

◆ ncx_set_feature_code_entry()

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)

!!! THIS FUNCTION IS DEPRECATED!!! !!! The –feature-code and –feature-code-default parameters are ignored !!! Feature code generation is not controlled by this parameter

Parameters
featstrfeature parameter string
featcodencx_feature_code_t enumeration to set
Returns
status
Here is the call graph for this function:

◆ ncx_set_feature_enable()

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.

Called from SIL init code

Parameters
modnamename of module defining the feature
namefeature name
flagfeature enabled flag
Returns
status
Here is the call graph for this function:

◆ ncx_set_feature_enable_default()

void ncx_set_feature_enable_default ( boolean  flag)

Set the feature_enable_default flag.

Server –feature-enable-default CLI parameter

Parameters
flagfeature enabled flag value

◆ ncx_set_feature_enable_entry()

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.

Called from CLI/conf handler code

Parameters
featstrfeature parameter string
flagenabled flag
Returns
status
Here is the call graph for this function:

◆ ncx_set_feature_enable_ex()

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)

Called from SIL init code

Parameters
modnamename of module defining the feature
namefeature name
flagfeature enabled flag
forceTRUE to override previous setting
Returns
status
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ncx_set_feature_parms()

void ncx_set_feature_parms ( ncx_feature_t *  feature)

Check if any feature parameters were set for the specified feature struct.

Parameters
featurefeature struct to check
Return values
feature->codeand/or feature->enabled may be set
Here is the caller graph for this function:

◆ ncx_set_features_for_mod()

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 module.

Parameters
modmodule to check
Return values
feature->codeand/or feature->enabled may be set
Here is the call graph for this function:

◆ yang_feature_check_feature_loop()

status_t yang_feature_check_feature_loop ( tk_chain_t *  tkc,
ncx_module_t *  mod,
ncx_feature_t *  feature,
ncx_feature_t *  startfeature 
)

Check for a feature loop.

Validate all the if-feature clauses present in the specified feature, after all if-features have been resolved (or at least attempted)

Error messages are printed by this function!! Do not duplicate error messages upon error return

Parameters
tkctoken chain
modncx_module_t in progress
featurencx_feature_t to check now
startfeaturefeature that started this off, so if this is reached again, it will trigger an error
Returns
status of the operation
Here is the call graph for this function:
Here is the caller graph for this function:

◆ yang_feature_check_iffeature_mismatch()

status_t yang_feature_check_iffeature_mismatch ( tk_chain_t *  tkc,
ncx_module_t *  mod,
obj_template_t *  ancestor,
obj_template_t *  testobj,
ncx_iffeature_t *  iff,
boolean  iserror 
)

Check the child object against the ancestor node for 1 if-feature.

Error messages are printed by this function!! Do not duplicate error messages upon error return

Parameters
tkctoken chain
modmodule in progress
ancestorancestor node of child to compare against and stop the check
testobjcurrent object being checked
iffcurrent if-feature record within the testobj to check
iserrorTRUE if checking for key-stmt and mismatch is an error
Returns
status of the operation
Here is the call graph for this function:

◆ yang_feature_consume_feature()

status_t yang_feature_consume_feature ( tk_chain_t *  tkc,
ncx_module_t *  mod 
)

Parse the next N tokens as a feature statement.

Create an ncx_feature_t struct and add it to the module or submodule featureQ

Error messages are printed by this function!! Do not duplicate error messages upon error return

Current token is the 'feature' keyword

Parameters
tkctoken chain
modmodule struct that will get updated
Returns
status of the operation
Here is the call graph for this function:

◆ yang_feature_consume_iffeature()

status_t yang_feature_consume_iffeature ( tk_chain_t *  tkc,
ncx_module_t *  mod,
dlq_hdr_t *  iffeatureQ,
dlq_hdr_t *  appinfoQ 
)

Consume an if-feature-stmt.

(was yang.c:yang_consume_iffeature)

consume one if-feature-stmt into iffeatureQ Parse the if-feature statement

Current token is the 'if-feature' keyword

Error messages are printed by this function!! Do not duplicate error messages upon error return

Parameters
tkctoken chain
modmodule in progress
iffeatureQQ of ncx_iffeature_t to hold the new if-feature
appinfoQqueue to store appinfo (extension usage)
Return values
ncx_iffeature_tmalloced and added to iffeatureQ
ncx_appinfo_tmay have structs added to appinfoQ
Returns
status of the operation

◆ yang_feature_eval_iffeature()

boolean yang_feature_eval_iffeature ( ncx_module_t *  mod,
ncx_iffeature_t *  iff 
)

Evaluate the if-feature expression.

Parameters
modmodule containing the object with the if-feature-stmt MAY BE NULL
iffif-feature record within the node to check
Returns
evaluation result or false if some error
Here is the call graph for this function:

◆ yang_feature_eval_iffeatureQ()

boolean yang_feature_eval_iffeatureQ ( ncx_module_t *  mod,
dlq_hdr_t *  iffQ 
)

Evaluate a Q ofif-feature expressions.

Parameters
modmodule containing the object with the if-feature-stmt
MAY BE NULL
iffQQ of if-feature records within the node to check
Returns
evaluation result or false if some error

◆ yang_feature_resolve_feature()

status_t yang_feature_resolve_feature ( yang_pcb_t *  pcb,
tk_chain_t *  tkc,
ncx_module_t *  mod,
ncx_feature_t *  feature 
)

Validate all the if-feature clauses present in the specified feature.

Error messages are printed by this function!! Do not duplicate error messages upon error return

Parameters
pcbparser control block to use
tkctoken chain
modncx_module_t in progress
featurencx_feature_t to check
Returns
status of the operation
Here is the call graph for this function:

◆ yang_feature_resolve_iffeatureQ()

status_t yang_feature_resolve_iffeatureQ ( yang_pcb_t *  pcb,
tk_chain_t *  tkc,
ncx_module_t *  mod,
obj_template_t *  obj 
)

Check the Q of if-feature statements for the specified object.

Error messages are printed by this function!! Do not duplicate error messages upon error return

Parameters
pcbparser control block
tkctoken chain
modmodule in progress
objobject to check
Returns
status of the operation
Here is the call graph for this function:

◆ yang_feature_resolve_iffeatureQ2()

status_t yang_feature_resolve_iffeatureQ2 ( yang_pcb_t *  pcb,
tk_chain_t *  tkc,
ncx_module_t *  mod,
dlq_hdr_t *  iffeatureQ 
)

Check the Q of if-feature statements for the specified object.

FOR YANG 1.1 ONLY

Error messages are printed by this function!! Do not duplicate error messages upon error return

Parameters
pcbparser control block
tkctoken chain
modmodule in progress
iffeatureQque queue of ncx_iffeature_t to check
Returns
status of the operation