yumapro
24.10-2
YumaPro SDK
|
Protocol independent message processessing state. More...
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... | |
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!!!
#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
#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
#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
#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
#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 boolean(* xml_msg_authfn_t) (xml_msg_hdr_t *msg, const xmlChar *username, const val_value_t *val) |
read authorization callback template
msg | message header to use |
username | name of the user to check for ccess rights |
val | value to check for authorization |
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.
scb | session control block to use |
mhdr | message header to use |
res | error status code |
errobj | object node in API schema tree or data schema tree associated with the error |
badval | error-info node to use |
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:
scb | session control block NULL and no stats will be recorded |
msghdr | XML msg header with error Q NULL, no errors will be recorded! |
layer | netconf layer error occured <error-type> |
res | internal error code <error-app-tag> |
xmlattr | XML attribute node causing error (NULL if not available) |
xmlnode | XML node containing the attr |
badns | bad namespace string value |
nodetyp | type of node in 'error_path' |
errnode | internal data node with the error NULL if not used |
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.
scb | session control block NULL and no stats will be recorded |
msghdr | XML msg header with error Q NULL, no errors will be recorded! |
layer | netconf layer error occured <error-type> |
res | internal error code <error-app-tag> |
xmlnode | XML node causing error <bad-element> <error-path> NULL if not available |
parmtyp | type of node in 'error_info' |
error_info | error data, specific to 'res' <error-info> NULL if not available (then nodetyp ignored) |
nodetyp | type of node in 'error_path' |
error_path | internal data node with the error <error-path> NULL if not available or not used |
errinfo | error info record to use |
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.
scb | session control block NULL and no stats will be recorded | |
[in,out] | mhdr | XML msg header with error Q NULL, no errors will be recorded! |
layer | netconf layer error occured <error-type> | |
res | internal error code <error-app-tag> | |
xmlnode | XML node causing error <bad-element> <error-path> NULL if not available | |
parmtyp | type of node in 'error_info' | |
error_info | error data, specific to 'res' <error-info> NULL if not available (then nodetyp ignored) | |
nodetyp | type of node in 'error_path' | |
error_path | internal data node with the error <error-path> NULL if not available or not used |
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:
scb | session control block to use |
mhdr | xml_msg_hdr_t to use |
res | error status code |
errnode | node in API tree or data tree associated with the error |
badval | error-info string to use |
errinfo | ncx_errinfo_t struct to use |
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.
scb | session control block to use |
mhdr | xml_msg_hdr_t to use |
res | error status code |
errnode | node in API tree or data tree associated with the error |
badval | error-info string to use |
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.
msg | the message in progrss |
attrs | the the top-level attrs list (e;g, rpc_in_attrs) |
ncid | the ncid to add. |
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
[in,out] | msg | message in progress
|
attrs | the top-level attrs list (e;g, rpc_in_attrs) | |
addncid | TRUE if a prefix entry for the NC namespace should be added FALSE if the NC nsid should not be added | |
addncxid | TRUE if a prefix entry for the NCX namespace should be added FALSE if the NCX nsid should not be added |
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
[in,out] | msg | message in progress
|
nsid | namespace ID to check | |
badns | namespace URI of the bad namespace used if the nsid is the INVALID marker | |
attrs | Q to hold the xml_attr_t, if generated |
status_t xml_msg_clean_defns_attr | ( | xml_attrs_t * | attrs | ) |
Get rid of an xmlns=foo default attribute.
[in,out] | attrs | xmlns_attrs_t Q to process
|
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
msg | xml_msg_hdr_t to clean |
void xml_msg_cleanup | ( | void | ) |
Cleanup this module.
void xml_msg_dec_cur_depth | ( | xml_msg_hdr_t * | mhdr | ) |
Decrement the cur_depth parameter if needed.
mhdr | message header to change |
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.
[in,out] | msg | message in progrss
|
attrs | the top-level attrs list (e;g, rpc_in_attrs) |
/param msg message in progrss /param attrs the top-level attrs list (e;g, rpc_in_attrs)
/return status of operation
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.
msg | message to search and generate a prefix for | |
nsid | namespace ID to generate prefix for | |
[out] | retbuff | address of return buffer
|
buffsize | buffer size |
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.
msg | message in progress | |
[in,out] | attrs | xmlns_attrs_t Q to process
|
addncx | TRUE if an xmlns for the NCX prefix (for errors) should be added to the <rpc-reply> element FALSE if not |
ncx_cfg_t xml_msg_get_cfgid | ( | xml_msg_hdr_t * | msg, |
boolean * | isvalid | ||
) |
Set the config ID in the message.
msg | message header to change | |
[out] | isvalid | address of return valus is valid flag
|
uint32 xml_msg_get_cur_depth | ( | xml_msg_hdr_t * | msg | ) |
Get the message cur_depth value.
msg | message header to use |
ncx_display_mode_t xml_msg_get_encoding | ( | xml_msg_hdr_t * | msg, |
boolean | is_output | ||
) |
Get the message encoding value.
msg | message header to check |
is_output | TRUE to get output encoding FALSE to get input encoding |
ncx_etag_t xml_msg_get_etag | ( | xml_msg_hdr_t * | msg, |
boolean * | test | ||
) |
Get the message etag match value and test sense.
msg | message header to check | |
[out] | test | address of return test sense flag
|
dlq_hdr_t * xml_msg_get_lookupQ | ( | xml_msg_hdr_t * | msg | ) |
Get the GET2 lookup Queue.
msg | message header to use |
dlq_hdr_t * xml_msg_get_matchQ | ( | xml_msg_hdr_t * | msg | ) |
Get the GET2 match Queue.
msg | message header to use |
uint32 xml_msg_get_max_depth | ( | xml_msg_hdr_t * | msg | ) |
Get the message max_depth value.
msg | message header to use |
uint32 xml_msg_get_msgid | ( | xml_msg_hdr_t * | msg | ) |
Get the message sequence ID in the message.
msg | message header to use |
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.
msg | message to search | |
parent_nsid | parent namespace ID | |
nsid | namespace ID to find | |
curelem | value node for current element if available | |
[out] | xneeded | pointer to xmlns needed flag output value
|
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
msg | message to search |
nsid | namespace ID to find |
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
msg | message to search |
nsid | namespace ID to find |
dlq_hdr_t * xml_msg_get_selectQ | ( | xml_msg_hdr_t * | msg | ) |
Get the GET2 select Queue.
msg | message header to use |
uint32 xml_msg_get_start_depth | ( | xml_msg_hdr_t * | msg | ) |
Get the message start_depth value.
msg | message header to use |
time_t xml_msg_get_tstamp | ( | xml_msg_hdr_t * | msg, |
boolean * | test | ||
) |
Get the message timestamp match value and test sense.
msg | message header to check | |
[out] | test | address of return test sense flag
|
ncx_withdefaults_t xml_msg_get_withdef | ( | xml_msg_hdr_t * | msg | ) |
Get the message withdef enum.
msg | message header to use |
void xml_msg_inc_cur_depth | ( | xml_msg_hdr_t * | mhdr | ) |
Increment the cur_depth parameter if needed.
mhdr | message header to change |
void xml_msg_init | ( | void | ) |
Init this module.
void xml_msg_init_hdr | ( | xml_msg_hdr_t * | msg | ) |
Initialize a new xml_msg_hdr_t struct.
msg | xml_msg_hdr_t memory to initialize |
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.
msg | message to use |
filptr | filter pointer to add |
void xml_msg_set_cfgid | ( | xml_msg_hdr_t * | msg, |
ncx_cfg_t | cfgid | ||
) |
Set the config ID in the message.
msg | message header to change |
cfgid | configuration ID to use |
void xml_msg_set_cur_depth | ( | xml_msg_hdr_t * | msg, |
uint32 | cur_depth | ||
) |
Set the message cur_depth value.
msg | message header to set |
cur_depth | new depth value |
void xml_msg_set_encoding | ( | xml_msg_hdr_t * | msg, |
boolean | is_output, | ||
ncx_display_mode_t | encoding | ||
) |
Set the message encoding value.
INPUTS:
msg | message header to check |
is_output | TRUE to set output encoding FALSE to set input encoding |
encoding | new encoding value |
void xml_msg_set_etag | ( | xml_msg_hdr_t * | msg, |
ncx_etag_t | etag, | ||
boolean | test_sense | ||
) |
Set the etag match parameters.
msg | message header to set |
etag | etag to match |
test_sense | TRUE to match, FALSE for none-match |
void xml_msg_set_max_depth | ( | xml_msg_hdr_t * | msg, |
uint32 | max_depth | ||
) |
Set the message max_depth value.
msg | message header to set |
max_depth | number value to set |
void xml_msg_set_start_depth | ( | xml_msg_hdr_t * | msg, |
uint32 | start_depth | ||
) |
Set the message start_depth value.
msg | message header to set |
start_depth | number value to set |
void xml_msg_set_tstamp | ( | xml_msg_hdr_t * | msg, |
time_t | tstamp, | ||
boolean | test_sense | ||
) |
Set the timestamp match parameters.
msg | message header to set |
tstamp | timestamp to match |
test_sense | TRUE to modified-since, FALSE for unmodified-since |
status_t xml_msg_set_with_origin | ( | xml_msg_hdr_t * | mhdr | ) |
Set the with-origin parameter to true.
mhdr | message header to set |
void xml_msg_set_withdef | ( | xml_msg_hdr_t * | msg, |
ncx_withdefaults_t | withdef | ||
) |
Set the message withdef enum.
msg | message header to set |
withdef | enum value to set |
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.
[in,out] | mhdr | message header to check
|
obj | object 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 |