yumapro  20.10-14
YumaPro SDK
Message Parsing

YControl message parsing supports XML encoded communications between the main server and a subsystem. More...

Collaboration diagram for Message Parsing:

Functions

status_t ycontrol_val_parse (ses_cb_t *scb, obj_template_t *obj, xml_node_t *startnode, val_value_t *retval)
 parse a value for a YANG type from a NETCONF PDU XML stream More...
 
status_t ycontrol_xml_consume_node (xmlTextReaderPtr reader, xml_node_t *node)
 Consume an XML node from the XmlTextReader. More...
 
status_t ycontrol_xml_consume_node_nons (xmlTextReaderPtr reader, xml_node_t *node)
 consume node but do not generate namespace errors if seen. More...
 
status_t ycontrol_xml_consume_node_noadv (xmlTextReaderPtr reader, xml_node_t *node)
 re-get the current node More...
 
status_t ycontrol_xml_skip_subtree (xmlTextReaderPtr reader, const xml_node_t *startnode)
 Skip the current subtree (due to parse or schema error) More...
 

Detailed Description

YControl message parsing supports XML encoded communications between the main server and a subsystem.

In the future other encodings will be supported. The YANG module yumaworks-ycontrol is used to parse the top-level ycontrol element.

Function Documentation

◆ ycontrol_val_parse()

status_t ycontrol_val_parse ( ses_cb_t scb,
obj_template_t obj,
xml_node_t startnode,
val_value_t retval 
)

parse a value for a YANG type from a NETCONF PDU XML stream

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

A seperate parsing phase is used to 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.

Parameters
scbsession control block
objobj_template_t for the object type to parse
startnodetop node of the parameter to be parsed
retvalval_value_t that should get the results of the parsing
Return values
*retvalwill be filled in
Returns
status
Here is the call graph for this function:

◆ ycontrol_xml_consume_node()

status_t ycontrol_xml_consume_node ( xmlTextReaderPtr  reader,
xml_node_t node 
)

Consume an XML node from the XmlTextReader.

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 reader will be advanced before the node is read.

The reader will be advanced.

Parameters
readerXmlReader already initialized from File, Memory, or whatever
nodepointer to an initialized xml_node_t struct to be filled in
Return values
*nodexml_node_t struct filled in
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:

◆ ycontrol_xml_consume_node_noadv()

status_t ycontrol_xml_consume_node_noadv ( xmlTextReaderPtr  reader,
xml_node_t node 
)

re-get the current node

The reader will not be advanced!

Parameters
readerXmlReader already initialized from File, Memory, or whatever
nodepointer to an initialized xml_node_t struct to be filled in
Return values
*nodexml_node_t struct filled in
Returns
status of the operation
Try to fail on fatal errors only
See also
ycontrol_xml_consume_node
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ycontrol_xml_consume_node_nons()

status_t ycontrol_xml_consume_node_nons ( xmlTextReaderPtr  reader,
xml_node_t node 
)

consume node but do not generate namespace errors if seen.

needed to process subtree filters properly, No namespace error variant.

The reader will be advanced.

Parameters
readerXmlReader already initialized from File, Memory, or whatever
nodepointer to an initialized xml_node_t struct to be filled in
Return values
*nodexml_node_t struct filled in
Returns
status of the operation
Try to fail on fatal errors only
See also
ycontrol_xml_consume_node
Here is the call graph for this function:

◆ ycontrol_xml_skip_subtree()

status_t ycontrol_xml_skip_subtree ( xmlTextReaderPtr  reader,
const xml_node_t startnode 
)

Skip the current subtree (due to parse or schema error)

Already encountered an error, so advance nodes until the matching start-node is reached or a terminating error occurs

  • end of input
  • start depth level reached

The xmlreader state is advanced until the current node is the end node of the specified start node or a fatal error occurs

Parameters
readerXmlReader already initialized from File, Memory, or whatever
startnodexml_node_t of the start node of the sub-tree to skip
Returns
status of the operation
Here is the call graph for this function: