yumapro  24.10-2
YumaPro SDK
Loading...
Searching...
No Matches
Protocol Message State

Protocol independent message processessing state. More...

Collaboration diagram for Protocol Message State:

Data Structures

struct  xml_msg_hdr_t
 Common Encoding Message Header No longer XML specific!! Used by JSON and CBOR parsing as well!! Allows common rendering and error handlers. More...
 

Macros

#define XML_MSG_FL_PREFIX   bit0
 xml_msg_hdr_t flags field bit definitions start here if PREFIX set then prefixes will be used for element start and end tags. More...
 
#define XML_MSG_FL_ETAGS   bit1
 indicates that EntityTags (etag attribute) should be generated
 
#define XML_MSG_FL_ETAGS_TEST   bit2
 indicates the ETag test sense 1= if_match, 0= if_none_match
 
#define XML_MSG_FL_TSTAMPS   bit3
 indicates that Last-Modified timestamps (last-modified attribute) should be generated
 
#define XML_MSG_FL_TSTAMPS_TEST   bit4
 indicates the Tstamps test sense 1= modified_since, 0= unmodified_since
 
#define XML_MSG_FL_KEYS   bit5
 indicates that keys-only is selected for the retrieval output
 
#define XML_MSG_FL_PASSED   bit6
 indicates that the last-modified test has passed at least once
 
#define XML_MSG_FL_DELTA   bit7
 indicates that IfModifiedSince and IfUnmodifiedSince filters cause only the changed nodes to be returned More...
 
#define XML_MSG_FL_OWNERS   bit8
 indicates that with-owners attribute should be added to reply for a <get>, <get-config>, <copy-config>
 
#define XML_MSG_FL_GET2   bit9
 indicates that get2 object-based retrieval is active for this reply for a <get>
 
#define XML_MSG_FL_MODTAGS   bit10
 indicates that module-tags were provided in the get or get-config
 
#define XML_MSG_FL_MODTAGS_EMPTY   bit11
 indicates that module-tags were provided and none are valid
 
#define XML_MSG_FL_ANYXML_TRACK   bit12
 indicates anyxml object tracking is in progress
 
#define XML_MSG_USE_PREFIX(M)   ((M)->flags & XML_MSG_FL_PREFIX)
 Set the message flag to use XML prefixes.
 
#define XML_MSG_NO_PREFIX(M)   ((M)->flags &= ~XML_MSG_FL_PREFIX)
 Clear the message flag to use XML prefixes.
 
#define XML_MSG_WITH_ETAGS(M)   ((M)->flags & XML_MSG_FL_ETAGS)
 Check if ETags should be returned.
 
#define XML_MSG_WITH_ETAGS_TEST(M)   ((M)->flags & XML_MSG_FL_ETAGS_TEST)
 Check if ETags Test should be returned.
 
#define XML_MSG_SET_WITH_ETAGS(M)   (M)->flags |= XML_MSG_FL_ETAGS
 Set flag that ETags should be returned.
 
#define XML_MSG_SET_WITH_ETAGS_TEST(M)   (M)->flags |= XML_MSG_FL_ETAGS_TEST
 Set flag that ETags Test should be returned.
 
#define XML_MSG_CLR_WITH_ETAGS_TEST(M)   (M)->flags &= ~XML_MSG_FL_ETAGS_TEST
 Clear flag that ETags Test should be returned.
 
#define XML_MSG_WITH_TSTAMPS(M)   ((M)->flags & XML_MSG_FL_TSTAMPS)
 Check if timestamps should be returned.
 
#define XML_MSG_WITH_TSTAMPS_TEST(M)   ((M)->flags & XML_MSG_FL_TSTAMPS_TEST)
 Check if timestamps Test should be returned.
 
#define XML_MSG_SET_WITH_TSTAMPS(M)   (M)->flags |= XML_MSG_FL_TSTAMPS
 Set flag that timestamps should be returned.
 
#define XML_MSG_SET_WITH_TSTAMPS_TEST(M)   (M)->flags |= XML_MSG_FL_TSTAMPS_TEST
 Set flag that timestamps Test should be returned.
 
#define XML_MSG_CLR_WITH_TSTAMPS_TEST(M)   (M)->flags &= ~XML_MSG_FL_TSTAMPS_TEST
 Clear flag that timestamps Test should be returned.
 
#define XML_MSG_TSTAMPS_PASSED(M)   ((M)->flags & XML_MSG_FL_PASSED)
 Check if timestamps test passed.
 
#define XML_MSG_SET_TSTAMPS_PASSED(M)   (M)->flags |= XML_MSG_FL_PASSED
 Set flag that timestamps test passed.
 
#define XML_MSG_DELTA(M)   ((M)->flags & XML_MSG_FL_DELTA)
 Get delta: Not currently used - enables sub-tree time-filtering.
 
#define XML_MSG_SET_DELTA(M)   (M)->flags |= XML_MSG_FL_DELTA
 Set Delta: Not currently used - enables sub-tree time-filtering.
 
#define XML_MSG_KEYS_ONLY(M)   ((M)->flags & XML_MSG_FL_KEYS)
 Check flag that KEYS-ONLY mode is requested (TBD)
 
#define XML_MSG_SET_KEYS_ONLY(M)   (M)->flags |= XML_MSG_FL_KEYS
 Set flag that that KEYS-ONLY mode is requested (TBD)
 
#define XML_MSG_WITH_OWNERS(M)   ((M)->flags & XML_MSG_FL_OWNERS)
 Check if NDMA owner attributes requested.
 
#define XML_MSG_SET_WITH_OWNERS(M)   (M)->flags |= XML_MSG_FL_OWNERS
 Set flag that NDMA owner attributes requested.
 
#define XML_MSG_CLR_WITH_OWNERS(M)   (M)->flags &= ~XML_MSG_FL_OWNERS
 Clear flag that NDMA owner attributes requested.
 
#define XML_MSG_WITH_GET2(M)   ((M)->flags & XML_MSG_FL_GET2) ? TRUE : FALSE
 Check if GET2 mode requested.
 
#define XML_MSG_SET_WITH_GET2(M)   (M)->flags |= XML_MSG_FL_GET2
 Set flag that GET2 mode requested.
 
#define XML_MSG_CLR_WITH_GET2(M)   (M)->flags &= ~XML_MSG_FL_GET2
 Clear flag that GET2 mode requested.
 
#define XML_MSG_SET_LOOKUPQ(M, Q)   (M)->lookupQ = Q
 Set GET2 lookup entry.
 
#define XML_MSG_SET_MATCHQ(M, Q)   (M)->matchQ = Q
 Set GET2 matchQ entry.
 
#define XML_MSG_SET_SELECTQ(M, Q)   (M)->selectQ = Q
 Set GET2 selectQ entry.
 
#define XML_MSG_ANYXML_TRACK(M)   ((M)->flags & XML_MSG_FL_ANYXML_TRACK)
 Check if anyxml tracking is active.
 
#define XML_MSG_SET_ANYXML_TRACK(M)   (M)->flags |= XML_MSG_FL_ANYXML_TRACK
 Set flag that anyxml tracking is active.
 
#define XML_MSG_CLR_ANYXML_TRACK(M)   (M)->flags &= ~XML_MSG_FL_ANYXML_TRACK
 Clear flag that anyxml tracking is active.
 
#define XML_MSG_ANYXML_OBJ(M)   (M)->anyxml_obj
 Access the anyxml tracking object.
 
#define XML_MSG_GET_ERROR_DATAQ(M)   &(M)->error_dataQ
 Get USER ERROR DATA Q.
 
#define XML_MSG_ACTIONVAL(M)   (M)->actionval
 Get YANG 1.1 action value node.
 
#define XML_MSG_GETBULK(M)   (M)->getbulk_cb
 NETCONF <get-bulk> support.
 
#define XML_MSG_GET2_TARGET(M)   (M)->get2_target
 GET2 request target terminal node.
 
#define XML_MSG_GET2CB(M)   (M)->get2cb
 GET2 control block backptr.
 
#define XML_MSG_WITH_MODTAGS(M)   ((M)->flags & XML_MSG_FL_MODTAGS)
 Check if module-tags filtering requested.
 
#define XML_MSG_SET_WITH_MODTAGS(M)   (M)->flags |= XML_MSG_FL_MODTAGS
 Set flag that module-tags filtering requested.
 
#define XML_MSG_WITH_MODTAGS_EMPTY(M)    ((M)->flags & XML_MSG_FL_MODTAGS_EMPTY)
 Check if empty module-tags set.
 
#define XML_MSG_SET_WITH_MODTAGS_EMPTY(M)    (M)->flags |= XML_MSG_FL_MODTAGS_EMPTY
 Set flag that empty module-tags return set.
 
#define XML_MSG_YPGNMI_GETCB(M)   (M)->gnmi_getcb
 YP-gNMI <get> support.
 
#define XML_MSG_YPGNMI_EDITCB(M)   (M)->gnmi_editcb
 YP-gNMI <set> support.
 
#define XML_MSG_PRUNE_BAD_DATA(M)   (M)->prune_bad_data
 prune bad data
 
#define XML_MSG_XGET_REQ(M)   (M)->xget_request
 <get> for XPath filter
 
#define XML_MSG_ALLINONE_MODE(M)   (M)->all_in_one_mode
 AIO params.
 
#define XML_MSG_LAST_GET2_FILPTR(M)   (M)->get2_filptr
 The last GET2 Filter Pointer; may be used in case there are some AIO nodes still left.
 
#define XML_MSG_GET2CB_ALLINONE(M)   (M)->get2cb
 GET2 control block backptr to be used in AIO mode.
 
#define XML_MSG_NMDA_PARAMS(M)   (M)->nmda_params
 NMDA params.
 
#define XML_MSG_WITH_ORIGIN(M)    ((M)->nmda_params && (M)->nmda_params->with_origin)
 NMDA with-origin requested.
 
#define XML_MSG_EDIT_CONFIG_ROOT(M)   (M)->edit_config_root
 NACM data rule support to test incoming message <config>
 
#define XML_MSG_DEPTH_TARGET(M)   (M)->depth_target
 GET2 depth target for the level 1 node.
 
#define XML_MSG_NMDA_OPERATIONAL(M)
 NMDA <operational> requested.
 
#define XML_MSG_SM_MPID(M)   (M)->sm_mpid
 the schema mount MPID active in the request will be NULL unless WITH_SCHEMA_MOUNT=1 and also ncx_get_sm_active() is true. More...
 
#define XML_MSG_SID_LOWER(M)   (M)->sid_lower
 YANG SID FILTER LOWER BOUND.
 
#define XML_MSG_SID_UPPER(M)   (M)->sid_upper
 YANG SID FILTER UPPER BOUND.
 
#define XML_MSG_SID_SKIP(M)   (M)->sid_skip
 Flag to indicate YANG SID SKIP DATA Mode is active.
 
#define XML_MSG_PARENT_SID(M)   (M)->parent_sid
 Parent SID in Use if next flag is true.
 
#define XML_MSG_ACTION_PARENT(M)   (M)->action_parent
 action_parent is the XPath PCB and result for retrieving the actual datastore or state data representing the ancestors of the action node in the incoming <rpc> message
 
#define XML_MSG_ACTION_PARENT_MODE(M)   (M)->action_parent_mode
 action_parent_mode is TRUE if the XPath request and maybe GET2/AIO requests is for retrieval of the action parent, needed for complex NMDA XPath validation. More...
 
#define XML_MSG_SKIP_EMPTY_NPCON(M)   (M)->skip_empty_npcon
 flag to indicate the empty NP containers should be skipped. More...
 
#define XML_MSG_PRE_PROCESS_MODE(M)   (M)->pre_process_mode
 YPW-2272: pre_process_mode is TRUE if Subtree filter is doing Pre process Selection nodes to see if the server should start to write the parent node or not.
 

Typedefs

typedef void(* xml_msg_val_error_fn_t) (ses_cb_t *scb, xml_msg_hdr_t *mhdr, status_t res, val_value_t *errnode, const xmlChar *badval)
 Record an rpc-error for YANG-API/RESTCONF response translation. More...
 
typedef void(* xml_msg_val_errinfo_fn_t) (ses_cb_t *scb, xml_msg_hdr_t *mhdr, status_t res, val_value_t *errnode, const xmlChar *badval, const ncx_errinfo_t *errinfo)
 Record an rpc-error for YANG-API/RESTCONF response translation Add errinfo struct if present. More...
 
typedef void(* xml_msg_obj_error_fn_t) (ses_cb_t *scb, xml_msg_hdr_t *mhdr, status_t res, struct obj_template_t_ *errobj, const xmlChar *badval)
 Record an rpc-error for YANG-API/RESTCONF response translation. More...
 
typedef boolean(* xml_msg_authfn_t) (xml_msg_hdr_t *msg, const xmlChar *username, const val_value_t *val)
 read authorization callback template More...
 
typedef void(* xml_msg_record_error_fn_t) (ses_cb_t *scb, xml_msg_hdr_t *mhdr, ncx_layer_t layer, status_t res, const xml_node_t *xmlnode, ncx_node_t parmtyp, const void *error_info, ncx_node_t nodetyp, void *error_path)
 Generate an rpc_err_rec_t and save it in the msg. More...
 
typedef void(* xml_msg_record_error_errinfo_fn_t) (ses_cb_t *scb, xml_msg_hdr_t *msghdr, ncx_layer_t layer, status_t res, const xml_node_t *xmlnode, ncx_node_t parmtyp, const void *error_info, ncx_node_t nodetyp, void *error_path, const ncx_errinfo_t *errinfo)
 Generate an rpc_err_rec_t and save it in the msg Use the provided error info record for <rpc-error> fields. More...
 
typedef void(* xml_msg_record_attr_error_fn_t) (ses_cb_t *scb, xml_msg_hdr_t *msghdr, ncx_layer_t layer, status_t res, const xml_attr_t *xmlattr, const xml_node_t *xmlnode, const xmlChar *badns, ncx_node_t nodetyp, void *errnode)
 Generate an rpc_err_rec_t and save it in the msg. More...
 

Functions

void xml_msg_init_hdr (xml_msg_hdr_t *msg)
 Initialize a new xml_msg_hdr_t struct. More...
 
void xml_msg_clean_hdr (xml_msg_hdr_t *msg)
 Clean all the memory used by the specified xml_msg_hdr_t but do not free the struct itself. More...
 
const xmlChar * xml_msg_get_prefix (xml_msg_hdr_t *msg, xmlns_id_t parent_nsid, xmlns_id_t nsid, val_value_t *curelem, boolean *xneeded)
 Find the namespace prefix for the specified namespace ID If it is not there then create one. More...
 
const xmlChar * xml_msg_get_prefix_xpath (xml_msg_hdr_t *msg, xmlns_id_t nsid)
 Get the module prefix for XPath. More...
 
const xmlChar * xml_msg_get_prefix_start_tag (xml_msg_hdr_t *msg, xmlns_id_t nsid)
 Find the namespace prefix for the specified namespace ID. More...
 
status_t xml_msg_gen_new_prefix (xml_msg_hdr_t *msg, xmlns_id_t nsid, xmlChar **retbuff, uint32 buffsize)
 Generate a new namespace prefix. More...
 
status_t xml_msg_build_prefix_map (xml_msg_hdr_t *msg, xml_attrs_t *attrs, boolean addncid, boolean addncxid)
 Build a queue of xmlns_pmap_t records for the current message. More...
 
status_t xml_msg_finish_prefix_map (xml_msg_hdr_t *msg, xml_attrs_t *attrs)
 Finish the queue of xmlns_pmap_t records for the current message. More...
 
status_t xml_msg_check_xmlns_attr (xml_msg_hdr_t *msg, xmlns_id_t nsid, const xmlChar *badns, xml_attrs_t *attrs)
 Check the default NS and the prefix map in the msg;. More...
 
status_t xml_msg_gen_xmlns_attrs (xml_msg_hdr_t *msg, xml_attrs_t *attrs, boolean addncx)
 Generate any xmlns directives in the top-level attribute Q. More...
 
status_t xml_msg_clean_defns_attr (xml_attrs_t *attrs)
 Get rid of an xmlns=foo default attribute. More...
 
status_t xml_msg_add_ncid_to_prefix_map (xml_msg_hdr_t *msg, xml_attrs_t *attrs, xmlns_id_t ncid)
 Add an ncid or ncxid to a prefix map. More...
 
void xml_msg_init (void)
 Init this module. More...
 
void xml_msg_cleanup (void)
 Cleanup this module. More...
 
void xml_msg_set_cfgid (xml_msg_hdr_t *msg, ncx_cfg_t cfgid)
 Set the config ID in the message. More...
 
ncx_cfg_t xml_msg_get_cfgid (xml_msg_hdr_t *msg, boolean *isvalid)
 Set the config ID in the message. More...
 
uint32 xml_msg_get_msgid (xml_msg_hdr_t *msg)
 Get the message sequence ID in the message. More...
 
ncx_withdefaults_t xml_msg_get_withdef (xml_msg_hdr_t *msg)
 Get the message withdef enum. More...
 
void xml_msg_set_withdef (xml_msg_hdr_t *msg, ncx_withdefaults_t withdef)
 Set the message withdef enum. More...
 
uint32 xml_msg_get_max_depth (xml_msg_hdr_t *msg)
 Get the message max_depth value. More...
 
void xml_msg_set_max_depth (xml_msg_hdr_t *msg, uint32 max_depth)
 Set the message max_depth value. More...
 
uint32 xml_msg_get_start_depth (xml_msg_hdr_t *msg)
 Get the message start_depth value. More...
 
void xml_msg_set_start_depth (xml_msg_hdr_t *msg, uint32 start_depth)
 Set the message start_depth value. More...
 
uint32 xml_msg_get_cur_depth (xml_msg_hdr_t *msg)
 Get the message cur_depth value. More...
 
void xml_msg_set_cur_depth (xml_msg_hdr_t *msg, uint32 cur_depth)
 Set the message cur_depth value. More...
 
ncx_display_mode_t xml_msg_get_encoding (xml_msg_hdr_t *msg, boolean is_output)
 Get the message encoding value. More...
 
void xml_msg_set_encoding (xml_msg_hdr_t *msg, boolean is_output, ncx_display_mode_t encoding)
 Set the message encoding value. More...
 
ncx_etag_t xml_msg_get_etag (xml_msg_hdr_t *msg, boolean *test)
 Get the message etag match value and test sense. More...
 
void xml_msg_set_etag (xml_msg_hdr_t *msg, ncx_etag_t etag, boolean test_sense)
 Set the etag match parameters. More...
 
time_t xml_msg_get_tstamp (xml_msg_hdr_t *msg, boolean *test)
 Get the message timestamp match value and test sense. More...
 
void xml_msg_set_tstamp (xml_msg_hdr_t *msg, time_t tstamp, boolean test_sense)
 Set the timestamp match parameters. More...
 
dlq_hdr_t * xml_msg_get_lookupQ (xml_msg_hdr_t *msg)
 Get the GET2 lookup Queue. More...
 
dlq_hdr_t * xml_msg_get_matchQ (xml_msg_hdr_t *msg)
 Get the GET2 match Queue. More...
 
dlq_hdr_t * xml_msg_get_selectQ (xml_msg_hdr_t *msg)
 Get the GET2 select Queue. More...
 
void xml_msg_inc_cur_depth (xml_msg_hdr_t *mhdr)
 Increment the cur_depth parameter if needed. More...
 
void xml_msg_dec_cur_depth (xml_msg_hdr_t *mhdr)
 Decrement the cur_depth parameter if needed. More...
 
boolean xml_msg_test_max_depth (xml_msg_hdr_t *mhdr, const struct obj_template_t_ *obj)
 Test the max_depth parameter if needed. More...
 
void xml_msg_save_filptr (xml_msg_hdr_t *msg, ncx_filptr_t *filptr)
 Store current message subtree filter in the Queue for later cleanup. More...
 
status_t xml_msg_set_with_origin (xml_msg_hdr_t *mhdr)
 Set the with-origin parameter to true. More...
 

Detailed Description

Protocol independent message processessing state.

No longer XML only

Deals with generic namespace and xmlns optimization and tries to keep changing the default namespace so most nested elements do not have prefixes.

Deals with the NETCONF requirement that the attributes in <rpc> are returned in <rpc-reply> unchanged. Although XML allows the xnmlns prefixes to change, the same prefixes are used in the <rpc-reply> that the NMS provided in the <rpc>.

NOTE: The xml_msg_hst_t strust is used for both XML and JSON encoding It is no longer XML-specific!!!

Macro Definition Documentation

◆ XML_MSG_ACTION_PARENT_MODE

#define XML_MSG_ACTION_PARENT_MODE (   M)    (M)->action_parent_mode

action_parent_mode is TRUE if the XPath request and maybe GET2/AIO requests is for retrieval of the action parent, needed for complex NMDA XPath validation.

Must make sure that default NP containers are added in this mode. They can be ignored for client retrieval operations but not for NMDA action parent validation

◆ XML_MSG_FL_DELTA

#define XML_MSG_FL_DELTA   bit7

indicates that IfModifiedSince and IfUnmodifiedSince filters cause only the changed nodes to be returned

     1 == return just the descendant nodes that match the filter
     0 == return all descendant nodes

◆ XML_MSG_FL_PREFIX

#define XML_MSG_FL_PREFIX   bit0

xml_msg_hdr_t flags field bit definitions start here if PREFIX set then prefixes will be used for element start and end tags.

FALSE then default NS will be used so no prefixes will be needed except for XML content with QNames

◆ XML_MSG_SKIP_EMPTY_NPCON

#define XML_MSG_SKIP_EMPTY_NPCON (   M)    (M)->skip_empty_npcon

flag to indicate the empty NP containers should be skipped.

This should only be done on the RPC reply to the client, not YControl messages. Cannot be set to true on subsystems

◆ XML_MSG_SM_MPID

#define XML_MSG_SM_MPID (   M)    (M)->sm_mpid

the schema mount MPID active in the request will be NULL unless WITH_SCHEMA_MOUNT=1 and also ncx_get_sm_active() is true.

Will be present for mounted RPC and action requests

Typedef Documentation

◆ xml_msg_authfn_t

typedef boolean(* xml_msg_authfn_t) (xml_msg_hdr_t *msg, const xmlChar *username, const val_value_t *val)

read authorization callback template

Parameters
msgmessage header to use
usernamename of the user to check for ccess rights
valvalue to check for authorization
Returns
TRUE if access granted; FALSE otherwise

◆ xml_msg_obj_error_fn_t

typedef void(* xml_msg_obj_error_fn_t) (ses_cb_t *scb, xml_msg_hdr_t *mhdr, status_t res, struct obj_template_t_ *errobj, const xmlChar *badval)

Record an rpc-error for YANG-API/RESTCONF response translation.

Parameters
scbsession control block to use
mhdrmessage header to use
reserror status code
errobjobject node in API schema tree or data schema tree associated with the error
badvalerror-info node to use

◆ xml_msg_record_attr_error_fn_t

typedef void(* xml_msg_record_attr_error_fn_t) (ses_cb_t *scb, xml_msg_hdr_t *msghdr, ncx_layer_t layer, status_t res, const xml_attr_t *xmlattr, const xml_node_t *xmlnode, const xmlChar *badns, ncx_node_t nodetyp, void *errnode)

Generate an rpc_err_rec_t and save it in the msg.

INPUTS:

Parameters
scbsession control block
NULL and no stats will be recorded
msghdrXML msg header with error Q
NULL, no errors will be recorded!
layernetconf layer error occured <error-type>
resinternal error code <error-app-tag>
xmlattrXML attribute node causing error
(NULL if not available)
xmlnodeXML node containing the attr
badnsbad namespace string value
nodetyptype of node in 'error_path'
errnodeinternal data node with the error
NULL if not used

◆ xml_msg_record_error_errinfo_fn_t

typedef void(* xml_msg_record_error_errinfo_fn_t) (ses_cb_t *scb, xml_msg_hdr_t *msghdr, ncx_layer_t layer, status_t res, const xml_node_t *xmlnode, ncx_node_t parmtyp, const void *error_info, ncx_node_t nodetyp, void *error_path, const ncx_errinfo_t *errinfo)

Generate an rpc_err_rec_t and save it in the msg Use the provided error info record for <rpc-error> fields.

Parameters
scbsession control block
NULL and no stats will be recorded
msghdrXML msg header with error Q
NULL, no errors will be recorded!
layernetconf layer error occured <error-type>
resinternal error code <error-app-tag>
xmlnodeXML node causing error <bad-element> <error-path>
NULL if not available
parmtyptype of node in 'error_info'
error_infoerror data, specific to 'res' <error-info>
NULL if not available (then nodetyp ignored)
nodetyptype of node in 'error_path'
error_pathinternal data node with the error <error-path>
NULL if not available or not used
errinfoerror info record to use

◆ xml_msg_record_error_fn_t

typedef void(* xml_msg_record_error_fn_t) (ses_cb_t *scb, xml_msg_hdr_t *mhdr, ncx_layer_t layer, status_t res, const xml_node_t *xmlnode, ncx_node_t parmtyp, const void *error_info, ncx_node_t nodetyp, void *error_path)

Generate an rpc_err_rec_t and save it in the msg.

Parameters
scbsession control block
NULL and no stats will be recorded
[in,out]mhdrXML msg header with error Q
NULL, no errors will be recorded!
layernetconf layer error occured <error-type>
resinternal error code <error-app-tag>
xmlnodeXML node causing error <bad-element> <error-path>
NULL if not available
parmtyptype of node in 'error_info'
error_infoerror data, specific to 'res' <error-info>
NULL if not available (then nodetyp ignored)
nodetyptype of node in 'error_path'
error_pathinternal data node with the error <error-path>
NULL if not available or not used

◆ xml_msg_val_errinfo_fn_t

typedef void(* xml_msg_val_errinfo_fn_t) (ses_cb_t *scb, xml_msg_hdr_t *mhdr, status_t res, val_value_t *errnode, const xmlChar *badval, const ncx_errinfo_t *errinfo)

Record an rpc-error for YANG-API/RESTCONF response translation Add errinfo struct if present.

INPUTS:

Parameters
scbsession control block to use
mhdrxml_msg_hdr_t to use
reserror status code
errnodenode in API tree or data tree associated with the error
badvalerror-info string to use
errinfoncx_errinfo_t struct to use

◆ xml_msg_val_error_fn_t

typedef void(* xml_msg_val_error_fn_t) (ses_cb_t *scb, xml_msg_hdr_t *mhdr, status_t res, val_value_t *errnode, const xmlChar *badval)

Record an rpc-error for YANG-API/RESTCONF response translation.

Parameters
scbsession control block to use
mhdrxml_msg_hdr_t to use
reserror status code
errnodenode in API tree or data tree associated with the error
badvalerror-info string to use

Function Documentation

◆ xml_msg_add_ncid_to_prefix_map()

status_t xml_msg_add_ncid_to_prefix_map ( xml_msg_hdr_t msg,
xml_attrs_t attrs,
xmlns_id_t  ncid 
)

Add an ncid or ncxid to a prefix map.

Parameters
msgthe message in progrss
attrsthe the top-level attrs list (e;g, rpc_in_attrs)
ncidthe ncid to add.
Returns
status
Here is the call graph for this function:
Here is the caller graph for this function:

◆ xml_msg_build_prefix_map()

status_t xml_msg_build_prefix_map ( xml_msg_hdr_t msg,
xml_attrs_t attrs,
boolean  addncid,
boolean  addncxid 
)

Build a queue of xmlns_pmap_t records for the current message.

XMLNS Entries for NETCONF and NCX will be added if they are not present

Parameters
[in,out]msgmessage in progress
  • msg->prefixQ will be populated as needed, could be partially populated if some error returned
attrsthe top-level attrs list (e;g, rpc_in_attrs)
addncidTRUE if a prefix entry for the NC namespace should be added
FALSE if the NC nsid should not be added
addncxidTRUE if a prefix entry for the NCX namespace should be added
FALSE if the NCX nsid should not be added
Returns
status
Here is the call graph for this function:
Here is the caller graph for this function:

◆ xml_msg_check_xmlns_attr()

status_t xml_msg_check_xmlns_attr ( xml_msg_hdr_t msg,
xmlns_id_t  nsid,
const xmlChar *  badns,
xml_attrs_t attrs 
)

Check the default NS and the prefix map in the msg;.

XMLNS attr entry may be added to the attrs Q

Parameters
[in,out]msgmessage in progress
  • msg->prefixQ will be populated as needed, could be partially populated if some error returned
nsidnamespace ID to check
badnsnamespace URI of the bad namespace used if the nsid is the INVALID marker
attrsQ to hold the xml_attr_t, if generated
Returns
status
Here is the call graph for this function:

◆ xml_msg_clean_defns_attr()

status_t xml_msg_clean_defns_attr ( xml_attrs_t attrs)

Get rid of an xmlns=foo default attribute.

Parameters
[in,out]attrsxmlns_attrs_t Q to process
  • *attrs will be cleaned as needed,
Returns
status
Here is the call graph for this function:

◆ xml_msg_clean_hdr()

void xml_msg_clean_hdr ( xml_msg_hdr_t msg)

Clean all the memory used by the specified xml_msg_hdr_t but do not free the struct itself.

Do NOT reuse this header without calling xml_msg_init_hdr first!!! xml_msg_t headers were originally meant to be used only in other messages, but <hello> messages use the hdr without a wrapper message

Parameters
msgxml_msg_hdr_t to clean
Here is the call graph for this function:
Here is the caller graph for this function:

◆ xml_msg_cleanup()

void xml_msg_cleanup ( void  )

Cleanup this module.

Here is the caller graph for this function:

◆ xml_msg_dec_cur_depth()

void xml_msg_dec_cur_depth ( xml_msg_hdr_t mhdr)

Decrement the cur_depth parameter if needed.

Parameters
mhdrmessage header to change
Here is the call graph for this function:
Here is the caller graph for this function:

◆ xml_msg_finish_prefix_map()

status_t xml_msg_finish_prefix_map ( xml_msg_hdr_t msg,
xml_attrs_t attrs 
)

Finish the queue of xmlns_pmap_t records for the current message.

Parameters
[in,out]msgmessage in progrss
  • msg->prefixQ will be populated as needed, could be partially populated if some error returned
attrsthe top-level attrs list (e;g, rpc_in_attrs)
Returns
status

/param msg message in progrss /param attrs the top-level attrs list (e;g, rpc_in_attrs)

/return status of operation

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

◆ xml_msg_gen_new_prefix()

status_t xml_msg_gen_new_prefix ( xml_msg_hdr_t msg,
xmlns_id_t  nsid,
xmlChar **  retbuff,
uint32  buffsize 
)

Generate a new namespace prefix.

Parameters
msgmessage to search and generate a prefix for
nsidnamespace ID to generate prefix for
[out]retbuffaddress of return buffer
  • if *retbuff is NULL it will be created
  • *retbuff is filled in with the new prefix if NO_ERR
buffsizebuffer size
Returns
status
Here is the call graph for this function:
Here is the caller graph for this function:

◆ xml_msg_gen_xmlns_attrs()

status_t xml_msg_gen_xmlns_attrs ( xml_msg_hdr_t msg,
xml_attrs_t attrs,
boolean  addncx 
)

Generate any xmlns directives in the top-level attribute Q.

Parameters
msgmessage in progress
[in,out]attrsxmlns_attrs_t Q to process
  • *attrs will be populated as needed,
addncxTRUE if an xmlns for the NCX prefix (for errors) should be added to the <rpc-reply> element
FALSE if not
Returns
status
Here is the call graph for this function:
Here is the caller graph for this function:

◆ xml_msg_get_cfgid()

ncx_cfg_t xml_msg_get_cfgid ( xml_msg_hdr_t msg,
boolean *  isvalid 
)

Set the config ID in the message.

Parameters
msgmessage header to change
[out]isvalidaddress of return valus is valid flag
  • *isvalid TRUE if it has been set; FALSE otherwise
Returns
config ID (ignore if *isvalid is FALSE)

◆ xml_msg_get_cur_depth()

uint32 xml_msg_get_cur_depth ( xml_msg_hdr_t msg)

Get the message cur_depth value.

Parameters
msgmessage header to use
Returns
cur_depth value
Here is the caller graph for this function:

◆ xml_msg_get_encoding()

ncx_display_mode_t xml_msg_get_encoding ( xml_msg_hdr_t msg,
boolean  is_output 
)

Get the message encoding value.

Parameters
msgmessage header to check
is_outputTRUE to get output encoding
FALSE to get input encoding
Returns
encoding enumeration

◆ xml_msg_get_etag()

ncx_etag_t xml_msg_get_etag ( xml_msg_hdr_t msg,
boolean *  test 
)

Get the message etag match value and test sense.

Parameters
msgmessage header to check
[out]testaddress of return test sense flag
  • *test TRUE for If-Match; FALSE for If-None-Match
Returns
etag value to match

◆ xml_msg_get_lookupQ()

dlq_hdr_t * xml_msg_get_lookupQ ( xml_msg_hdr_t msg)

Get the GET2 lookup Queue.

Parameters
msgmessage header to use
Returns
pointer to lookupQ or NULL if not set
Here is the caller graph for this function:

◆ xml_msg_get_matchQ()

dlq_hdr_t * xml_msg_get_matchQ ( xml_msg_hdr_t msg)

Get the GET2 match Queue.

Parameters
msgmessage header to use
Returns
pointer to matchQ or NULL if not set

◆ xml_msg_get_max_depth()

uint32 xml_msg_get_max_depth ( xml_msg_hdr_t msg)

Get the message max_depth value.

Parameters
msgmessage header to use
Returns
maxdepth value
Here is the caller graph for this function:

◆ xml_msg_get_msgid()

uint32 xml_msg_get_msgid ( xml_msg_hdr_t msg)

Get the message sequence ID in the message.

Parameters
msgmessage header to use
Returns
message ID

◆ xml_msg_get_prefix()

const xmlChar * xml_msg_get_prefix ( xml_msg_hdr_t msg,
xmlns_id_t  parent_nsid,
xmlns_id_t  nsid,
val_value_t curelem,
boolean *  xneeded 
)

Find the namespace prefix for the specified namespace ID If it is not there then create one.

Parameters
msgmessage to search
parent_nsidparent namespace ID
nsidnamespace ID to find
curelemvalue node for current element if available
[out]xneededpointer to xmlns needed flag output value
  • *xneeded TRUE if the prefix is new and an xmlns decl is needed in the element being generated
Returns
pointer to prefix if found, else NULL if not found
Here is the call graph for this function:
Here is the caller graph for this function:

◆ xml_msg_get_prefix_start_tag()

const xmlChar * xml_msg_get_prefix_start_tag ( xml_msg_hdr_t msg,
xmlns_id_t  nsid 
)

Find the namespace prefix for the specified namespace ID.

DO NOT CREATE A NEW PREFIX MAP IF IT IS NOT THERE does not create any pfixmap, just returns NULL if not found

Parameters
msgmessage to search
nsidnamespace ID to find
Returns
pointer to prefix if found, else NULL if not found

◆ xml_msg_get_prefix_xpath()

const xmlChar * xml_msg_get_prefix_xpath ( xml_msg_hdr_t msg,
xmlns_id_t  nsid 
)

Get the module prefix for XPath.

Find the namespace prefix for the specified namespace ID If it is not there then create one in the msg prefix map Always returns a prefix, instead of using a default

creates a new pfixmap if needed

  !!! MUST BE CALLED BEFORE THE <rpc-reply> XML OUTPUT
  !!! HAS BEGUN.  CANNOT BE CALLED BY OUTPUT FUNCTIONS
  !!! DURING THE <get> OR <get-config> OUTPUT GENERATION
Parameters
msgmessage to search
nsidnamespace ID to find
Returns
pointer to prefix if found, else NULL if not found
Here is the call graph for this function:

◆ xml_msg_get_selectQ()

dlq_hdr_t * xml_msg_get_selectQ ( xml_msg_hdr_t msg)

Get the GET2 select Queue.

Parameters
msgmessage header to use
Returns
pointer to selectQ or NULL if not set

◆ xml_msg_get_start_depth()

uint32 xml_msg_get_start_depth ( xml_msg_hdr_t msg)

Get the message start_depth value.

Parameters
msgmessage header to use
Returns
start-depth value derived from request target URI
Here is the caller graph for this function:

◆ xml_msg_get_tstamp()

time_t xml_msg_get_tstamp ( xml_msg_hdr_t msg,
boolean *  test 
)

Get the message timestamp match value and test sense.

Parameters
msgmessage header to check
[out]testaddress of return test sense flag
  • *test == TRUE for If-Modified-Since
  • *test == FALSE for If-Unmodified-Since
Returns
timestamp value to match

◆ xml_msg_get_withdef()

ncx_withdefaults_t xml_msg_get_withdef ( xml_msg_hdr_t msg)

Get the message withdef enum.

Parameters
msgmessage header to use
Returns
with defaults value in the message header
Here is the caller graph for this function:

◆ xml_msg_inc_cur_depth()

void xml_msg_inc_cur_depth ( xml_msg_hdr_t mhdr)

Increment the cur_depth parameter if needed.

Parameters
mhdrmessage header to change
Here is the call graph for this function:
Here is the caller graph for this function:

◆ xml_msg_init()

void xml_msg_init ( void  )

Init this module.

Here is the caller graph for this function:

◆ xml_msg_init_hdr()

void xml_msg_init_hdr ( xml_msg_hdr_t msg)

Initialize a new xml_msg_hdr_t struct.

Parameters
msgxml_msg_hdr_t memory to initialize
Here is the call graph for this function:
Here is the caller graph for this function:

◆ xml_msg_save_filptr()

void xml_msg_save_filptr ( xml_msg_hdr_t msg,
ncx_filptr_t filptr 
)

Store current message subtree filter in the Queue for later cleanup.

Get2 may try to access some of the fields from this structure

GET2 will run multiple invoke_get2 callbacks which will try to use this filptr.

Parameters
msgmessage to use
filptrfilter pointer to add
Here is the call graph for this function:
Here is the caller graph for this function:

◆ xml_msg_set_cfgid()

void xml_msg_set_cfgid ( xml_msg_hdr_t msg,
ncx_cfg_t  cfgid 
)

Set the config ID in the message.

Parameters
msgmessage header to change
cfgidconfiguration ID to use

◆ xml_msg_set_cur_depth()

void xml_msg_set_cur_depth ( xml_msg_hdr_t msg,
uint32  cur_depth 
)

Set the message cur_depth value.

Parameters
msgmessage header to set
cur_depthnew depth value
Here is the caller graph for this function:

◆ xml_msg_set_encoding()

void xml_msg_set_encoding ( xml_msg_hdr_t msg,
boolean  is_output,
ncx_display_mode_t  encoding 
)

Set the message encoding value.

INPUTS:

Parameters
msgmessage header to check
is_outputTRUE to set output encoding
FALSE to set input encoding
encodingnew encoding value
Here is the caller graph for this function:

◆ xml_msg_set_etag()

void xml_msg_set_etag ( xml_msg_hdr_t msg,
ncx_etag_t  etag,
boolean  test_sense 
)

Set the etag match parameters.

Parameters
msgmessage header to set
etagetag to match
test_senseTRUE to match, FALSE for none-match
Here is the caller graph for this function:

◆ xml_msg_set_max_depth()

void xml_msg_set_max_depth ( xml_msg_hdr_t msg,
uint32  max_depth 
)

Set the message max_depth value.

Parameters
msgmessage header to set
max_depthnumber value to set
Here is the caller graph for this function:

◆ xml_msg_set_start_depth()

void xml_msg_set_start_depth ( xml_msg_hdr_t msg,
uint32  start_depth 
)

Set the message start_depth value.

Parameters
msgmessage header to set
start_depthnumber value to set
Here is the caller graph for this function:

◆ xml_msg_set_tstamp()

void xml_msg_set_tstamp ( xml_msg_hdr_t msg,
time_t  tstamp,
boolean  test_sense 
)

Set the timestamp match parameters.

Parameters
msgmessage header to set
tstamptimestamp to match
test_senseTRUE to modified-since, FALSE for unmodified-since
Here is the caller graph for this function:

◆ xml_msg_set_with_origin()

status_t xml_msg_set_with_origin ( xml_msg_hdr_t mhdr)

Set the with-origin parameter to true.

Parameters
mhdrmessage header to set
Returns
status
Here is the call graph for this function:
Here is the caller graph for this function:

◆ xml_msg_set_withdef()

void xml_msg_set_withdef ( xml_msg_hdr_t msg,
ncx_withdefaults_t  withdef 
)

Set the message withdef enum.

Parameters
msgmessage header to set
withdefenum value to set
Here is the caller graph for this function:

◆ xml_msg_test_max_depth()

boolean xml_msg_test_max_depth ( xml_msg_hdr_t mhdr,
const struct obj_template_t_ *  obj 
)

Test the max_depth parameter if needed.

Needed by GET2 walker functions to determine if the max depth has been reached (because <depth> parameter used in GET) The depth level does not follow the object schema level obj_get_level() It is defined in RFC 8040 to usually be the target resource node.

Parameters
[in,out]mhdrmessage header to check
  • mhdr->cur_depth may get changed to 0 or 1 if mhdr->depth_target and obj set
objobject that is about to be rendered and testing max_depth This will bec checked against the msg->depth_target if set This object is the real level 1
NULL to ignore depth_target
Returns
TRUE if last level has been reached
FALSE if normal output mode
Here is the call graph for this function:
Here is the caller graph for this function: