yumapro  21.10T-9
YumaPro SDK
agt_util.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2008 - 2012, Andy Bierman, All Rights Reserved.
3  * Copyright (c) 2012 - 2021, 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_agt_util
13 #define _H_agt_util
14 
15 /* FILE: agt_util.h
16 *********************************************************************
17 * *
18 * P U R P O S E *
19 * *
20 *********************************************************************/
21 
28 /*********************************************************************
29 * *
30 * C H A N G E H I S T O R Y *
31 * *
32 *********************************************************************
33 
34 date init comment
35 ----------------------------------------------------------------------
36 24-may-06 abb Begun
37 
38 */
39 
40 #ifndef _H_agt
41 #include "agt.h"
42 #endif
43 
44 #ifndef _H_agt_cfg
45 #include "agt_cfg.h"
46 #endif
47 
48 #ifndef _H_cfg
49 #include "cfg.h"
50 #endif
51 
52 #ifndef _H_dlq
53 #include "dlq.h"
54 #endif
55 
56 #ifndef _H_getcb
57 #include "getcb.h"
58 #endif
59 
60 #ifndef _H_ncxconst
61 #include "ncxconst.h"
62 #endif
63 
64 #ifndef _H_ncxtypes
65 #include "ncxtypes.h"
66 #endif
67 
68 #ifndef _H_obj
69 #include "obj.h"
70 #endif
71 
72 #ifndef _H_rpc
73 #include "rpc.h"
74 #endif
75 
76 #ifndef _H_ses
77 #include "ses.h"
78 #endif
79 
80 #ifndef _H_status
81 #include "status.h"
82 #endif
83 
84 #ifndef _H_val
85 #include "val.h"
86 #endif
87 
88 #ifndef _H_xml_msg
89 #include "xml_msg.h"
90 #endif
91 
92 #ifndef _H_xml_util
93 #include "xml_util.h"
94 #endif
95 
96 #ifndef _H_xpath
97 #include "xpath.h"
98 #endif
99 
100 #ifndef _H_yang_patch
101 #include "yang_patch.h"
102 #endif
103 
104 #ifdef __cplusplus
105 extern "C" {
106 #endif
107 
108 /********************************************************************
109 * *
110 * F U N C T I O N S *
111 * *
112 *********************************************************************/
113 
138 extern status_t
139  agt_get_cfg_from_parm (const xmlChar *parmname,
140  rpc_msg_t *msg,
141  xml_node_t *methnode,
142  cfg_template_t **retcfg);
143 
144 
155 extern status_t
156  agt_get_inline_cfg_from_parm (const xmlChar *parmname,
157  rpc_msg_t *msg,
158  xml_node_t *methnode,
159  val_value_t **retval);
160 
161 
183 extern status_t
184  agt_get_url_from_parm (const xmlChar *parmname,
185  rpc_msg_t *msg,
186  xml_node_t *methnode,
187  const xmlChar **returl,
188  val_value_t **retval);
189 
190 
200 extern xmlChar *
201  agt_get_filespec_from_url (const xmlChar *urlstr,
202  status_t *res);
203 
204 
214 extern const val_value_t *
215  agt_get_parmval (const xmlChar *parmname,
216  rpc_msg_t *msg);
217 
218 
248 extern void
250  xml_msg_hdr_t *msghdr,
251  ncx_layer_t layer,
252  status_t res,
253  const xml_node_t *xmlnode,
254  ncx_node_t parmtyp,
255  const void *error_info,
256  ncx_node_t nodetyp,
257  void *error_path);
258 
259 
271 extern void
273  xml_msg_hdr_t *msghdr,
274  status_t res,
275  obj_template_t *errobj,
276  const xmlChar *badval);
277 
278 
310 extern void
312  xml_msg_hdr_t *msghdr,
313  ncx_layer_t layer,
314  status_t res,
315  const xml_node_t *xmlnode,
316  ncx_node_t parmtyp,
317  const void *error_info,
318  ncx_node_t nodetyp,
319  void *error_path,
320  const ncx_errinfo_t *errinfo);
321 
322 
357 extern void
359  xml_msg_hdr_t *msghdr,
360  ncx_layer_t layer,
361  status_t res,
362  const xml_node_t *xmlnode,
363  ncx_node_t parmtyp,
364  const void *error_parm,
365  ncx_node_t nodetyp,
366  void *error_path,
367  const ncx_errinfo_t *errinfo);
368 
369 
390 extern void
392  xml_msg_hdr_t *msghdr,
393  ncx_layer_t layer,
394  status_t res,
395  const xml_attr_t *xmlattr,
396  const xml_node_t *xmlnode,
397  const xmlChar *badns,
398  ncx_node_t nodetyp,
399  void *errnode);
400 
401 
419 extern void
421  xml_msg_hdr_t *msghdr,
422  status_t res,
423  val_value_t *errval);
424 
425 
443 extern void
445  xml_msg_hdr_t *msghdr,
446  val_value_t *errval,
447  dlq_hdr_t *valuniqueQ);
448 
449 
460 extern status_t
462  rpc_msg_t *msg);
463 
464 
476 extern status_t
478  rpc_msg_t *msg,
479  val_value_t *filter);
480 
481 
492 extern status_t
494  val_value_t *filter,
495  boolean is_subtree);
496 
497 
511 extern boolean
513  ncx_withdefaults_t withdef,
514  boolean realtest,
515  val_value_t *node);
516 
517 
533 extern boolean
535  ncx_withdefaults_t withdef,
536  boolean realtest,
537  val_value_t *node);
538 
539 
555 extern boolean
557  ncx_withdefaults_t withdef,
558  boolean realtest,
559  val_value_t *node);
560 
561 
579 extern boolean
581  ncx_withdefaults_t withdef,
582  boolean realtest,
583  val_value_t *node);
584 
585 
601 extern boolean
603  ncx_withdefaults_t withdef,
604  boolean realtest,
605  val_value_t *node);
606 
607 
623 extern boolean
625  ncx_withdefaults_t withdef,
626  boolean realtest,
627  val_value_t *node);
628 
629 
645 extern boolean agt_check_basic (xml_msg_hdr_t *mhdr,
646  ncx_withdefaults_t withdef,
647  boolean realtest,
648  val_value_t *node);
649 
650 
661 extern status_t
663  rpc_msg_t *msg,
664  int32 indent);
665 
666 
676 extern status_t
678  rpc_msg_t *msg,
679  int32 indent);
680 
681 
692 extern status_t
694  rpc_msg_t *msg,
695  int32 indent);
696 
697 
705 extern status_t
707  boolean cur_exists);
708 
709 
747 extern status_t
749  op_editop_t *cop,
750  val_value_t *newnode,
751  val_value_t *curnode,
752  ncx_iqual_t iqual,
753  ncx_protocol_t proto,
754  boolean is_commit,
755  boolean *delete_default);
756 
757 
769 extern status_t
770  agt_enable_feature (const xmlChar *modname,
771  const xmlChar *featurename);
772 
773 
785 extern status_t
786  agt_disable_feature (const xmlChar *modname,
787  const xmlChar *featurename);
788 
789 
804 extern val_value_t *
805  agt_make_leaf (obj_template_t *parentobj,
806  const xmlChar *leafname,
807  const xmlChar *leafstrval,
808  status_t *res);
809 
810 
825 extern val_value_t *
827  const xmlChar *leafname,
828  uint32 leafval,
829  status_t *res);
830 
845 extern val_value_t *
846  agt_make_int_leaf (obj_template_t *parentobj,
847  const xmlChar *leafname,
848  int32 leafval,
849  status_t *res);
850 
851 
866 extern val_value_t *
868  const xmlChar *leafname,
869  uint64 leafval,
870  status_t *res);
871 
872 
887 extern val_value_t *
889  const xmlChar *leafname,
890  int64 leafval,
891  status_t *res);
892 
893 
909 extern val_value_t *
911  const xmlChar *leafname,
912  const val_idref_t *leafval,
913  status_t *res);
914 
915 
929 extern val_value_t *
930  agt_make_list (obj_template_t *parentobj,
931  const xmlChar *listname,
932  status_t *res);
933 
934 
944 extern val_value_t *
945  agt_make_object (obj_template_t *parentobj,
946  const xmlChar *objname,
947  status_t *res);
948 
949 
950 #define agt_make_virtual_node agt_make_virtual_leaf
951 
952 
971 extern val_value_t *
973  const xmlChar *leafname,
974  getcb_fn_t callbackfn,
975  status_t *res);
976 
977 
990 extern status_t
992  getcb_fn_t callbackfn);
993 
994 
1015 extern status_t
1017  val_value_t **val);
1018 
1019 
1042 extern status_t
1043  agt_add_container (const xmlChar *modname,
1044  const xmlChar *objname,
1045  val_value_t *parentval,
1046  val_value_t **val);
1047 
1048 
1049 
1064 extern val_value_t *
1065  agt_init_cache (const xmlChar *modname,
1066  const xmlChar *objname,
1067  status_t *res);
1068 
1069 
1084 extern status_t
1085  agt_check_cache (val_value_t **cacheptr,
1086  val_value_t *newval,
1087  val_value_t *curval,
1088  op_editop_t editop);
1089 
1090 
1102 extern xpath_pcb_t *
1104  const xmlChar *expr,
1105  status_t *res);
1106 
1107 
1116 extern xmlChar *
1118 
1119 
1132 extern xmlChar *
1133  agt_get_target_filespec (const xmlChar *target_url,
1134  status_t *res);
1135 
1136 
1157 extern status_t
1159  val_value_t *valroot,
1160  boolean set_candidate,
1161  boolean set_augment,
1162  boolean force);
1163 
1164 
1172 extern status_t
1174 
1175 
1196 extern status_t
1198  const xmlChar *modname,
1199  val_value_t **errval);
1200 
1201 
1212 extern void
1214 
1215 
1224 extern void
1225  agt_set_depth (rpc_msg_t *msg);
1226 
1227 
1236 extern void
1238 
1239 
1254 extern val_value_t *
1255  agt_get_key_value (val_value_t *startval,
1256  val_value_t **lastkey);
1257 
1258 
1278 extern val_value_t *
1280  const xmlChar *objname,
1281  boolean *added,
1282  status_t *res);
1283 
1292 extern boolean
1294 
1295 
1306 extern boolean
1308  const val_value_t *newnode,
1309  const val_value_t *curnode);
1310 
1311 
1331 extern boolean
1333  const val_value_t *newnode,
1334  const val_value_t *curnode,
1335  boolean ignore_defaults,
1336  boolean childonly,
1337  boolean top_replace);
1338 
1339 
1345 extern boolean
1346  agt_backups_enabled (void);
1347 
1348 
1358 extern xpath_result_t *
1360  val_value_t *rootval,
1361  status_t *retres);
1362 
1363 
1371 extern val_value_t *
1373 
1374 
1388 extern void
1390  xml_msg_hdr_t *mhdr,
1391  xmlns_id_t parent_nsid,
1392  xmlns_id_t node_nsid,
1393  const xmlChar *node_name,
1394  int32 indent);
1395 
1396 
1411 extern void
1413  xml_msg_hdr_t *mhdr,
1414  xmlns_id_t parent_nsid,
1415  xmlns_id_t node_nsid,
1416  const xmlChar *node_name,
1417  int32 indent,
1418  boolean try_modname);
1419 
1420 
1441 extern void
1443  xml_msg_hdr_t *mhdr,
1444  xmlns_id_t parent_nsid,
1445  xmlns_id_t nsid,
1446  const xmlChar *elname,
1447  const dlq_hdr_t *attrQ,
1448  boolean isattrq,
1449  int32 indent,
1450  boolean empty);
1451 
1452 
1464 extern void
1466  xml_msg_hdr_t *mhdr,
1467  xmlns_id_t node_nsid,
1468  const xmlChar *node_name,
1469  int32 indent);
1470 
1471 
1479 extern boolean
1481  const xmlChar *etag);
1482 
1483 
1493 extern boolean
1495  ncx_etag_t etag);
1496 
1497 
1506 extern boolean
1508  time_t *timerec);
1509 
1510 
1517 extern boolean
1519 
1520 
1536 extern val_value_t *
1537  agt_make_leaf2 (obj_template_t *parentobj,
1538  const xmlChar *modname,
1539  const xmlChar *leafname,
1540  const xmlChar *leafstrval,
1541  status_t *res);
1542 
1543 
1556 extern val_value_t *
1557  agt_make_union_leaf (obj_template_t *parentobj,
1558  const xmlChar *modname,
1559  const xmlChar *leafname,
1560  const val_value_t *leafval,
1561  status_t *res);
1562 
1563 
1579 extern val_value_t *
1580  agt_make_uint_leaf2 (obj_template_t *parentobj,
1581  const xmlChar *modname,
1582  const xmlChar *leafname,
1583  uint32 leafval,
1584  status_t *res);
1585 
1586 
1602 extern val_value_t *
1603  agt_make_int_leaf2 (obj_template_t *parentobj,
1604  const xmlChar *modname,
1605  const xmlChar *leafname,
1606  int32 leafval,
1607  status_t *res);
1608 
1609 
1625 extern val_value_t *
1627  const xmlChar *modname,
1628  const xmlChar *leafname,
1629  uint64 leafval,
1630  status_t *res);
1631 
1632 
1648 extern val_value_t *
1650  const xmlChar *modname,
1651  const xmlChar *leafname,
1652  int64 leafval,
1653  status_t *res);
1654 
1655 
1675 extern val_value_t *
1677  const xmlChar *modname,
1678  const xmlChar *leafname,
1679  const val_idref_t *leafval,
1680  status_t *res);
1681 
1682 
1695 extern val_value_t *
1696  agt_make_bits_leaf (obj_template_t *parentobj,
1697  const xmlChar *modname,
1698  const xmlChar *leafname,
1699  const ncx_list_t *listval,
1700  status_t *res);
1701 
1702 
1715 extern val_value_t *
1717  const xmlChar *modname,
1718  const xmlChar *leafname,
1719  boolean boolval,
1720  status_t *res);
1721 
1722 
1735 extern val_value_t *
1736  agt_make_empty_leaf (obj_template_t *parentobj,
1737  const xmlChar *modname,
1738  const xmlChar *leafname,
1739  boolean boolval,
1740  status_t *res);
1741 
1742 
1757 extern val_value_t *
1758  agt_make_object2 (obj_template_t *parentobj,
1759  const xmlChar *modname,
1760  const xmlChar *objname,
1761  status_t *res);
1762 
1763 
1785 extern val_value_t *
1787  const xmlChar *modname,
1788  const xmlChar *leafname,
1789  getcb_fn_t callbackfn,
1790  status_t *res);
1791 
1792 
1804 extern ncx_cfg_t
1806 
1807 
1815 extern boolean
1816  agt_module_in_cli_valset (const xmlChar *modname);
1817 
1818 
1825 extern void
1827 
1828 
1829 
1837 extern boolean
1839 
1840 
1849 extern op_editop_t
1850  agt_cvt_editop (op_editop_t editop,
1851  const val_value_t *newval,
1852  const val_value_t *curval);
1853 
1854 
1864 extern op_editop_t
1866  const val_value_t *newval,
1867  const val_value_t *curval);
1868 
1869 
1879 extern int
1880  agt_connect_client (const xmlChar *hostname,
1881  uint16_t port);
1882 
1883 
1898 extern status_t
1900  val_value_t *err_value,
1901  val_value_t **retval);
1902 
1903 
1910 extern uint32
1912 
1913 
1922 extern val_value_t *
1924 
1925 
1932 extern const xmlChar*
1934 
1935 
1936 #ifdef PTHREADS
1937 
1945 extern boolean
1947 
1948 
1957 extern boolean
1958  agt_getbulk_ok_for_nolock (const xmlChar *pathstr);
1959 
1960 #endif // PTHREADS
1961 
1962 
1971 extern boolean
1973 
1974 
1981 extern const xmlChar *
1982  agt_crl_mode_str (agt_crl_mode_t crl_mode);
1983 
1984 
1991 extern agt_crl_mode_t
1992  agt_crl_mode_enum (const xmlChar *crl_mode);
1993 
1994 
2005 extern val_nodetest_fn_t
2007  boolean getop);
2008 
2009 
2010 
2026 extern status_t
2027  agt_fill_dummy_method (const xmlChar *modname,
2028  const xmlChar *rpcname,
2029  xml_node_t *node,
2030  obj_template_t **rpcobj);
2031 
2032 
2047 extern yang_patch_cb_t *
2048  agt_make_yang_patch_cb (const xmlChar *patch_id,
2049  const xmlChar *the_comment,
2050  const xmlChar *patch_root,
2051  agt_cfg_transaction_t *txcb,
2052  uint32 included_changes);
2053 
2054 
2070 extern yang_patch_cb_t *
2071  agt_make_yang_patch_cb_targobj (const xmlChar *patch_id,
2072  const xmlChar *the_comment,
2073  const xmlChar *patch_root,
2074  agt_cfg_transaction_t *txcb,
2075  uint32 included_changes,
2076  obj_template_t *targobj);
2077 
2078 
2091 extern yang_patch_cb_t *
2092  agt_make_yang_patch_cb_file (const xmlChar *patch_id,
2093  const xmlChar *the_comment,
2094  const xmlChar *patch_root,
2095  const xmlChar *filespec);
2096 
2097 
2112 extern boolean
2114  uint32 included_changes,
2115  obj_template_t *targobj);
2116 
2117 
2118 
2119 
2120 
2134 extern status_t
2135  agt_add_leafy (val_value_t *parentval,
2136  const xmlChar *modname,
2137  const xmlChar *leafname,
2138  const xmlChar *leafstrval);
2139 
2140 
2154 extern status_t
2155  agt_add_uint_leafy (val_value_t *parentval,
2156  const xmlChar *modname,
2157  const xmlChar *leafname,
2158  uint32 leafval);
2159 
2160 
2161 
2175 extern status_t
2176  agt_add_int_leafy (val_value_t *parentval,
2177  const xmlChar *modname,
2178  const xmlChar *leafname,
2179  int32 leafval);
2180 
2181 
2195 extern status_t
2196  agt_add_uint64_leafy (val_value_t *parentval,
2197  const xmlChar *modname,
2198  const xmlChar *leafname,
2199  uint64 leafval);
2200 
2201 
2215 extern status_t
2216  agt_add_int64_leafy (val_value_t *parentval,
2217  const xmlChar *modname,
2218  const xmlChar *leafname,
2219  int64 leafval);
2220 
2221 
2222 
2236 extern status_t
2237  agt_add_boolean_leafy (val_value_t *parentval,
2238  const xmlChar *modname,
2239  const xmlChar *leafname,
2240  boolean boolval);
2241 
2242 
2259 extern status_t
2260  agt_add_idref_leafy (val_value_t *parentval,
2261  const xmlChar *modname,
2262  const xmlChar *leafname,
2263  const val_idref_t *leafval);
2264 
2265 
2282 extern status_t
2283  agt_add_bits_leafy (val_value_t *parentval,
2284  const xmlChar *modname,
2285  const xmlChar *leafname,
2286  const ncx_list_t *leafval);
2287 
2288 
2289 
2290 
2291 /***** APIS USED FOR NESTED NOTIFICATION GENERATION ****/
2292 
2293 
2302 extern val_value_t *
2303  agt_make_string_key (const xmlChar *leafval);
2304 
2305 
2306 
2315 extern val_value_t *
2316  agt_make_uint_key (uint32 leafval);
2317 
2318 
2319 
2328 extern val_value_t *
2329  agt_make_int_key (int32 leafval);
2330 
2331 
2332 
2341 extern val_value_t *
2342  agt_make_uint64_key (uint64 leafval);
2343 
2344 
2345 
2354 extern val_value_t *
2355  agt_make_int64_key (int64 leafval);
2356 
2357 
2358 
2367 extern val_value_t *
2368  agt_make_boolean_key (boolean leafval);
2369 
2370 
2379 extern val_value_t *
2380  agt_make_idref_key (const val_idref_t *leafval);
2381 
2382 
2391 extern val_value_t *
2392  agt_make_bits_key (const ncx_list_t *leafval);
2393 
2394 
2395 /*
2396 * @brief make a generic key leaf node from a union
2397 *
2398 * @param leafval union version of value to set for key leaf
2399 * @return malloced value node
2400 */
2401 extern val_value_t *
2402  agt_make_union_key (const val_value_t *leafval);
2403 
2404 
2405 
2409 #ifdef __cplusplus
2410 } /* end extern 'C' */
2411 #endif
2412 
2413 #endif /* _H_agt_util */
status_t agt_add_top_virtual(obj_template_t *obj, getcb_fn_t callbackfn)
make a val_value_t struct for a specified virtual top-level data node
Definition: agt_util.c:3897
boolean agt_check_config_false_default(xml_msg_hdr_t *mhdr, ncx_withdefaults_t withdef, boolean realtest, val_value_t *node)
Used by the <get> operation to return only content=nonconfig nodes and the ID ancestor node and only ...
Definition: agt_util.c:2722
status_t agt_check_max_access(val_value_t *newval, boolean cur_exists)
Check if the max-access for a parameter is exceeded.
Definition: agt_util.c:3079
void agt_record_error_errinfo(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 provided error fields.
Definition: agt_util.c:2051
val_value_t * agt_make_int_key(int32 leafval)
make a generic key leaf node from an int
Definition: agt_util.c:7809
status_t agt_check_cache(val_value_t **cacheptr, val_value_t *newval, val_value_t *curval, op_editop_t editop)
check if a cache pointer needs to be changed or NULLed out
Definition: agt_util.c:4108
XPath expression result.
Definition: xpath.h:619
Data Object Support.
dlq provides general double-linked list and queue support:
Common Encoding Message Header No longer XML specific!! Used by JSON parsing as well!! Allows common ...
Definition: xml_msg.h:351
val_value_t * agt_make_boolean_key(boolean leafval)
make a generic key leaf node from a boolean
Definition: agt_util.c:7884
gather node data into a simple struct.
Definition: xml_util.h:204
status_t agt_add_container(const xmlChar *modname, const xmlChar *objname, val_value_t *parentval, val_value_t **val)
make a val_value_t struct for a specified nested container data node.
Definition: agt_util.c:4007
status_t agt_validate_filter_nmda(rpc_msg_t *msg, val_value_t *filter, boolean is_subtree)
Validate the <filter> parameter; FOR NMDA ONLY.
Definition: agt_util.c:2511
boolean agt_check_basic(xml_msg_hdr_t *mhdr, ncx_withdefaults_t withdef, boolean realtest, val_value_t *node)
Used by the <get-data> operation to return basic filtering NMDA, module-tags, tstamps filtered data...
Definition: agt_util.c:2860
status_t agt_get_url_from_parm(const xmlChar *parmname, rpc_msg_t *msg, xml_node_t *methnode, const xmlChar **returl, val_value_t **retval)
Get the URL string for the config in the target param.
Definition: agt_util.c:1703
val_value_t * agt_make_int64_key(int64 leafval)
make a generic key leaf node from an int64
Definition: agt_util.c:7859
void agt_record_error(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)
Generate an rpc_err_rec_t and save it in the msg.
Definition: agt_util.c:1942
@ brief NCX configuration database manager
NETCONF Server and Client RPC Request/Reply Message Header.
Definition: rpc.h:181
agt_crl_mode_t
server TLS CRL mode
Definition: agt.h:707
status_t agt_set_val_defaults(val_value_t *val)
Check for any node-level config leafs that have a default value, and add them to the running configur...
Definition: agt_util.c:4498
val_value_t * agt_make_idref_leaf(obj_template_t *parentobj, const xmlChar *leafname, const val_idref_t *leafval, status_t *res)
make an identityref val_value_t struct for a specified leaf or leaf-list
Definition: agt_util.c:3788
val_value_t * agt_make_int_leaf(obj_template_t *parentobj, const xmlChar *leafname, int32 leafval, status_t *res)
make an int32 val_value_t struct for a specified leaf or leaf-list
Definition: agt_util.c:3721
boolean agt_backups_enabled(void)
Check if the backup commands are enabled.
Definition: agt_util.c:5144
status_t agt_disable_feature(const xmlChar *modname, const xmlChar *featurename)
Disable a YANG feature in the server.
Definition: agt_util.c:3646
xpath_result_t * agt_get_result_from_xpath(xpath_pcb_t *pcb, val_value_t *rootval, status_t *retres)
Get the result from evaluating an XPath expression.
Definition: agt_util.c:5163
void agt_output_start_errors_container(ses_cb_t *scb, xml_msg_hdr_t *mhdr, xmlns_id_t parent_nsid, xmlns_id_t nsid, const xmlChar *elname, const dlq_hdr_t *attrQ, boolean isattrq, int32 indent, boolean empty)
Output a start <errors> element on the specified session for RESTCONF error handling.
Definition: agt_util.c:5356
val_value_t * agt_make_uint64_key(uint64 leafval)
make a generic key leaf node from a uint64
Definition: agt_util.c:7834
val_value_t * agt_make_int64_leaf2(obj_template_t *parentobj, const xmlChar *modname, const xmlChar *leafname, int64 leafval, status_t *res)
make a val_value_t struct for a specified leaf or leaf-list
Definition: agt_util.c:5748
One YANG data-def-stmt.
Definition: obj.h:1140
val_value_t * agt_make_virtual_leaf(obj_template_t *parentobj, const xmlChar *leafname, getcb_fn_t callbackfn, status_t *res)
make a val_value_t struct for a specified virtual leaf or leaf-list
Definition: agt_util.c:3872
NETCONF Session Common definitions module.
ncx_iqual_t
The instance qualifier types are borrowed from ABNF and RelaxNG.
Definition: ncxtypes.h:447
void agt_record_insert_error(ses_cb_t *scb, xml_msg_hdr_t *msghdr, status_t res, val_value_t *errval)
Generate an rpc_err_rec_t and save it in the msg Called from the YANG edit validation code when an in...
Definition: agt_util.c:2255
void agt_record_unique_error(ses_cb_t *scb, xml_msg_hdr_t *msghdr, val_value_t *errval, dlq_hdr_t *valuniqueQ)
Generate an rpc_err_rec_t and save it in the msg.
Definition: agt_util.c:2332
ncx_cfg_t agt_get_edit_config_id(rpc_msg_t *rpcmsg)
Get the enum ID of the configuration that is being edited.
Definition: agt_util.c:6082
boolean agt_match_etag_binary(val_value_t *val, ncx_etag_t etag)
Check if the etag matches the specified value string.
Definition: agt_util.c:5478
uint16 xmlns_id_t
integer handle for registered namespaces
Definition: xmlns.h:89
val_nodetest_fn_t agt_util_get_testfn(xml_msg_hdr_t *msg, boolean getop)
Get the test function that should be used for a specific get operation based on with-default paramete...
Definition: agt_util.c:6910
status_t agt_check_editop(op_editop_t pop, op_editop_t *cop, val_value_t *newnode, val_value_t *curnode, ncx_iqual_t iqual, ncx_protocol_t proto, boolean is_commit, boolean *delete_default)
Check if the edit operation is okay.
Definition: agt_util.c:3232
val_value_t * agt_make_idref_key(const val_idref_t *leafval)
make a generic key leaf node from an idref struct
Definition: agt_util.c:7905
Contains NCX constants.
boolean agt_apply_this_node_ex(op_editop_t editop, const val_value_t *newnode, const val_value_t *curnode, boolean ignore_defaults, boolean childonly, boolean top_replace)
Check if the write operation applies to the current node.
Definition: agt_util.c:4991
status_t agt_add_int64_leafy(val_value_t *parentval, const xmlChar *modname, const xmlChar *leafname, int64 leafval)
make a child node from a int64 and add to parent.
Definition: agt_util.c:7535
val_value_t * agt_make_union_leaf(obj_template_t *parentobj, const xmlChar *modname, const xmlChar *leafname, const val_value_t *leafval, status_t *res)
make a val_value_t struct for a specified leaf or leaf-list use a val_value_t for a union ...
Definition: agt_util.c:5593
representation of one module or submodule during and after parsing
Definition: ncxtypes.h:1054
Schema and data model Xpath search support.
val_value_t * agt_make_empty_leaf(obj_template_t *parentobj, const xmlChar *modname, const xmlChar *leafname, boolean boolval, status_t *res)
make a val_value_t struct for a specified leaf or leaf-list (NCX_BT_EMPTY)
Definition: agt_util.c:5932
Transaction Control Block.
Definition: agt_cfg.h:224
val_value_t * agt_make_bits_key(const ncx_list_t *leafval)
make a generic key leaf node from a bits struct
Definition: agt_util.c:7960
status_t agt_enable_feature(const xmlChar *modname, const xmlChar *featurename)
Enable a YANG feature in the server.
Definition: agt_util.c:3605
status_t(* getcb_fn_t)(ses_cb_t *scb, getcb_mode_t cbmode, const val_value_t *virval, val_value_t *dstval)
GET1 Callback function for agent node get handler.
Definition: getcb.h:614
val_value_t * agt_make_uint_key(uint32 leafval)
make a generic key leaf node from a uint
Definition: agt_util.c:7785
status_t agt_output_filter(ses_cb_t *scb, rpc_msg_t *msg, int32 indent)
output the proper data for the get or get-config operation generate the data that matched the subtree...
Definition: agt_util.c:2890
ses_term_reason_t
Session Termination reason.
Definition: ses.h:387
val_value_t * agt_make_leaf2(obj_template_t *parentobj, const xmlChar *modname, const xmlChar *leafname, const xmlChar *leafstrval, status_t *res)
make a val_value_t struct for a specified leaf or leaf-list
Definition: agt_util.c:5545
status_t agt_output_schema(ses_cb_t *scb, rpc_msg_t *msg, int32 indent)
generate the YANG file contents for the get-schema operation
Definition: agt_util.c:3001
Value Node Basic Support.
val_value_t * agt_make_int_leaf2(obj_template_t *parentobj, const xmlChar *modname, const xmlChar *leafname, int32 leafval, status_t *res)
make a val_value_t struct for a specified leaf or leaf-list
Definition: agt_util.c:5683
yang_patch_cb_t * agt_make_yang_patch_cb(const xmlChar *patch_id, const xmlChar *the_comment, const xmlChar *patch_root, agt_cfg_transaction_t *txcb, uint32 included_changes)
Make a yang_patch_cb for a YANG Patch conventional datastore on-change update.
Definition: agt_util.c:7046
struct representing 1 configuration database
Definition: cfg.h:225
yang_patch_cb_t * agt_make_yang_patch_cb_targobj(const xmlChar *patch_id, const xmlChar *the_comment, const xmlChar *patch_root, agt_cfg_transaction_t *txcb, uint32 included_changes, obj_template_t *targobj)
Make a yang_patch_cb for a YANG Patch conventional datastore on-change update for a target object...
Definition: agt_util.c:7078
const xmlChar * agt_crl_mode_str(agt_crl_mode_t crl_mode)
Get the string for the CRL mode enum.
Definition: agt_util.c:6844
val_value_t * agt_make_uint_leaf(obj_template_t *parentobj, const xmlChar *leafname, uint32 leafval, status_t *res)
make a uint32 val_value_t struct for a specified leaf or leaf-list
Definition: agt_util.c:3702
xmlChar * agt_get_target_filespec(const xmlChar *target_url, status_t *res)
Figure out where to store the URL target file.
Definition: agt_util.c:4266
boolean agt_check_delete_all_allowed(obj_template_t *testobj)
Check if the delete-all or remove-all operation is enabled for for specified object.
Definition: agt_util.c:6178
represents one attribute
Definition: xml_util.h:156
YANG module data structures Many internal representations of YANG module constructs.
One YANG Patch Request.
Definition: yang_patch.h:155
status_t agt_add_uint_leafy(val_value_t *parentval, const xmlChar *modname, const xmlChar *leafname, uint32 leafval)
make a child node from a uint32 and add to parent.
Definition: agt_util.c:7373
boolean agt_module_in_cli_valset(const xmlChar *modname)
Check if there is a module=foo parameter in the CLI parameter set.
Definition: agt_util.c:6107
status_t agt_fill_dummy_method(const xmlChar *modname, const xmlChar *rpcname, xml_node_t *node, obj_template_t **rpcobj)
Fill the xml_node with the proper data to fake an XML node for the start of the rpc-method element...
Definition: agt_util.c:6976
YANG Patch Media Type.
boolean agt_apply_this_node(op_editop_t editop, const val_value_t *newnode, const val_value_t *curnode)
Check if the write operation applies to the current node.
Definition: agt_util.c:4954
status_t agt_add_top_container(obj_template_t *obj, val_value_t **val)
make a val_value_t struct for a specified top-level container data node.
Definition: agt_util.c:3951
val_value_t * agt_make_idref_leaf2(obj_template_t *parentobj, const xmlChar *modname, const xmlChar *leafname, const val_idref_t *leafval, status_t *res)
make a val_value_t struct for a specified leaf or leaf-list
Definition: agt_util.c:5785
status_t agt_add_bits_leafy(val_value_t *parentval, const xmlChar *modname, const xmlChar *leafname, const ncx_list_t *leafval)
make a child node from a ncx_list_t struct (bits) and add to parent.
Definition: agt_util.c:7707
op_editop_t
NETCONF edit-config operation types.
Definition: op.h:122
status_t agt_set_mod_defaults(ncx_module_t *mod, val_value_t *valroot, boolean set_candidate, boolean set_augment, boolean force)
Check for any top-level config leafs that have a default value, and add them to the running configura...
Definition: agt_util.c:4375
Manage Server configuration edit transactions.
status_t agt_add_int_leafy(val_value_t *parentval, const xmlChar *modname, const xmlChar *leafname, int32 leafval)
make a child node from a int32 and add to parent.
Definition: agt_util.c:7427
XML Utilities.
void agt_record_attr_error(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: agt_util.c:2162
val_value_t * agt_get_key_value(val_value_t *startval, val_value_t **lastkey)
Get the next expected key value in the ancestor chain.
Definition: agt_util.c:4762
void agt_output_start_node(ses_cb_t *scb, xml_msg_hdr_t *mhdr, xmlns_id_t parent_nsid, xmlns_id_t node_nsid, const xmlChar *node_name, int32 indent, boolean try_modname)
Output a start node and try to use modname infront if needed.
Definition: agt_util.c:5297
status_t agt_set_with_defaults(rpc_msg_t *msg, const xmlChar *modname, val_value_t **errval)
Check if the <with-defaults> parameter is set in the request message, and if so, it is one of the ser...
Definition: agt_util.c:4540
XML and JSON Message send and receive support.
val_value_t * agt_make_leaf(obj_template_t *parentobj, const xmlChar *leafname, const xmlChar *leafstrval, status_t *res)
make a string val_value_t struct for a specified leaf or leaf-list
Definition: agt_util.c:3683
val_value_t * agt_make_uint_leaf2(obj_template_t *parentobj, const xmlChar *modname, const xmlChar *leafname, uint32 leafval, status_t *res)
make a val_value_t struct for a specified leaf or leaf-list
Definition: agt_util.c:5651
val_value_t * agt_make_uint64_leaf2(obj_template_t *parentobj, const xmlChar *modname, const xmlChar *leafname, uint64 leafval, status_t *res)
make a val_value_t struct for a specified leaf or leaf-list
Definition: agt_util.c:5715
boolean agt_op_ok_for_maintenance_mode(const obj_template_t *rpcobj)
Check if the operation is OK for maintenance mode.
Definition: agt_util.c:6753
one value to match one type
Definition: val.h:870
status_t agt_validate_filter(ses_cb_t *scb, rpc_msg_t *msg)
Validate the <filter> parameter if present.
Definition: agt_util.c:2406
boolean agt_check_included_changes(agt_cfg_transaction_t *txcb, uint32 included_changes, obj_template_t *targobj)
Check an edit transaction to see if it has any edits that match the included_changes bitmask paramete...
Definition: agt_util.c:7256
boolean agt_getbulk_ok_for_nolock(const xmlChar *pathstr)
Check if the get-bulk target is OK for a nolock get without waiting for a pthreads filter...
Definition: agt_util.c:6646
boolean agt_check_modtags(xml_msg_hdr_t *mhdr, ncx_withdefaults_t withdef, boolean realtest, val_value_t *node)
Used by the <get> and <get-config> operation to return report-all module-tags filtered data...
Definition: agt_util.c:2831
op_editop_t agt_cvt_editop(op_editop_t editop, const val_value_t *newval, const val_value_t *curval)
Determine the effective edit (if OP_EDITOP_COMMIT)
Definition: agt_util.c:6205
val_value_t * agt_init_cache(const xmlChar *modname, const xmlChar *objname, status_t *res)
init a cache pointer during the init2 callback
Definition: agt_util.c:4060
val_value_t * agt_make_virtual_leaf2(obj_template_t *parentobj, const xmlChar *modname, const xmlChar *leafname, getcb_fn_t callbackfn, status_t *res)
make a val_value_t struct for a specified virtual leaf or leaf-list
Definition: agt_util.c:6028
val_value_t * agt_make_object(obj_template_t *parentobj, const xmlChar *objname, status_t *res)
make a val_value_t struct for a specified node
Definition: agt_util.c:3841
boolean agt_get_ok_for_nolock(rpc_msg_t *msg)
Check if the get has filters and if they are OK for a <get> without waiting for a pthreads filter...
Definition: agt_util.c:6568
Session Control Block.
Definition: ses.h:542
one QName for the NCX_BT_IDREF value
Definition: val.h:763
boolean agt_check_config(xml_msg_hdr_t *mhdr, ncx_withdefaults_t withdef, boolean realtest, val_value_t *node)
Used by the <get-config> operation to return any type of configuration data.
Definition: agt_util.c:2542
boolean agt_notifications_enabled(void)
Check if notifications are enabled.
Definition: agt_util.c:5523
status_t
global error return code
Definition: status_enum.h:186
Multi-Protocol Network Management Server.
agt_crl_mode_t agt_crl_mode_enum(const xmlChar *crl_mode)
Get the enum for the CRL mode string.
Definition: agt_util.c:6875
status_t agt_add_uint64_leafy(val_value_t *parentval, const xmlChar *modname, const xmlChar *leafname, uint64 leafval)
make a child node from a uint64 and add to parent.
Definition: agt_util.c:7481
xpath_pcb_t * agt_new_xpath_pcb(ses_cb_t *scb, const xmlChar *expr, status_t *res)
Get a new XPath parser control block and set up the server variable bindings.
Definition: agt_util.c:4172
void agt_set_depth(rpc_msg_t *msg)
Check if the <depth> parameter is set in the request message.
Definition: agt_util.c:4659
status_t agt_add_leafy(val_value_t *parentval, const xmlChar *modname, const xmlChar *leafname, const xmlChar *leafstrval)
make a child node from a string and add to parent.
Definition: agt_util.c:7319
status_t agt_get_inline_cfg_from_parm(const xmlChar *parmname, rpc_msg_t *msg, xml_node_t *methnode, val_value_t **retval)
Get the val_value_t node for the inline config element.
Definition: agt_util.c:1601
xmlChar * agt_get_startup_filespec(status_t *res)
Figure out where to store the startup file.
Definition: agt_util.c:4197
boolean(* val_nodetest_fn_t)(xml_msg_hdr_t *mhdr, ncx_withdefaults_t withdef, boolean realtest, val_value_t *node)
user function callback template to test output of a specified node.
Definition: val_util.h:132
ncx_layer_t
Enumeration of NETCONF protocol layers.
Definition: ncxtypes.h:494
status_t agt_add_boolean_leafy(val_value_t *parentval, const xmlChar *modname, const xmlChar *leafname, boolean boolval)
make a child node from a boolean and add to parent.
Definition: agt_util.c:7590
void agt_record_error_obj(ses_cb_t *scb, xml_msg_hdr_t *msghdr, status_t res, obj_template_t *errobj, const xmlChar *badval)
Generate an rpc_err_rec_t and save it in the msg Use the provided object for <rpc-error> fields...
Definition: agt_util.c:1981
NETCONF protocol remote procedure call common definitions.
op_editop_t agt_cvt_editop_ex(op_editop_t editop, const val_value_t *newval, const val_value_t *curval)
Determine the effective edit (if OP_EDITOP_COMMIT) Do not convert COMMIT to REPLACE same as cvt_edito...
Definition: agt_util.c:6275
status_t agt_find_in_datastore(ncx_cfg_t cfg_id, val_value_t *err_value, val_value_t **retval)
Find the node (should be from an <edit-config> content node) in the specified datastore.
Definition: agt_util.c:6387
Global error messages for status code enumerations.
status_t agt_get_cfg_from_parm(const xmlChar *parmname, rpc_msg_t *msg, xml_node_t *methnode, cfg_template_t **retcfg)
FUNCTION agt_get_cfg_from_parm.
Definition: agt_util.c:1464
boolean agt_modified_since(val_value_t *val, time_t *timerec)
Check if the timestamp for the object is later then the specified timestamp.
Definition: agt_util.c:5501
uint32 agt_get_error_count(rpc_msg_t *msg)
Get the current number of errors in the rpc msg Q.
Definition: agt_util.c:6460
boolean agt_check_config_false(xml_msg_hdr_t *mhdr, ncx_withdefaults_t withdef, boolean realtest, val_value_t *node)
Used by the <get*> operation to return only config=false nodes and the ID ancestor nodes...
Definition: agt_util.c:2663
val_value_t * agt_make_uint64_leaf(obj_template_t *parentobj, const xmlChar *leafname, uint64 leafval, status_t *res)
make a uint64 val_value_t struct for a specified leaf or leaf-list
Definition: agt_util.c:3740
status_t agt_validate_filter_ex(ses_cb_t *scb, rpc_msg_t *msg, val_value_t *filter)
Validate the <filter> parameter if present (extended)
Definition: agt_util.c:2450
int agt_connect_client(const xmlChar *hostname, uint16_t port)
Start a TCP connection to a client.
Definition: agt_util.c:6312
val_value_t * agt_make_boolean_leaf(obj_template_t *parentobj, const xmlChar *modname, const xmlChar *leafname, boolean boolval, status_t *res)
make a val_value_t struct for a specified leaf or leaf-list (NCX_BT_BOOL)
Definition: agt_util.c:5900
val_value_t * agt_get_rpc_input(rpc_msg_t *msg)
Get the rpc input value node.
Definition: agt_util.c:6487
header for a NCX List
Definition: ncxtypes.h:794
YANG error info statement struct used to override default error handling in the server.
Definition: ncxtypes.h:1252
XPath parser control block.
Definition: xpath.h:668
boolean agt_any_operations_set(val_value_t *val)
Check the new node and all descendants for any operation attibutes prsent.
Definition: agt_util.c:4906
val_value_t * agt_make_string_key(const xmlChar *leafval)
make a generic key leaf node from a string
Definition: agt_util.c:7759
void agt_output_start_container(ses_cb_t *scb, xml_msg_hdr_t *mhdr, xmlns_id_t parent_nsid, xmlns_id_t node_nsid, const xmlChar *node_name, int32 indent)
Output a start container node.
Definition: agt_util.c:5243
boolean agt_check_default(xml_msg_hdr_t *mhdr, ncx_withdefaults_t withdef, boolean realtest, val_value_t *node)
Used by the <get*> operation to return only values not set to the default.
Definition: agt_util.c:2601
val_value_t * agt_get_first_result_val(xpath_result_t *result)
Get the first XPath result node or NULL if not node-set or empty node-set or not value node...
Definition: agt_util.c:5207
void agt_set_depth_nmda(rpc_msg_t *msg)
Check if the <depth> parameter is set NMDA max-depth parameter in the request message If so...
Definition: agt_util.c:4711
ncx_node_t
NCX Internal Node Types.
Definition: ncxtypes.h:424
void agt_set_basic_withdef_enabled(void)
Force the basic mode to be enabled in the agt_withdef_enabled bitmask.
Definition: agt_util.c:6133
ncx_protocol_t
NCX session protocol versions supported.
Definition: ncxtypes.h:935
yang_patch_cb_t * agt_make_yang_patch_cb_file(const xmlChar *patch_id, const xmlChar *the_comment, const xmlChar *patch_root, const xmlChar *filespec)
Make a yang_patch_cb for a Simulated Operational On-Change subscription update from a data file...
Definition: agt_util.c:7163
val_value_t * agt_make_bits_leaf(obj_template_t *parentobj, const xmlChar *modname, const xmlChar *leafname, const ncx_list_t *listval, status_t *res)
make a val_value_t struct for a specified leaf or leaf-list (NCX_BT_BITS or NCX_BT_SLIST) ...
Definition: agt_util.c:5860
xmlChar * agt_get_filespec_from_url(const xmlChar *urlstr, status_t *res)
Check the URL and get the filespec part out of it.
Definition: agt_util.c:1839
status_t agt_output_empty(ses_cb_t *scb, rpc_msg_t *msg, int32 indent)
output no data for the get or get-config operation because the if-modified-since fileter did not pass...
Definition: agt_util.c:3055
val_value_t * agt_make_object2(obj_template_t *parentobj, const xmlChar *modname, const xmlChar *objname, status_t *res)
make a val_value_t struct for a specified node
Definition: agt_util.c:5968
ncx_cfg_t
hardwire the 3 standard configs
Definition: ncxtypes.h:535
val_value_t * agt_add_top_node_if_missing(ncx_module_t *mod, const xmlChar *objname, boolean *added, status_t *res)
Add a top config node if it is missing.
Definition: agt_util.c:4821
ncx_withdefaults_t
enum for with-defaults enum values
Definition: ncxtypes.h:1164
void agt_record_warning(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_parm, ncx_node_t nodetyp, void *error_path, const ncx_errinfo_t *errinfo)
Generate an rpc_err_rec_t and save it in the msg.
Definition: agt_util.c:2110
void agt_set_with_owners(rpc_msg_t *msg)
Check if the <with-owners> parameter is set in the request message.
Definition: agt_util.c:4605
const xmlChar * agt_getTermReasonStr(ses_term_reason_t termreason)
Convert the termination reason enum to a string.
Definition: agt_util.c:6516
boolean agt_match_etag(val_value_t *val, const xmlChar *etag)
Check if the etag matches the specified value string.
Definition: agt_util.c:5444
boolean agt_check_save(xml_msg_hdr_t *mhdr, ncx_withdefaults_t withdef, boolean realtest, val_value_t *node)
Used by agt_ncx_cfg_save function to filter just what is supposed to be saved in the <startup> config...
Definition: agt_util.c:2788
void agt_output_end_container(ses_cb_t *scb, xml_msg_hdr_t *mhdr, xmlns_id_t node_nsid, const xmlChar *node_name, int32 indent)
Output an end container node.
Definition: agt_util.c:5408
const val_value_t * agt_get_parmval(const xmlChar *parmname, rpc_msg_t *msg)
Get the identified val_value_t for a given parameter.
Definition: agt_util.c:1897
val_value_t * agt_make_list(obj_template_t *parentobj, const xmlChar *listname, status_t *res)
make a val_value_t struct for a specified list
Definition: agt_util.c:3815
status_t agt_add_idref_leafy(val_value_t *parentval, const xmlChar *modname, const xmlChar *leafname, const val_idref_t *leafval)
make a child node from a val_idref_t struct and add to parent.
Definition: agt_util.c:7647
GET1 and GET2 Callback Support.
val_value_t * agt_make_int64_leaf(obj_template_t *parentobj, const xmlChar *leafname, int64 leafval, status_t *res)
make an int64 val_value_t struct for a specified leaf or leaf-list
Definition: agt_util.c:3759