yumapro  20.10-10
YumaPro SDK

XML Message Processing Support. More...

Collaboration diagram for XML:

Functions

boolean agt_top_dispatch_msg (ses_cb_t **ppscb)
 Find the appropriate top node handler and call it. More...
 
status_t agt_val_parse_nc (ses_cb_t *scb, xml_msg_hdr_t *msg, obj_template_t *obj, const xml_node_t *startnode, ncx_data_class_t parentdc, val_value_t *retval)
 Parse NETCONF PDU sub-contents into value fields. More...
 
status_t agt_xml_consume_node (ses_cb_t *scb, xml_node_t *node, ncx_layer_t layer, xml_msg_hdr_t *msghdr)
 Consume an XML node from libxml2. More...
 
status_t agt_xml_consume_node_noeof (ses_cb_t *scb, xml_node_t *node, ncx_layer_t layer, xml_msg_hdr_t *msghdr)
 Consume an XML node from libxml2. More...
 
status_t agt_xml_consume_node_nons (ses_cb_t *scb, xml_node_t *node, ncx_layer_t layer, xml_msg_hdr_t *msghdr)
 Consume an XML node from libxml2. More...
 
status_t agt_xml_consume_node_noadv (ses_cb_t *scb, xml_node_t *node, ncx_layer_t layer, xml_msg_hdr_t *msghdr)
 Consume an XML node from libxml2. More...
 

Detailed Description

XML Message Processing Support.

Uses NCX XML support APIs to process XML messages received from and sent to a session (ses_cb_t).

Function Documentation

boolean agt_top_dispatch_msg ( ses_cb_t **  ppscb)

Find the appropriate top node handler and call it.

Called by the transport manager (through the session manager) when a new message is detected

This function might de-allocate the scb, if it does scb will be set to NULL and TRUE will be returned

Parameters
ppscbsession control block containing the xmlreader set at the start of an incoming message.
Return values
*ppscbis set to NULL if the session was deleted
Returns
TRUE if session was deleted
FALSE if not deleted

Here is the call graph for this function:

Here is the caller graph for this function:

status_t agt_val_parse_nc ( ses_cb_t scb,
xml_msg_hdr_t msg,
obj_template_t obj,
const xml_node_t startnode,
ncx_data_class_t  parentdc,
val_value_t retval 
)

Parse NETCONF PDU sub-contents into value fields.

This module does not enforce complex type completeness. Different subsets of configuration data are permitted in several standard (and any proprietary) RPC methods

Makes sure that only allowed value strings or child nodes (and their values) are entered.

Defaults are not added to any objects Missing objects are not checked

A seperate parsing phase is used to fully validate the input contained in the returned val_value_t struct.

This parsing phase checks that simple types are complete and child members of complex types are valid (but maybe missing or incomplete child nodes.

Note that the NETCONF inlineFilterType will be parsed correctly because it is type 'anyxml'. This type is parsed as a struct, and no validation other well-formed XML is done.

Parameters
scbsession control block
msgincoming RPC message
objobj_template_t for the object to parse
startnodetop node of the parameter to be parsed
parentdcparent data class
For the first call to this function, this will be the data class of a parameter.
retvaladdress of initialized return value
Return values
*retvalwill be filled in
msg->errQmay be appended with new errors
Returns
status

Here is the call graph for this function:

Here is the caller graph for this function:

status_t agt_xml_consume_node ( ses_cb_t scb,
xml_node_t node,
ncx_layer_t  layer,
xml_msg_hdr_t msghdr 
)

Consume an XML node from libxml2.

Parse the next node and return its namespace, type and name The xml_init_node or xml_clean_node API must be called before this function for the node parameter

  • There are 2 types of XML element start nodes
    • empty node (XML_NT_EMPTY)
    • start of a simple or complex type (XML_NT_START)
  • There is one string content node for simpleType content
    • string node (XML_NT_STRING)
  • There is one end node to end both simple and complex types
    • end node (XML_NT_END)
  • If nodetyp==XML_NT_EMPTY, then no further nodes will occur for this element. This node may contain attributes. The naming parameters will all be set.
  • If nodetyp==XML_NT_START, then the caller should examine the schema for that start node.
  • For complex types, the next node is probably another XML_NT_START.
  • For simple types, the next node will be XML_NT_STRING, followed by an XML_NT_END node. This node may contain attributes.
  • The naming parameters will all be set.
  • If the nodetype==XML_NT_STRING, then the simval and simlen fields will be set. There are no attributes or naming parameters for this node type.
  • IF the nodetype==XML_NT_END, then no further nodes for this element will occur. This node should not contain attributes.
  • All of the naming parameters will be set. The xml_endnode_match function should be used to confirm that the XML_NT_START and XML_NT_END nodes are paired correctly.
  • The node pointer for the scb->reader will be advanced before the node is read.
Parameters
scbsession control block containing XmlTextReader
nodepointer to an initialized xml_node_t struct to be filled in
layerprotocol layer of caller (only used if errQ != NULL)
msghdrmsg hdr w/ Q to get any rpc-errors as found
NULL if not used
Return values
*nodexml_node_t struct filled in
*errQmay have errors appended to it
Returns
status of the operation
Try to fail on fatal errors only

Here is the call graph for this function:

Here is the caller graph for this function:

status_t agt_xml_consume_node_noadv ( ses_cb_t scb,
xml_node_t node,
ncx_layer_t  layer,
xml_msg_hdr_t msghdr 
)

Consume an XML node from libxml2.

Consume node but do not advance the node pointer

Parameters
scbsession control block containing XmlTextReader
nodepointer to an initialized xml_node_t struct to be filled in
layerprotocol layer of caller (only used if errQ != NULL)
msghdrmsg hdr w/ Q to get any rpc-errors as found
NULL if not used
Return values
*nodexml_node_t struct filled in
*errQmay have errors appended to it
Returns
status of the operation
Try to fail on fatal errors only
See also
agt_xml_consume_node

Here is the call graph for this function:

status_t agt_xml_consume_node_noeof ( ses_cb_t scb,
xml_node_t node,
ncx_layer_t  layer,
xml_msg_hdr_t msghdr 
)

Consume an XML node from libxml2.

consume node but do not generate an EOF error if seen.

Parameters
scbsession control block containing XmlTextReader
nodepointer to an initialized xml_node_t struct to be filled in
layerprotocol layer of caller (only used if errQ != NULL)
msghdrmsg hdr w/ Q to get any rpc-errors as found
NULL if not used
Return values
*nodexml_node_t struct filled in
*errQmay have errors appended to it
Returns
status of the operation
Try to fail on fatal errors only
See also
agt_xml_consume_node

Here is the call graph for this function:

status_t agt_xml_consume_node_nons ( ses_cb_t scb,
xml_node_t node,
ncx_layer_t  layer,
xml_msg_hdr_t msghdr 
)

Consume an XML node from libxml2.

Consume node but do not generate namespace errors if seen. Needed to process subtree filters properly

Parameters
scbsession control block containing XmlTextReader
nodepointer to an initialized xml_node_t struct to be filled in
layerprotocol layer of caller (only used if errQ != NULL)
msghdrmsg hdr w/ Q to get any rpc-errors as found
NULL if not used
Return values
*nodexml_node_t struct filled in
*errQmay have errors appended to it
Returns
status of the operation
Try to fail on fatal errors only
See also
agt_xml_consume_node

Here is the call graph for this function: