* C-API: Added clicon_handle parameter to all xml_bind_* calls

This commit is contained in:
Olof hagsand 2023-01-27 10:59:20 +01:00 committed by Olof Hagsand
parent da9bfcbb53
commit 51ebbdf12f
21 changed files with 102 additions and 62 deletions

View file

@ -487,7 +487,7 @@ from_client_edit_config(clicon_handle h,
xml_spec_set(xc, NULL);
/* Populate XML with Yang spec (why not do this in parser?)
*/
if ((ret = xml_bind_yang(xc, YB_MODULE, yspec, &xret)) < 0)
if ((ret = xml_bind_yang(h, xc, YB_MODULE, yspec, &xret)) < 0)
goto done;
if (ret == 0){
if (clixon_xml2cbuf(cbret, xret, 0, 0, -1, 0) < 0)

View file

@ -231,7 +231,7 @@ startup_common(clicon_handle h,
/* Print upgraded db: -q backend switch for debugging/ showing upgraded config only */
if (clicon_quit_upgrade_get(h) == 1){
/* bind yang */
if ((ret = xml_bind_yang(xt, YB_MODULE, yspec, &xret)) < 1){
if ((ret = xml_bind_yang(h, xt, YB_MODULE, yspec, &xret)) < 1){
if (ret == 0){
/* invalid */
clicon_err(OE_XML, EFAULT, "invalid configuration");
@ -257,7 +257,7 @@ startup_common(clicon_handle h,
goto ok;
}
/* After upgrading, XML tree needs to be sorted and yang spec populated */
if ((ret = xml_bind_yang(xt, YB_MODULE, yspec, &xret)) < 0)
if ((ret = xml_bind_yang(h, xt, YB_MODULE, yspec, &xret)) < 0)
goto done;
if (ret == 0){
if (clixon_xml2cbuf(cbret, xret, 0, 0, -1, 0) < 0)

View file

@ -761,7 +761,7 @@ get_list_pagination(clicon_handle h,
}
/* System makes the binding */
if ((ret = xml_bind_yang(xret, YB_MODULE, yspec, &xerr)) < 0)
if ((ret = xml_bind_yang(h, xret, YB_MODULE, yspec, &xerr)) < 0)
goto done;
if (ret == 0){
clicon_debug_xml(1, xret, "Yang bind pagination state");

View file

@ -370,7 +370,7 @@ clixon_plugin_statedata_all(clicon_handle h,
}
clicon_debug_xml(CLIXON_DBG_DETAIL, x, "%s %s STATE:", __FUNCTION__, clixon_plugin_name_get(cp));
/* XXX: ret == 0 invalid yang binding should be handled as internal error */
if ((ret = xml_bind_yang(x, YB_MODULE, yspec, &xerr)) < 0)
if ((ret = xml_bind_yang(h, x, YB_MODULE, yspec, &xerr)) < 0)
goto done;
if (ret == 0){
if (clixon_netconf_internal_error(xerr,

View file

@ -237,7 +237,7 @@ load_extraxml(clicon_handle h,
if (xt)
xml_name_set(xt, NETCONF_INPUT_CONFIG);
/* Now we can yang bind */
if ((ret = xml_bind_yang(xt, YB_MODULE, yspec, &xerr)) < 0)
if ((ret = xml_bind_yang(h, xt, YB_MODULE, yspec, &xerr)) < 0)
goto done;
if (ret == 0){
if (netconf_err2cb(xerr, cbret) < 0)

View file

@ -229,7 +229,7 @@ netconf_rpc_message(clicon_handle h,
*eof = 1;
goto ok;
}
if ((ret = xml_bind_yang_rpc(xrpc, yspec, &xret)) < 0)
if ((ret = xml_bind_yang_rpc(h, xrpc, yspec, &xret)) < 0)
goto done;
if (ret > 0 &&
(ret = xml_yang_validate_rpc(h, xrpc, 0, &xret)) < 0)

View file

@ -650,7 +650,7 @@ netconf_application_rpc(clicon_handle h,
if ((youtput = yang_find(yrpc, Y_OUTPUT, NULL)) != NULL){
xoutput=xpath_first(*xret, NULL, "/");
xml_spec_set(xoutput, youtput); /* needed for xml_bind_yang */
if ((ret = xml_bind_yang(xoutput, YB_MODULE, yspec, &xerr)) < 0)
if ((ret = xml_bind_yang(h, xoutput, YB_MODULE, yspec, &xerr)) < 0)
goto done;
if (ret > 0 && (ret = xml_yang_validate_all_top(h, xoutput, &xerr)) < 0)
goto done;

View file

@ -598,7 +598,7 @@ api_operations_post_output(clicon_handle h,
if (youtput != NULL){
xml_spec_set(xoutput, youtput); /* needed for xml_bind_yang */
#ifdef notyet
if ((ret = xml_bind_yang(xoutput, YB_MODULE, yspec, &xerr)) < 0)
if ((ret = xml_bind_yang(h, xoutput, YB_MODULE, yspec, &xerr)) < 0)
goto done;
if (ret > 0 && (ret = xml_yang_validate_all(xoutput, &xerr)) < 0)
goto done;
@ -798,7 +798,7 @@ api_operations_post(clicon_handle h,
clicon_debug_xml(1, xtop, "%s 5. Translate input args:", __FUNCTION__);
#endif
/* 6. Validate outgoing RPC and fill in defaults */
if ((ret = xml_bind_yang_rpc(xtop, yspec, &xerr)) < 0) /* */
if ((ret = xml_bind_yang_rpc(h, xtop, yspec, &xerr)) < 0) /* */
goto done;
if (ret == 0){
if (api_return_err0(h, req, xerr, pretty, media_out, 0) < 0)