yumapro
24.10-2
YumaPro SDK
|
XML and JSON Message send and receive support. More...
Go to the source code of this file.
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... | |
XML and JSON Message send and receive support.
Protocol message state is saved in the xml_msg_hdr_t struct