yumapro  24.10-1
YumaPro SDK
Loading...
Searching...
No Matches
Schema Mount Core Functions

Schema Mount Core Functions. More...

Collaboration diagram for Schema Mount Core Functions:

Functions

void sm_init (void)
 Initialize Schema Mount handler. More...
 
void sm_cleanup (void)
 Cleanup Schema Mount handler. More...
 
void sm_dump_rootcb (ncx_sm_rootcb_t *rootcb)
 Print the interesting fields in Root Control block Must be debug for some info, debug4 for full info. More...
 
void sm_show_rootcb (ncx_sm_rootcb_t *rootcb)
 Print the interesting fields in Root Control block for yangcli report capabilities. More...
 
void sm_dump_all_rootcb (void)
 Print the interesting fields in all rootcbs. More...
 
ncx_module_tsm_find_module (ncx_sm_rootcb_t *rootcb, const xmlChar *modname, const xmlChar *revision)
 Find an ncx_module_t in the rootcb->modQ. More...
 
ncx_module_tsm_find_deviation (ncx_sm_rootcb_t *rootcb, const xmlChar *modname, const xmlChar *revision)
 Find an ncx_module_t in the rootcb->devQ;. More...
 
ncx_module_tsm_find_module_allroots (const xmlChar *modname, const xmlChar *revision, boolean withdev)
 Find an ncx_module_t in the any rootcb. More...
 
obj_template_tsm_find_any_object (ncx_sm_rootcb_t *rootcb, const xmlChar *objname)
 Check if an obj_template_t is in any module that matches the object name string. More...
 
obj_template_tsm_first_mounted_obj (ncx_sm_rootcb_t *rootcb, boolean augment_ok)
 Find the first data node. More...
 
obj_template_tsm_next_mounted_obj (obj_template_t *curobj, boolean augment_ok)
 Find the next data node. More...
 
obj_template_tsm_last_mounted_obj (ncx_sm_rootcb_t *rootcb, boolean augment_ok)
 Find the first data node. More...
 
obj_template_tsm_prev_mounted_obj (obj_template_t *curobj, boolean augment_ok)
 Find the previous data node. More...
 
obj_template_tsm_find_child_obj (obj_template_t *obj, const xmlChar *modname, const xmlChar *objname, ncx_name_match_t match_names, boolean alt_names, boolean dataonly, status_t *retres)
 Find the previous data node. More...
 
void sm_setup_cur_rootcb (ncx_sm_rootcb_t *rootcb)
 setup NCX library to use the rootCB for schema mount More...
 
void sm_init_yanglib_cb (ncx_yanglib_cb_t *cb)
 Init a YANG Library control block struct. More...
 
void sm_clean_yanglib_cb (ncx_yanglib_cb_t *cb)
 Clean a YANG Library control block struct. More...
 
void sm_register_yanglib_cbfn (sm_yanglib_cbfn_t cbfn)
 register a yanglib_cb setup callback More...
 
ncx_sm_mpid_tsm_new_mpid (void)
 Malloc and initialize an MPID struct. More...
 
void sm_free_mpid (ncx_sm_mpid_t *mpid)
 free a malloced Mount Point ID control block More...
 
status_t sm_setup_mpid (xml_msg_hdr_t *msg, val_value_t *val, obj_template_t *obj)
 Set Up ancestor keys and yanglib for the current MPI. More...
 
void sm_dump_mpid (const ncx_sm_mpid_t *mpid)
 Dump the contents of a MPID struct if DEBUG. More...
 
ncx_sm_mpid_tsm_clone_mpid (const ncx_sm_mpid_t *mpid, val_value_t *valroot)
 Clone an existing MPID. More...
 
ncx_sm_mpid_tsm_get_mpid_from_msg (rpc_msg_t *msg)
 Get the MPID struct from the message header if set. More...
 
status_t sm_find_mpidval_from_input (val_value_t *chval, val_value_t **mpidval)
 Get the MPID value node from the parsed val_value_t tree prepresenting the ancestors of the action or SM RPC method. More...
 
val_value_tsm_get_mpi_valroot (val_value_t *val)
 Get the current value root value. More...
 
ncx_sm_mpid_tsm_get_ancestor_mpid (val_value_t *val)
 Get the MPID for the specified mounted node. More...
 
status_t sm_patch_notif_keyQ (const ncx_sm_mpid_t *mpid, dlq_hdr_t *keyQ)
 Patch the keyQ for a notification to prepend the SM ancestor keys to the queue. More...
 
ncx_sm_mpid_tsm_get_first_mpid (ncx_sm_rootcb_t *rootcb)
 Get the first MPID struct in the rootcb. More...
 
ncx_sm_mpid_tsm_get_next_mpid (ncx_sm_mpid_t *curmpid)
 Get the next MPID struct in the rootcb. More...
 
status_t sm_activate_mpid (ncx_sm_rootcb_t *rootcb, ncx_sm_mpid_t *mpid)
 Setup a new MPID. More...
 
ncx_sm_rootcb_tsm_search_rootcbs (dlq_hdr_t *searchQ, sm_rootcb_searchfn_t searchfn, void *cookie)
 search all the rootcbs in the specified queue More...
 
ncx_sm_rootcb_tsm_save_rootcb (obj_template_t *obj, const xmlChar *label)
 Set the with_schema_mount value. More...
 
ncx_sm_rootcb_tsm_find_rootcb (const xmlChar *label, const xmlChar *modname)
 Find a Mount Point Control Block Entry in the rootcbQ. More...
 
void sm_free_rootcb (ncx_sm_rootcb_t *rootcb)
 Free a ncx_sm_rootcb_t Control Block record. More...
 
ncx_module_tsm_get_first_module (ncx_sm_rootcb_t *rootcb)
 Get first module from Root Control Block. More...
 
ncx_module_tsm_get_last_module (ncx_sm_rootcb_t *rootcb)
 Get the last module from Root Control Block. More...
 
void sm_clear_all_rootcbs (dlq_hdr_t *saveQ)
 Retrieve all the rootcb entries or clear the rootcbQ. More...
 
ncx_sm_mpid_tsm_val_to_mpid (val_value_t *mpidval, boolean preserve, status_t *res)
 Convert a "mpid" YANG container to an MPID value. More...
 
val_value_tsm_mpid_to_val (ncx_sm_mpid_t *mpid, obj_template_t *mpidobj, boolean preserve, status_t *res)
 Convert a "mpid" struct to a YANG container. More...
 
val_value_tsm_get_first_anckey (const ncx_sm_mpid_t *mpid)
 Get first ancestor key from the MPID. More...
 
val_value_tsm_get_next_anckey (const val_value_t *curkey)
 Get next ancestor key from the MPID. More...
 
ncx_sm_rootcb_tsm_get_rootcb_for_mpid (ncx_sm_mpid_t *mpid)
 Get the rootcb for an MPID. More...
 
uint32 sm_mod_revision_count (xml_msg_hdr_t *msg, ncx_sm_rootcb_t *rootcb, const xmlChar *modname)
 get the module revision count for one rootcb More...
 
uint32 sm_mod_revision_count_allroots (xml_msg_hdr_t *msg, const xmlChar *modname)
 get the module revision count for all rootcbs More...
 
status_t sm_setup_yanglib (ncx_sm_rootcb_t *rootcb)
 Setup the YANG library early because the get-sm-yanglib operation is enabled. More...
 

Detailed Description

Schema Mount Core Functions.

Function Documentation

◆ sm_activate_mpid()

status_t sm_activate_mpid ( ncx_sm_rootcb_t rootcb,
ncx_sm_mpid_t mpid 
)

Setup a new MPID.

  • YANG Library instance for an MPID valroot
  • add to rootcb
Parameters
rootcbroot control block to use
mpidMPID to setup the valroot with the rootcb yanglib
Returns
status
Here is the call graph for this function:

◆ sm_clean_yanglib_cb()

void sm_clean_yanglib_cb ( ncx_yanglib_cb_t cb)

Clean a YANG Library control block struct.

Parameters
cbyanglib control block to clean
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sm_cleanup()

void sm_cleanup ( void  )

Cleanup Schema Mount handler.

Here is the caller graph for this function:

◆ sm_clear_all_rootcbs()

void sm_clear_all_rootcbs ( dlq_hdr_t *  saveQ)

Retrieve all the rootcb entries or clear the rootcbQ.

Used only by yangcli to get the rootcbs while loading the top-level modules or clearing the queue for next use

Parameters
[out]saveQqueue header to retrieve all the entries in the rootcbQ
  • if NULL then any rootcbs will just be deleted
  • Else saveQ filled with any rootcb entries (if not NULL)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sm_clone_mpid()

ncx_sm_mpid_t * sm_clone_mpid ( const ncx_sm_mpid_t mpid,
val_value_t valroot 
)

Clone an existing MPID.

Parameters
mpidMount Point ID control block to clone
valrootvalue node getting this MPID
  • may be NULL
  • back pointer to the valroot not malloced pointer
Returns
clone of mpid must be freed with sm_free_mpid
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sm_dump_all_rootcb()

void sm_dump_all_rootcb ( void  )

Print the interesting fields in all rootcbs.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sm_dump_mpid()

void sm_dump_mpid ( const ncx_sm_mpid_t mpid)

Dump the contents of a MPID struct if DEBUG.

This is an external API that can be used in SIL code

Non-const needed for val_dump_value; not modified

Parameters
mpidMount Point ID control block to dump
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sm_dump_rootcb()

void sm_dump_rootcb ( ncx_sm_rootcb_t rootcb)

Print the interesting fields in Root Control block Must be debug for some info, debug4 for full info.

–log-level=debug or higher

Parameters
rootcbRoot Control Block to output
Here is the caller graph for this function:

◆ sm_find_any_object()

obj_template_t * sm_find_any_object ( ncx_sm_rootcb_t rootcb,
const xmlChar *  objname 
)

Check if an obj_template_t is in any module that matches the object name string.

Parameters
rootcbcontrol block to print
objnameobject name to match
Returns
object pointer if present, NULL otherwise
Here is the call graph for this function:

◆ sm_find_child_obj()

obj_template_t * sm_find_child_obj ( obj_template_t obj,
const xmlChar *  modname,
const xmlChar *  objname,
ncx_name_match_t  match_names,
boolean  alt_names,
boolean  dataonly,
status_t retres 
)

Find the previous data node.

Check if an obj_template_t in in any module that matches a data node

Parameters
objobj_template_t to check
modnamemodule name that defines the obj_template_t
== NULL and first match will be done, and the module ignored (Name instead of QName)
objnameobject name to find
match_namesenum for selected match names mode alt_names == TRUE if alt-name should be checked in addition to the YANG node name == FALSE to check YANG names only
alt_namesTRUE if alt-name should be checked
dataonlyTRUE to check just data nodes FALSE to check all nodes
retresaddress of return status
Returns
pointer to struct if present, NULL otherwise
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sm_find_deviation()

ncx_module_t * sm_find_deviation ( ncx_sm_rootcb_t rootcb,
const xmlChar *  modname,
const xmlChar *  revision 
)

Find an ncx_module_t in the rootcb->devQ;.

rootcb->devQ These are the deviation modules that are already loaded into Mount Point

Parameters
rootcbcontrol block to use
modnamemodule name
revisionmodule revision date
Returns
module pointer if found or NULL if not
Here is the call graph for this function:

◆ sm_find_module()

ncx_module_t * sm_find_module ( ncx_sm_rootcb_t rootcb,
const xmlChar *  modname,
const xmlChar *  revision 
)

Find an ncx_module_t in the rootcb->modQ.

rootcb->modQ These are the modules that are already loaded into Mount Point

Parameters
rootcbcontrol block to use
modnamemodule name
revisionmodule revision date
Returns
module pointer if found or NULL if not
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sm_find_module_allroots()

ncx_module_t * sm_find_module_allroots ( const xmlChar *  modname,
const xmlChar *  revision,
boolean  withdev 
)

Find an ncx_module_t in the any rootcb.

Will return the first match or NULL if no match. Used by YANG Library get-schema operation

Parameters
modnamemodule name
revisionmodule revision date
withdevTRUE to check deviation modules as well
Returns
module pointer if found or NULL if not

◆ sm_find_mpidval_from_input()

status_t sm_find_mpidval_from_input ( val_value_t chval,
val_value_t **  mpidval 
)

Get the MPID value node from the parsed val_value_t tree prepresenting the ancestors of the action or SM RPC method.

Parameters
chvalchild value within the mount point this is expected to be the action value node from the parsed input message but that is not required.
[out]mpidvaladdress of return MPID value node
  • *mpidval return MPID value node
Returns
status
Here is the call graph for this function:

◆ sm_find_rootcb()

ncx_sm_rootcb_t * sm_find_rootcb ( const xmlChar *  label,
const xmlChar *  modname 
)

Find a Mount Point Control Block Entry in the rootcbQ.

Parameters
labellabel name to match
modnamemodule name to match
Returns
Mount Point Control Block Entry if found or NULL if not
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sm_first_mounted_obj()

obj_template_t * sm_first_mounted_obj ( ncx_sm_rootcb_t rootcb,
boolean  augment_ok 
)

Find the first data node.

Check if an obj_template_t in in any module that matches a data node

Parameters
rootcbcontrol block to use
augment_okTRUE to include augment objects
Returns
pointer to struct if present, NULL otherwise
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sm_free_mpid()

void sm_free_mpid ( ncx_sm_mpid_t mpid)

free a malloced Mount Point ID control block

Parameters
mpidMount Point ID control block to free
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sm_free_rootcb()

void sm_free_rootcb ( ncx_sm_rootcb_t rootcb)

Free a ncx_sm_rootcb_t Control Block record.

Parameters
rootcbMount Point Control Block to free
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sm_get_ancestor_mpid()

ncx_sm_mpid_t * sm_get_ancestor_mpid ( val_value_t val)

Get the MPID for the specified mounted node.

This is an API for SIL or SIL-SA callback code

Parameters
valvalue to check
Returns
back-ptr to the MPID fot the MP ancestor or NULL if none or some error
Here is the call graph for this function:

◆ sm_get_first_anckey()

val_value_t * sm_get_first_anckey ( const ncx_sm_mpid_t mpid)

Get first ancestor key from the MPID.

Parameters
mpidMount Point Instance Descriptor to use
Returns
pointer to the first entry or NULL if empty Q
Here is the caller graph for this function:

◆ sm_get_first_module()

ncx_module_t * sm_get_first_module ( ncx_sm_rootcb_t rootcb)

Get first module from Root Control Block.

Parameters
rootcbMount Point Control Block to use
Returns
pointer to the first entry or NULL if empty Q
Here is the caller graph for this function:

◆ sm_get_first_mpid()

ncx_sm_mpid_t * sm_get_first_mpid ( ncx_sm_rootcb_t rootcb)

Get the first MPID struct in the rootcb.

Parameters
rootcbroot control block to check
Returns
pointer to first MPID or NULL if none
Here is the call graph for this function:

◆ sm_get_last_module()

ncx_module_t * sm_get_last_module ( ncx_sm_rootcb_t rootcb)

Get the last module from Root Control Block.

Parameters
rootcbMount Point Control Block to use
Returns
pointer to the last entry or NULL if empty Q
Here is the caller graph for this function:

◆ sm_get_mpi_valroot()

val_value_t * sm_get_mpi_valroot ( val_value_t val)

Get the current value root value.

Get the back-ptr to the Mount Point root value

Parameters
valvalue to check
Returns
back-ptr to the Mount Point root value
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sm_get_mpid_from_msg()

ncx_sm_mpid_t * sm_get_mpid_from_msg ( rpc_msg_t msg)

Get the MPID struct from the message header if set.

This field is set by the server during RPC or action processing so SIL code in schema mounted modules can identify which mount point instance is being used by the client

Parameters
msgRPC msg message header to check
Returns
pointer to the MPID struct if any set

◆ sm_get_next_anckey()

val_value_t * sm_get_next_anckey ( const val_value_t curkey)

Get next ancestor key from the MPID.

Parameters
curkeycurrent kley entry
Returns
pointer to the next entry or NULL if none
Here is the caller graph for this function:

◆ sm_get_next_mpid()

ncx_sm_mpid_t * sm_get_next_mpid ( ncx_sm_mpid_t curmpid)

Get the next MPID struct in the rootcb.

Parameters
curmpidcurrent MPID to get next for
Returns
pointer to next MPID or NULL if none
Here is the call graph for this function:

◆ sm_get_rootcb_for_mpid()

ncx_sm_rootcb_t * sm_get_rootcb_for_mpid ( ncx_sm_mpid_t mpid)

Get the rootcb for an MPID.

Should work on SIL. May not work on SIL-SA

Parameters
mpidMPID to check
Returns
pointer to the rootcb or NULL if cannot be accessed

◆ sm_init()

void sm_init ( void  )

Initialize Schema Mount handler.

Here is the caller graph for this function:

◆ sm_init_yanglib_cb()

void sm_init_yanglib_cb ( ncx_yanglib_cb_t cb)

Init a YANG Library control block struct.

Parameters
cbyanglib control block to init

◆ sm_last_mounted_obj()

obj_template_t * sm_last_mounted_obj ( ncx_sm_rootcb_t rootcb,
boolean  augment_ok 
)

Find the first data node.

Check if an obj_template_t in in any module that matches a data node

Parameters
rootcbcontrol block to use
augment_okTRUE to include augment objects
Returns
pointer to struct if present, NULL otherwise
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sm_mod_revision_count()

uint32 sm_mod_revision_count ( xml_msg_hdr_t msg,
ncx_sm_rootcb_t rootcb,
const xmlChar *  modname 
)

get the module revision count for one rootcb

Support for YANG library get-schema operation

Parameters
msgxml_msg_hdr_t to use
rootcbroot control block to check
modnamemodule name to count all revisions
Returns
count of modules that have this name (exact match)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sm_mod_revision_count_allroots()

uint32 sm_mod_revision_count_allroots ( xml_msg_hdr_t msg,
const xmlChar *  modname 
)

get the module revision count for all rootcbs

Support for YANG library get-schema operation

Parameters
msgxml_msg_hdr_t to use
modnamemodule name to count all revisions
Returns
count of modules that have this name (exact match)
Here is the call graph for this function:

◆ sm_mpid_to_val()

val_value_t * sm_mpid_to_val ( ncx_sm_mpid_t mpid,
obj_template_t mpidobj,
boolean  preserve,
status_t res 
)

Convert a "mpid" struct to a YANG container.

Definition is in yumaworks-sil-sa.yang 'mpid-parm' grouping

    +--rw mpid
          |        |  +--rw module?    string
          |        |  +--rw label?     string
          |        |  +--rw objpath?   string
          |        |  +--rw keys?      <anyxml>
Parameters
mpidstruct to convert
mpidobjobject template for return value
preserveTRUE to steal fields from mpid;
FALSE to preserve mpid
[out]resaddress of return status
  • *res return status
Returns
malloced val_value_t struct; free with val_free_value
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sm_new_mpid()

ncx_sm_mpid_t * sm_new_mpid ( void  )

Malloc and initialize an MPID struct.

Returns
mpid Mount Point ID control block.
Must use sm_free_mpid to clean up.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sm_next_mounted_obj()

obj_template_t * sm_next_mounted_obj ( obj_template_t curobj,
boolean  augment_ok 
)

Find the next data node.

Check if an obj_template_t in in any module that matches a data node

Parameters
curobjnode to find next from
augment_okTRUE to include augment objects
Returns
pointer to struct if present, NULL otherwise
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sm_patch_notif_keyQ()

status_t sm_patch_notif_keyQ ( const ncx_sm_mpid_t mpid,
dlq_hdr_t *  keyQ 
)

Patch the keyQ for a notification to prepend the SM ancestor keys to the queue.

Parameters
mpidMPID to use for ancestor keys
keyQqueue of val_value_t will have ancestor keys prepended to it. They are cloned so val_free_value is required for all added entries to this queue
Returns
status
Here is the call graph for this function:

◆ sm_prev_mounted_obj()

obj_template_t * sm_prev_mounted_obj ( obj_template_t curobj,
boolean  augment_ok 
)

Find the previous data node.

Check if an obj_template_t in in any module that matches a data node

Parameters
curobjnode to find previous from
augment_okTRUE to include augment objects
Returns
pointer to struct if present, NULL otherwise
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sm_register_yanglib_cbfn()

void sm_register_yanglib_cbfn ( sm_yanglib_cbfn_t  cbfn)

register a yanglib_cb setup callback

Parameters
cbfncallback function to register

◆ sm_save_rootcb()

ncx_sm_rootcb_t * sm_save_rootcb ( obj_template_t obj,
const xmlChar *  label 
)

Set the with_schema_mount value.

Save Mount Point Control Block Entry into rootcbQ for lookup

Parameters
objobject template to use
labellabel name of the Mount Point
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sm_search_rootcbs()

ncx_sm_rootcb_t * sm_search_rootcbs ( dlq_hdr_t *  searchQ,
sm_rootcb_searchfn_t  searchfn,
void *  cookie 
)

search all the rootcbs in the specified queue

Parameters
searchQQ of ncx_sm_rootcb_t to search
NULL to use the top-levvel rootcbQ
searchfncallback to invoke for the search
cookiepointer to pass to the callback function
Returns
pointer to 'found' entry'
NULL if no entry flagged as found
Here is the call graph for this function:

◆ sm_setup_cur_rootcb()

void sm_setup_cur_rootcb ( ncx_sm_rootcb_t rootcb)

setup NCX library to use the rootCB for schema mount

Parameters
rootcbschema mount root control block NULL for top level
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sm_setup_mpid()

status_t sm_setup_mpid ( xml_msg_hdr_t msg,
val_value_t val,
obj_template_t obj 
)

Set Up ancestor keys and yanglib for the current MPI.

Parameters
msgXML message header in progress
valcurrent MP value to use
objcurrent MP object to use
Returns
status
Here is the call graph for this function:

◆ sm_setup_yanglib()

status_t sm_setup_yanglib ( ncx_sm_rootcb_t rootcb)

Setup the YANG library early because the get-sm-yanglib operation is enabled.

Parameters
rootcbMount Point to setup YANG library
Returns
status
Here is the caller graph for this function:

◆ sm_show_rootcb()

void sm_show_rootcb ( ncx_sm_rootcb_t rootcb)

Print the interesting fields in Root Control block for yangcli report capabilities.

–log-level=info or higher

Parameters
rootcbRoot Control Block to output

◆ sm_val_to_mpid()

ncx_sm_mpid_t * sm_val_to_mpid ( val_value_t mpidval,
boolean  preserve,
status_t res 
)

Convert a "mpid" YANG container to an MPID value.

Definition is in yumaworks-sil-sa.yang 'mpid-parm' grouping

    +--rw mpid
          |        |  +--rw module?    string
          |        |  +--rw label?     string
          |        |  +--rw objpath?   string
          |        |  +--rw keys?      <anydata>
Parameters
mpidvalvalue node for message 'mpid' container to convert
preserveTRUE to steal fields from mpidval;
FALSE to preserve mpidval
[out]resaddress of return status
  • *res return status
Returns
malloced ncx_sm_mpid_t struct (free with sm_free_mpid)
Here is the call graph for this function:
Here is the caller graph for this function: