yumapro  25.10-4
YumaPro SDK
Loading...
Searching...
No Matches
xml_msg.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2008 - 2012, Andy Bierman, All Rights Reserved.
3 * Copyright (c) 2012 - 2025, YumaWorks, Inc., All Rights Reserved.
4 *
5 * Unless required by applicable law or agreed to in writing,
6 * software distributed under the License is distributed on an
7 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
8 * KIND, either express or implied. See the License for the
9 * specific language governing permissions and limitations
10 * under the License.
11 */
12#ifndef _H_xml_msg
13#define _H_xml_msg
14/* FILE: xml_msg.h
15*********************************************************************
16* *
17* P U R P O S E *
18* *
19*********************************************************************/
20
29/*********************************************************************
30* *
31* C H A N G E H I S T O R Y *
32* *
33*********************************************************************
34
35date init comment
36----------------------------------------------------------------------
3714-jan-07 abb Begun; split from agt_rpc.h
3828-feb-13 abb Add JSON, <get2>, and YANG-API support
39*/
40
41#ifndef _H_ncxtypes
42#include "ncxtypes.h"
43#endif
44
45#ifndef _H_status
46#include "status.h"
47#endif
48
49#ifndef _H_val
50#include "val.h"
51#endif
52
53#ifndef _H_xmlns
54#include "xmlns.h"
55#endif
56
57#ifndef _H_xml_util
58#include "xml_util.h"
59#endif
60
61#ifdef __cplusplus
62extern "C" {
63#endif
64
65/********************************************************************
66* *
67* C O N S T A N T S *
68* *
69*********************************************************************/
70
101#define XML_MSG_FL_PREFIX bit0
102
104#define XML_MSG_FL_ETAGS bit1
105
107#define XML_MSG_FL_ETAGS_TEST bit2
108
112#define XML_MSG_FL_TSTAMPS bit3
113
115#define XML_MSG_FL_TSTAMPS_TEST bit4
116
118#define XML_MSG_FL_KEYS bit5
119
121#define XML_MSG_FL_PASSED bit6
122
130#define XML_MSG_FL_DELTA bit7
131
135#define XML_MSG_FL_OWNERS bit8
136
140#define XML_MSG_FL_GET2 bit9
141
143#define XML_MSG_FL_MODTAGS bit10
144
146#define XML_MSG_FL_MODTAGS_EMPTY bit11
147
149#define XML_MSG_FL_ANYXML_TRACK bit12
150
152#define XML_MSG_FL_WITH_METADATA bit13
153
159#define XML_MSG_FL_FOUND_METADATA bit14
160
161
163#define XML_MSG_USE_PREFIX(M) ((M)->flags & XML_MSG_FL_PREFIX)
164
166#define XML_MSG_NO_PREFIX(M) ((M)->flags &= ~XML_MSG_FL_PREFIX)
167
168
169/* ETAGS */
170
172#define XML_MSG_WITH_ETAGS(M) ((M)->flags & XML_MSG_FL_ETAGS)
173
175#define XML_MSG_WITH_ETAGS_TEST(M) ((M)->flags & XML_MSG_FL_ETAGS_TEST)
176
178#define XML_MSG_SET_WITH_ETAGS(M) (M)->flags |= XML_MSG_FL_ETAGS
179
181#define XML_MSG_SET_WITH_ETAGS_TEST(M) (M)->flags |= XML_MSG_FL_ETAGS_TEST
182
184#define XML_MSG_CLR_WITH_ETAGS_TEST(M) (M)->flags &= ~XML_MSG_FL_ETAGS_TEST
185
186
187/* TIMESTAMPS */
188
190#define XML_MSG_WITH_TSTAMPS(M) ((M)->flags & XML_MSG_FL_TSTAMPS)
191
193#define XML_MSG_WITH_TSTAMPS_TEST(M) ((M)->flags & XML_MSG_FL_TSTAMPS_TEST)
194
196#define XML_MSG_SET_WITH_TSTAMPS(M) (M)->flags |= XML_MSG_FL_TSTAMPS
197
199#define XML_MSG_SET_WITH_TSTAMPS_TEST(M) (M)->flags |= XML_MSG_FL_TSTAMPS_TEST
200
202#define XML_MSG_CLR_WITH_TSTAMPS_TEST(M) (M)->flags &= ~XML_MSG_FL_TSTAMPS_TEST
203
205#define XML_MSG_TSTAMPS_PASSED(M) ((M)->flags & XML_MSG_FL_PASSED)
206
208#define XML_MSG_SET_TSTAMPS_PASSED(M) (M)->flags |= XML_MSG_FL_PASSED
209
211#define XML_MSG_DELTA(M) ((M)->flags & XML_MSG_FL_DELTA)
212
214#define XML_MSG_SET_DELTA(M) (M)->flags |= XML_MSG_FL_DELTA
215
216
218#define XML_MSG_KEYS_ONLY(M) ((M)->flags & XML_MSG_FL_KEYS)
219
221#define XML_MSG_SET_KEYS_ONLY(M) (M)->flags |= XML_MSG_FL_KEYS
222
223/* WITH-OWNERS */
224
226#define XML_MSG_WITH_OWNERS(M) ((M)->flags & XML_MSG_FL_OWNERS)
227
229#define XML_MSG_SET_WITH_OWNERS(M) (M)->flags |= XML_MSG_FL_OWNERS
230
232#define XML_MSG_CLR_WITH_OWNERS(M) (M)->flags &= ~XML_MSG_FL_OWNERS
233
234
235/* GET2 */
236
238#define XML_MSG_WITH_GET2(M) ((M)->flags & XML_MSG_FL_GET2) ? TRUE : FALSE
239
241#define XML_MSG_SET_WITH_GET2(M) (M)->flags |= XML_MSG_FL_GET2
242
244#define XML_MSG_CLR_WITH_GET2(M) (M)->flags &= ~XML_MSG_FL_GET2
245
247#define XML_MSG_SET_LOOKUPQ(M,Q) (M)->lookupQ = Q
248
250#define XML_MSG_SET_MATCHQ(M,Q) (M)->matchQ = Q
251
253#define XML_MSG_SET_SELECTQ(M,Q) (M)->selectQ = Q
254
255
256/* ANYXML-TRACKING */
257
259#define XML_MSG_ANYXML_TRACK(M) ((M)->flags & XML_MSG_FL_ANYXML_TRACK)
260
262#define XML_MSG_SET_ANYXML_TRACK(M) (M)->flags |= XML_MSG_FL_ANYXML_TRACK
263
265#define XML_MSG_CLR_ANYXML_TRACK(M) (M)->flags &= ~XML_MSG_FL_ANYXML_TRACK
266
268#define XML_MSG_ANYXML_OBJ(M) (M)->anyxml_obj
269
271#define XML_MSG_GET_ERROR_DATAQ(M) &(M)->error_dataQ
272
274#define XML_MSG_ACTIONVAL(M) (M)->actionval
275
277#define XML_MSG_GETBULK(M) (M)->getbulk_cb
278
280#define XML_MSG_GET2_TARGET(M) (M)->get2_target
281
283#define XML_MSG_GET2CB(M) (M)->get2cb
284
285/* MODTAGS */
286
288#define XML_MSG_WITH_MODTAGS(M) (((M)->flags & XML_MSG_FL_MODTAGS) != 0)
289
291#define XML_MSG_SET_WITH_MODTAGS(M) (M)->flags |= XML_MSG_FL_MODTAGS
292
294#define XML_MSG_WITH_MODTAGS_EMPTY(M) \
295 ((M)->flags & XML_MSG_FL_MODTAGS_EMPTY)
296
298#define XML_MSG_SET_WITH_MODTAGS_EMPTY(M) \
299 (M)->flags |= XML_MSG_FL_MODTAGS_EMPTY
300
302#define XML_MSG_YPGNMI_GETCB(M) (M)->gnmi_getcb
303
305#define XML_MSG_YPGNMI_EDITCB(M) (M)->gnmi_editcb
306
308#define XML_MSG_PRUNE_BAD_DATA(M) (M)->prune_bad_data
309
311#define XML_MSG_XGET_REQ(M) (M)->xget_request
312
314#define XML_MSG_ALLINONE_MODE(M) (M)->all_in_one_mode
315
319#define XML_MSG_LAST_GET2_FILPTR(M) (M)->get2_filptr
320
322#define XML_MSG_GET2CB_ALLINONE(M) (M)->get2cb
323
324
326#define XML_MSG_NMDA_PARAMS(M) (M)->nmda_params
327
329#define XML_MSG_WITH_ORIGIN(M) \
330 ((M)->nmda_params && (M)->nmda_params->with_origin)
331
333#define XML_MSG_EDIT_CONFIG_ROOT(M) (M)->edit_config_root
334
336#define XML_MSG_DEPTH_TARGET(M) (M)->depth_target
337
338
340#define XML_MSG_NMDA_OPERATIONAL(M) \
341 ((M)->nmda_params && \
342 ((M)->nmda_params->nmda_ds == NCX_NMDA_DS_OPERATIONAL))
343
349#define XML_MSG_SM_MPID(M) (M)->sm_mpid
350
352#define XML_MSG_SID_LOWER(M) (M)->sid_lower
353
354
356#define XML_MSG_SID_UPPER(M) (M)->sid_upper
357
359#define XML_MSG_SID_SKIP(M) (M)->sid_skip
360
362#define XML_MSG_PARENT_SID(M) (M)->parent_sid
363
364
370#define XML_MSG_ACTION_PARENT(M) (M)->action_parent
371
372
380#define XML_MSG_ACTION_PARENT_MODE(M) (M)->action_parent_mode
381
387#define XML_MSG_SKIP_EMPTY_NPCON(M) (M)->skip_empty_npcon
388
389
395#define XML_MSG_PRE_PROCESS_MODE(M) (M)->pre_process_mode
396
397
399#define XML_MSG_JSON_PARSE_NOTIF(M) (M)->json_parse_notif
400
401
408#define XML_MSG_JSON_WR_FIXTOP(M) (M)->json_wr_fixtop
409
415#define XML_MSG_YANG_PUSH_FIX(M) (M)->yang_push_fix
416
422#define XML_MSG_JSON_WR_FIXSPACE(M) (M)->json_wr_fixspace
423
432#define XML_MSG_YANG_PUSH_MODE(M) (M)->yang_push_mode
433
434
435/* WITH_METADATA */
436
438#define XML_MSG_WITH_METADATA(M) \
439 (((M)->flags & XML_MSG_FL_WITH_METADATA) != 0)
440
442#define XML_MSG_SET_WITH_METADATA(M) (M)->flags |= XML_MSG_FL_WITH_METADATA
443
445#define XML_MSG_CLR_WITH_METADATA(M) (M)->flags &= ~XML_MSG_FL_WITH_METADATA
446
447
448/* FOUND_METADATA */
449
451#define XML_MSG_FOUND_METADATA(M) \
452 (((M)->flags & XML_MSG_FL_FOUND_METADATA) != 0)
453
455#define XML_MSG_SET_FOUND_METADATA(M) (M)->flags |= XML_MSG_FL_FOUND_METADATA
456
458#define XML_MSG_CLR_FOUND_METADATA(M) (M)->flags &= ~XML_MSG_FL_FOUND_METADATA
459
460
461/********************************************************************
462* *
463* T Y P E S *
464* *
465*********************************************************************/
466
467
478typedef struct xml_msg_hdr_t_ {
479
481 uint16 flags;
482
491 dlq_hdr_t prefixQ;
496 dlq_hdr_t errQ;
499 dlq_hdr_t filptr_cleanupQ;
521 dlq_hdr_t error_dataQ;
524 dlq_hdr_t *lookupQ;
527 dlq_hdr_t *matchQ;
530 dlq_hdr_t *selectQ;
536 struct agt_acm_cache_t_ *acm_cache;
537
543 uint32 msgid;
544
549
551 boolean cfgid_valid;
552
556 void *acm_cbfn;
557
558 uint32 max_depth;
559 uint32 start_depth;
560 uint32 cur_depth;
564
567
570
573
575 struct tk_chain_t_ *tkc;
576
579
582
585
588
591
594
598 val_value_t *actionval; /* backptr into rpc_input tree */
599
601 struct getbulk_cb_t_ *getbulk_cb;
602
606 struct obj_template_t_ *get2_target;
607
611 struct getcb_get2_t_ *get2cb;
612
614 dlq_hdr_t modtagQ;
615
617 struct ypgnmi_get_cb_t_ *gnmi_getcb;
618
620 struct ypgnmi_edit_cb_t_ *gnmi_editcb;
621
626
631
634
638 struct ncx_filptr_t_ *get2_filptr;
639
642
644 dlq_hdr_t *aiocbQ; // Q of xpath_aio_cb_t
645
650 struct obj_template_t_ *anyxml_obj;
651
658
662 struct obj_template_t_ *depth_target;
663
673
679 ncx_sid_t sid_lower;
680
686 ncx_sid_t sid_upper;
687
689 boolean sid_skip;
690
691
696 ncx_sid_t parent_sid;
697
698 /* YPW-2006: need to GET the parent of an action invocation
699 * This is used for NMDA to verify the action can be called
700 * It is required for YANG 1.1 XPath in case a must or when
701 * statement in the input parameters reaches up into the
702 * config or state data above the action node
703 */
704 struct xpath_pcb_t_ *action_parent;
705
706 /* YPW-2060: need to flag the special get action parent mode
707 * so validation properly handled for AIO and missing NP containers
708 */
709 boolean action_parent_mode;
710
717
721 dlq_hdr_t revcount_revQ;
723 /* YPW-2273: need to flag the special subtree pre-process mode so the
724 * callback has that information and can act accordingly.
725 */
726 boolean pre_process_mode;
727
734
739
747
754
760
761
762
764
765
775typedef void
777 xml_msg_hdr_t *mhdr,
778 status_t res,
779 val_value_t *errnode,
780 const xmlChar *badval);
781
782
783
796typedef void
798 xml_msg_hdr_t *mhdr,
799 status_t res,
800 val_value_t *errnode,
801 const xmlChar *badval,
802 const ncx_errinfo_t *errinfo);
803
804
805
816typedef void
818 xml_msg_hdr_t *mhdr,
819 status_t res,
820 struct obj_template_t_ *errobj,
821 const xmlChar *badval);
822
823
832typedef boolean (*xml_msg_authfn_t) (xml_msg_hdr_t *msg,
833 const xmlChar *username,
834 const val_value_t *val);
835
836
855typedef void
857 xml_msg_hdr_t *mhdr,
858 ncx_layer_t layer,
859 status_t res,
860 const xml_node_t *xmlnode,
861 ncx_node_t parmtyp,
862 const void *error_info,
863 ncx_node_t nodetyp,
864 void *error_path);
865
866
887typedef void
889 xml_msg_hdr_t *msghdr,
890 ncx_layer_t layer,
891 status_t res,
892 const xml_node_t *xmlnode,
893 ncx_node_t parmtyp,
894 const void *error_info,
895 ncx_node_t nodetyp,
896 void *error_path,
897 const ncx_errinfo_t *errinfo);
898
899
918typedef void
920 xml_msg_hdr_t *msghdr,
921 ncx_layer_t layer,
922 status_t res,
923 const xml_attr_t *xmlattr,
924 const xml_node_t *xmlnode,
925 const xmlChar *badns,
926 ncx_node_t nodetyp,
927 void *errnode);
928
929
930/********************************************************************
931* *
932* F U N C T I O N S *
933* *
934*********************************************************************/
935
936
945extern void
946 xml_msg_init_hdr (xml_msg_hdr_t *msg);
947
948
960extern void
962
963
977extern const xmlChar *
979 xmlns_id_t parent_nsid,
980 xmlns_id_t nsid,
981 val_value_t *curelem,
982 boolean *xneeded);
983
984
1004extern const xmlChar *
1006 xmlns_id_t nsid);
1007
1008
1019extern const xmlChar *
1021 xmlns_id_t nsid);
1022
1023
1035extern status_t
1037 xmlns_id_t nsid,
1038 xmlChar **retbuff,
1039 uint32 buffsize);
1040
1041
1060extern status_t
1062 xml_attrs_t *attrs,
1063 boolean addncid,
1064 boolean addncxid);
1065
1066
1076extern status_t
1078 xml_attrs_t *attrs);
1079
1080
1095extern status_t
1097 xmlns_id_t nsid,
1098 const xmlChar *badns,
1099 xml_attrs_t *attrs);
1100
1101
1114extern status_t
1116 xml_attrs_t *attrs,
1117 boolean addncx);
1118
1119
1127extern status_t
1129
1130
1139extern status_t
1141 xml_attrs_t* attrs,
1142 xmlns_id_t ncid);
1143
1144
1145
1150extern void xml_msg_init (void);
1151
1152
1157extern void xml_msg_cleanup (void);
1158
1159
1166extern void xml_msg_set_cfgid (xml_msg_hdr_t *msg,
1167 ncx_cfg_t cfgid);
1168
1169
1181extern ncx_cfg_t
1182 xml_msg_get_cfgid (xml_msg_hdr_t *msg,
1183 boolean *isvalid);
1184
1185
1192extern uint32
1194
1195
1202extern ncx_withdefaults_t
1204
1205
1206
1213extern void
1215 ncx_withdefaults_t withdef);
1216
1217
1224extern uint32
1226
1227
1234extern void
1236 uint32 max_depth);
1237
1238
1245extern uint32
1247
1248
1255extern void
1257 uint32 start_depth);
1258
1259
1266extern uint32
1268
1269
1276extern void
1278 uint32 cur_depth);
1279
1280
1289extern ncx_display_mode_t
1291 boolean is_output);
1292
1293
1303extern void
1305 boolean is_output,
1306 ncx_display_mode_t encoding);
1307
1308
1317extern ncx_etag_t
1319 boolean *test);
1320
1321
1329extern void
1331 ncx_etag_t etag,
1332 boolean test_sense);
1333
1334
1344extern time_t
1346 boolean *test);
1347
1348
1356extern void
1358 time_t tstamp,
1359 boolean test_sense);
1360
1361
1368extern dlq_hdr_t *
1370
1371
1378extern dlq_hdr_t *
1380
1381
1388extern dlq_hdr_t *
1390
1391
1397extern void
1399
1400
1406extern void
1408
1409
1428extern boolean
1430 const struct obj_template_t_ *obj);
1431
1432
1444extern void
1446 ncx_filptr_t *filptr);
1447
1448
1455extern status_t
1457
1458
1459/*
1460* @brief Check the revisions
1461*
1462* Check if the revisions are the same in the queue. If they all the same
1463* return 1, that means that get-schema can be used with out revision
1464* specified. Otherwise, use the original count value which will produce
1465* an "duplicate" error reply.
1466*
1467* @param msg xml_msg_hdr_t to use
1468* @param orig_count count of duplicates
1469*
1470* @return count of duplicate revisions
1471*/
1472extern uint32
1473 xml_msg_check_dup_revs (xml_msg_hdr_t *msg,
1474 uint32 orig_count);
1475
1479#ifdef __cplusplus
1480} /* end extern 'C' */
1481#endif
1482
1483#endif /* _H_xml_msg */
uint32 xml_msg_get_max_depth(xml_msg_hdr_t *msg)
Get the message max_depth value.
Definition: xml_msg.c:1366
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.
Definition: xml_msg.c:1869
const xmlChar * xml_msg_get_prefix_xpath(xml_msg_hdr_t *msg, xmlns_id_t nsid)
Get the module prefix for XPath.
Definition: xml_msg.c:652
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.
Definition: xml_msg.h:919
status_t xml_msg_set_with_origin(xml_msg_hdr_t *mhdr)
Set the with-origin parameter to true.
Definition: xml_msg.c:1892
boolean xml_msg_test_max_depth(xml_msg_hdr_t *mhdr, const struct obj_template_t_ *obj)
Test the max_depth parameter if needed.
Definition: xml_msg.c:1779
void xml_msg_set_encoding(xml_msg_hdr_t *msg, boolean is_output, ncx_display_mode_t encoding)
Set the message encoding value.
Definition: xml_msg.c:1525
void xml_msg_set_start_depth(xml_msg_hdr_t *msg, uint32 start_depth)
Set the message start_depth value.
Definition: xml_msg.c:1425
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.
Definition: xml_msg.c:1048
uint32 xml_msg_get_msgid(xml_msg_hdr_t *msg)
Get the message sequence ID in the message.
Definition: xml_msg.c:1308
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.
Definition: xml_msg.c:900
ncx_etag_t xml_msg_get_etag(xml_msg_hdr_t *msg, boolean *test)
Get the message etag match value and test sense.
Definition: xml_msg.c:1554
uint32 xml_msg_get_cur_depth(xml_msg_hdr_t *msg)
Get the message cur_depth value.
Definition: xml_msg.c:1446
void xml_msg_dec_cur_depth(xml_msg_hdr_t *mhdr)
Decrement the cur_depth parameter if needed.
Definition: xml_msg.c:1739
boolean(* xml_msg_authfn_t)(xml_msg_hdr_t *msg, const xmlChar *username, const val_value_t *val)
read authorization callback template
Definition: xml_msg.h:832
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.
Definition: xml_msg.h:817
dlq_hdr_t * xml_msg_get_lookupQ(xml_msg_hdr_t *msg)
Get the GET2 lookup Queue.
Definition: xml_msg.c:1659
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.
Definition: xml_msg.c:705
void xml_msg_set_cur_depth(xml_msg_hdr_t *msg, uint32 cur_depth)
Set the message cur_depth value.
Definition: xml_msg.c:1465
uint32 xml_msg_get_start_depth(xml_msg_hdr_t *msg)
Get the message start_depth value.
Definition: xml_msg.c:1406
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.
Definition: xml_msg.c:534
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.
Definition: xml_msg.h:776
status_t xml_msg_clean_defns_attr(xml_attrs_t *attrs)
Get rid of an xmlns=foo default attribute.
Definition: xml_msg.c:1145
void xml_msg_init(void)
Init this module.
Definition: xml_msg.c:1235
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> f...
Definition: xml_msg.h:888
ncx_withdefaults_t xml_msg_get_withdef(xml_msg_hdr_t *msg)
Get the message withdef enum.
Definition: xml_msg.c:1326
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.
Definition: xml_msg.c:854
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;.
Definition: xml_msg.c:970
void xml_msg_inc_cur_depth(xml_msg_hdr_t *mhdr)
Increment the cur_depth parameter if needed.
Definition: xml_msg.c:1714
void xml_msg_cleanup(void)
Cleanup this module.
Definition: xml_msg.c:1245
dlq_hdr_t * xml_msg_get_selectQ(xml_msg_hdr_t *msg)
Get the GET2 select Queue.
Definition: xml_msg.c:1695
time_t xml_msg_get_tstamp(xml_msg_hdr_t *msg, boolean *test)
Get the message timestamp match value and test sense.
Definition: xml_msg.c:1609
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.
Definition: xml_msg.h:797
void xml_msg_set_tstamp(xml_msg_hdr_t *msg, time_t tstamp, boolean test_sense)
Set the timestamp match parameters.
Definition: xml_msg.c:1632
ncx_display_mode_t xml_msg_get_encoding(xml_msg_hdr_t *msg, boolean is_output)
Get the message encoding value.
Definition: xml_msg.c:1497
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.
Definition: xml_msg.c:440
dlq_hdr_t * xml_msg_get_matchQ(xml_msg_hdr_t *msg)
Get the GET2 match Queue.
Definition: xml_msg.c:1677
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.
Definition: xml_msg.c:1192
void xml_msg_set_withdef(xml_msg_hdr_t *msg, ncx_withdefaults_t withdef)
Set the message withdef enum.
Definition: xml_msg.c:1345
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.
Definition: xml_msg.c:742
void xml_msg_set_etag(xml_msg_hdr_t *msg, ncx_etag_t etag, boolean test_sense)
Set the etag match parameters.
Definition: xml_msg.c:1577
void xml_msg_set_cfgid(xml_msg_hdr_t *msg, ncx_cfg_t cfgid)
Set the config ID in the message.
Definition: xml_msg.c:1258
void xml_msg_set_max_depth(xml_msg_hdr_t *msg, uint32 max_depth)
Set the message max_depth value.
Definition: xml_msg.c:1385
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.
Definition: xml_msg.h:856
status_t
global error return code
Definition: status_enum.h:219
uint16 xmlns_id_t
integer handle for registered namespaces
Definition: xmlns.h:89
dlq_hdr_t xml_attrs_t
queue of xml_attr_t
Definition: xml_util.h:155
ncx_node_t
NCX Internal Node Types.
Definition: ncxtypes.h:460
uint32 ncx_etag_t
The ETag used in RESTCONF messages is the lower 32 bits of a ncx_transaction_id_t.
Definition: ncxtypes.h:778
ncx_cfg_t
hardwire the 3 standard configs
Definition: ncxtypes.h:571
ncx_layer_t
Enumeration of NETCONF protocol layers.
Definition: ncxtypes.h:530
ncx_display_mode_t
enumeration of val_dump_value display modes Some RESTCONF code uses this field incorrectly for messag...
Definition: ncxtypes.h:642
ncx_withdefaults_t
enum for with-defaults enum values
Definition: ncxtypes.h:1339
YANG module data structures Many internal representations of YANG module constructs.
Global error messages for status code enumerations.
YANG error info statement struct used to override default error handling in the server.
Definition: ncxtypes.h:1427
struct for holding r/o pointer to generic internal node for filtering purposes
Definition: ncxtypes.h:1101
internal NMDA get-data state parameters; rest of parameter are stored directly in the xml_msg_hdr_t u...
Definition: ncxtypes.h:1756
Moint Point Instance This struct lives in a val_value_t.val_extra struct.
Definition: ncxtypes.h:1908
Session Control Block.
Definition: ses.h:759
one value to match one type
Definition: val.h:1024
represents one attribute
Definition: xml_util.h:159
Common Encoding Message Header No longer XML specific!! Used by JSON and CBOR parsing as well!...
Definition: xml_msg.h:478
dlq_hdr_t filptr_cleanupQ
internal processing of filter parameters
Definition: xml_msg.h:499
boolean json_wr_fixspace
JSON Write of a SID File (or any output) that wants to fix the missing space in simple values Style i...
Definition: xml_msg.h:753
dlq_hdr_t error_dataQ
Q of nodes to add to the <error-info> element each node must be a proper val_value_t; A valid module ...
Definition: xml_msg.h:521
time_t match_tstamp
match timestamp used for RESTCONF conditionals
Definition: xml_msg.h:563
void * val_errinfo_fn
xml_msg_val_error_errinfo_fn_t val_error_fn
Definition: xml_msg.h:581
void * obj_error_fn
xml_msg_obj_error_fn_t obj_error_fn
Definition: xml_msg.h:584
ncx_sid_t parent_sid
YANG Parent SID to use when outputing data in pieces and callbacks instead of from a val_value_t or o...
Definition: xml_msg.h:696
dlq_hdr_t * aiocbQ
BACK POINTER TO Q of backptr AIO control blocks.
Definition: xml_msg.h:644
uint32 max_depth
max-depth value, 0=ignore
Definition: xml_msg.h:558
boolean all_in_one_mode
TRUE if this is All in One mode.
Definition: xml_msg.h:633
val_value_t * edit_config_root
if this is an edit request then the <config> root needs to be saved in the message header to allow NA...
Definition: xml_msg.h:657
void * record_error
xml_msg_record_error_fn_t record_error
Definition: xml_msg.h:587
dlq_hdr_t * matchQ
GET2 matchQ used to select only specific nodes.
Definition: xml_msg.h:527
dlq_hdr_t prefixQ
prefixQ: (incoming) All the namespace decls that were in the <rpc> request are used in the <rpc-reply...
Definition: xml_msg.h:491
ncx_display_mode_t output_encoding
RESTCONF output encoding.
Definition: xml_msg.h:572
dlq_hdr_t * lookupQ
GET2 lookup parameters provide ancestor keys.
Definition: xml_msg.h:524
uint32 cur_depth
current depth value
Definition: xml_msg.h:560
ncx_sid_t sid_upper
YANG SID upper bound filter.
Definition: xml_msg.h:686
ncx_etag_t match_etag
match ETag used for RESTCONF conditionals
Definition: xml_msg.h:566
struct agt_acm_cache_t_ * acm_cache
server access control for database reads and writes; !!! shadow pointer to per-session cache,...
Definition: xml_msg.h:536
dlq_hdr_t revcount_revQ
internal processing of revision count backptr to found modules->rev in revision count search processi...
Definition: xml_msg.h:721
ncx_withdefaults_t withdef
with-defaults value
Definition: xml_msg.h:483
struct getcb_get2_t_ * get2cb
GET2 control block needed in NACM data rule processing set and cleared for each ACM check needed; bac...
Definition: xml_msg.h:611
void * record_attr_error
xml_msg_record_attr_error_fn_t record_attr_error
Definition: xml_msg.h:593
struct tk_chain_t_ * tkc
used for RESTCONF JSON parsing
Definition: xml_msg.h:575
val_value_t * actionval
support for the YANG 1.1 <action> data tree that is used to derive keys during invocation of the call...
Definition: xml_msg.h:598
dlq_hdr_t modtagQ
Q of backptr to module-tag filter control block.
Definition: xml_msg.h:614
uint32 start_depth
for nested GET2, 0=ignore
Definition: xml_msg.h:559
uint32 msgid
incremented on every initialized message header rolls over at MAX_UINT32 back to zero used by agt_acm...
Definition: xml_msg.h:543
void * acm_cbfn
agent access control read authorization callback function: xml_msg_authfn_t
Definition: xml_msg.h:556
struct getbulk_cb_t_ * getbulk_cb
getbulk control block to save parameters and state for <getbulk>
Definition: xml_msg.h:601
struct obj_template_t_ * get2_target
GET2 nested target needs to be saved so callback code can filter out nodes that are not being request...
Definition: xml_msg.h:606
struct obj_template_t_ * depth_target
GET2 nested depth target needs to be saved so xml_msg_test_max_depth can produce a correct response a...
Definition: xml_msg.h:662
boolean json_parse_notif
JSON Parse of a notification requires some help The mgr_top_dispatch_json_msg function will set this ...
Definition: xml_msg.h:733
boolean prune_bad_data
flag set if parsing a config file prune bad data for startup-error=continue
Definition: xml_msg.h:625
boolean yang_push_fix
YANG Push Fix mode: needed for agt_output_filter when a JSON YANG Push update with a subtree filter i...
Definition: xml_msg.h:746
dlq_hdr_t errQ
errors are collected in this queue when agt_record_error is invoked
Definition: xml_msg.h:496
dlq_hdr_t * selectQ
GET2 selectQ used in alternate way to select only specific nodes.
Definition: xml_msg.h:530
struct ypgnmi_get_cb_t_ * gnmi_getcb
gnmi control block to save parameters and state for gnmi <get>
Definition: xml_msg.h:617
struct ypgnmi_edit_cb_t_ * gnmi_editcb
gnmi control block to save parameters and state for gnmi <get>
Definition: xml_msg.h:620
ncx_sid_t sid_lower
YANG SID lower bound filter.
Definition: xml_msg.h:679
struct obj_template_t_ * anyxml_obj
object pointer used by server to track real object properties for certain anyxml or anydata nodes suc...
Definition: xml_msg.h:650
ncx_nmda_params_t * nmda_params
NMDA suport for get-data.
Definition: xml_msg.h:641
boolean json_wr_fixtop
JSON Write fixup the first start object to align with GET2 callback start_complex_node.
Definition: xml_msg.h:738
ncx_sm_mpid_t * sm_mpid
Mount Point Instance used in an RPC or ACTION.
Definition: xml_msg.h:672
boolean skip_empty_npcon
support return-empty-npcontainers=false only set in rpc-reply if OK to skip empty NP containers.
Definition: xml_msg.h:716
void * record_error_errinfo
xml_msg_record_error_errinfo_fn_t record_error_errinfo
Definition: xml_msg.h:590
boolean sid_skip
Flag to indicate YANG SID SKIP DATA Mode is active.
Definition: xml_msg.h:689
ncx_display_mode_t input_encoding
RESTCONF input encoding.
Definition: xml_msg.h:569
boolean cfgid_valid
flag needed since ncx_cfg_t uses value zero for running config
Definition: xml_msg.h:551
ncx_cfg_t cfgid
the xml_msg_set_cfgid function is used by the retrieval operation (e.g., <get>, <get-config> to set t...
Definition: xml_msg.h:548
void * val_error_fn
xml_msg_val_error_fn_t val_error_fn
Definition: xml_msg.h:578
uint16 flags
internal message flags
Definition: xml_msg.h:481
boolean xget_request
flag set if <get> request is for XPath filtering.
Definition: xml_msg.h:630
boolean yang_push_mode
YANG Push mode: needed for agt_output_filter when any YANG Push update is in progress Set to true ent...
Definition: xml_msg.h:759
struct ncx_filptr_t_ * get2_filptr
The last GET2 Filter Pointer; may be used in case there are some All in One nodes still left.
Definition: xml_msg.h:638
gather node data into a simple struct.
Definition: xml_util.h:207
Value Node Basic Support.
XML Utilities.
XML namespace support.