yumapro  20.10-10
YumaPro SDK
YANG Extension Statement (ext_template_t)

Support YANG Module parser extension statement. More...

Collaboration diagram for YANG Extension Statement (ext_template_t):

Data Structures

struct  ext_template_t
 One YANG 'extension' definition – language extension template. More...
 

Typedefs

typedef 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. More...
 

Functions

ext_template_text_new_template (void)
 Malloc and initialize the fields in a ext_template_t. More...
 
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 itself. More...
 
void ext_clean_extensionQ (dlq_hdr_t *que)
 Clean a queue of ext_template_t structs. More...
 
ext_template_text_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. More...
 
ext_template_text_find_extension_que (dlq_hdr_t *extensionQ, const xmlChar *name)
 Find an ext_template_t struct in the specified Q. More...
 
ext_template_text_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. More...
 
void ext_init (void)
 Init the extension callback handler queue. More...
 
void ext_cleanup (void)
 Cleanup the extension callback handler queue. More...
 
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, then last one wins. More...
 
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. More...
 
status_t yang_ext_consume_extension (tk_chain_t *tkc, ncx_module_t *mod)
 Parse the next N tokens as an extension-stmt. More...
 

Detailed Description

Support YANG Module parser extension statement.

Typedef Documentation

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

ext_cbfn_t

Handle the parsing and processing of an external statement using the associated YANG extension statement

This callback is invoked when the external statement is first encountered. The current token is the argument string if any or the identifier token if none. The next token is expected to be a semi-colon or a left brace The callback is expected to parse the closing semi-colon or entire sub-section including starting brace

Parameters
rawpcbparser control block in progress (cast as void *)
modmodule being processed
tkctoken chain of module tokens parse in progress
extextension definition record (allows a handler to process multiple extension types)
cookiecbfn_cookie from the extension 'ext'
argargument string used in the external statement (if any)
node_typetype of node being processed; direct parent statement of the external statement using the extension If NULL, then the parent statement is the module itself, and 'mod' should be used as the 'node' pointer
nodepointer to node indicated by node_type
Returns
status of processing

Function Documentation

void ext_clean_extensionQ ( dlq_hdr_t *  que)

Clean a queue of ext_template_t structs.

Parameters
queQ of ext_template_t data structures to free

Here is the call graph for this function:

void ext_cleanup ( void  )

Cleanup the extension callback handler queue.

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Parameters
modnamemodule name defining the extension
extnameextension name
extextension template to fill in

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Parameters
modmodule to search
namename string to find
Returns
pointer to found entry, or NULL if not found

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Parameters
modmodule to check
namename string to find
Returns
pointer to found entry, or NULL if not found

Here is the call graph for this function:

Here is the caller graph for this function:

ext_template_t* ext_find_extension_que ( dlq_hdr_t *  extensionQ,
const xmlChar *  name 
)

Find an ext_template_t struct in the specified Q.

Parameters
extensionQQ of ext_template_t data structures to search
nameextension name to find
Returns
pointer to found extension or NULL if not found

Here is the call graph for this function:

Here is the caller graph for this function:

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

The struct must be removed from any queue it is in before this function is called.

Parameters
extext_template_t data structure to free

Here is the call graph for this function:

Here is the caller graph for this function:

void ext_init ( void  )

Init the extension callback handler queue.

Here is the call graph for this function:

Here is the caller graph for this function:

ext_template_t* ext_new_template ( void  )

Malloc and initialize the fields in a ext_template_t.

Returns
pointer to the malloced and initialized struct or NULL if an error

Here is the call graph for this function:

Here is the caller graph for this function:

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, then last one wins.

Parameters
modnamemodule name defining the extension
extnameextension name
cbfnpointer to callback function to register
cbfn_cookieoptional cookie to register; will not be freed when the extension is freed Use macro EXT_CBFN_COOKIE(ext) to access from callback; (may be NULL if not used)
Returns
status

Here is the call graph for this function:

Here is the caller graph for this function:

status_t yang_ext_consume_extension ( tk_chain_t tkc,
ncx_module_t mod 
)

Parse the next N tokens as an extension-stmt.

Create an ext_template_t struct and add it to the specified Q

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

Current token is the 'extension' keyword

Parameters
tkctoken chain to parse
modmodule in progress
Returns
status of the operation

Here is the call graph for this function: