Added clicon_data_init API, and yang_mount_get API
Moved dynamic options from options to data API
This commit is contained in:
parent
5822c1a72a
commit
1e136bc9df
11 changed files with 174 additions and 43 deletions
|
|
@ -177,7 +177,7 @@ startup_common(clicon_handle h,
|
|||
if (clicon_option_bool(h, "CLICON_XMLDB_MODSTATE"))
|
||||
if ((msdiff = modstate_diff_new()) == NULL)
|
||||
goto done;
|
||||
clicon_debug(1, "Reading startup config from %s", db);
|
||||
clicon_debug(1, "Reading initial config from %s", db);
|
||||
/* Get the startup datastore WITHOUT binding to YANG, sorting and default setting.
|
||||
* It is done below, later in this function
|
||||
*/
|
||||
|
|
@ -202,6 +202,7 @@ startup_common(clicon_handle h,
|
|||
if (xmldb_get0(h, db, YB_NONE, NULL, "/", 0, 0, &xt, msdiff, &xerr) < 0)
|
||||
goto done;
|
||||
}
|
||||
clicon_debug_xml(CLIXON_DBG_DETAIL, xt, "startup");
|
||||
if (msdiff && msdiff->md_status == 0){ // Possibly check for CLICON_XMLDB_MODSTATE
|
||||
clicon_log(LOG_WARNING, "Modstate expected in startup datastore but not found\n"
|
||||
"This may indicate that the datastore is not initialized corrrectly, such as copy/pasted.\n"
|
||||
|
|
@ -439,6 +440,7 @@ startup_commit(clicon_handle h,
|
|||
* edit-config
|
||||
*/
|
||||
xml_name_set(td->td_target, NETCONF_INPUT_CONFIG);
|
||||
|
||||
if ((ret = xmldb_put(h, "running", OP_REPLACE, td->td_target,
|
||||
clicon_username_get(h), cbret)) < 0)
|
||||
goto done;
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ struct client_entry{
|
|||
uint32_t ce_out_rpc_errors; /* <rpc-error> messages*/
|
||||
uint32_t ce_out_notifications; /* Outgoing notifications */
|
||||
};
|
||||
|
||||
typedef struct client_entry client_entry;
|
||||
|
||||
/*
|
||||
* Prototypes
|
||||
|
|
|
|||
|
|
@ -171,7 +171,7 @@ netconf_hello_msg(clicon_handle h,
|
|||
else if (strncmp(body, NETCONF_BASE_CAPABILITY_1_1, strlen(NETCONF_BASE_CAPABILITY_1_1)) == 0 &&
|
||||
clicon_option_int(h, "CLICON_NETCONF_BASE_CAPABILITY") > 0){ /* RFC 6241 */
|
||||
foundbase_11++;
|
||||
clicon_option_int_set(h, "netconf-framing", NETCONF_SSH_CHUNKED); /* enable chunked enc */
|
||||
clicon_data_int_set(h, "netconf-framing", NETCONF_SSH_CHUNKED); /* enable chunked enc */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -208,7 +208,7 @@ netconf_rpc_message(clicon_handle h,
|
|||
cxobj *xc;
|
||||
netconf_framing_type framing;
|
||||
|
||||
framing = clicon_option_int(h, "netconf-framing");
|
||||
framing = clicon_data_int_get(h, "netconf-framing");
|
||||
if (_netconf_hello_nr == 0 &&
|
||||
clicon_option_bool(h, "CLICON_NETCONF_HELLO_OPTIONAL") == 0){
|
||||
if (netconf_operation_failed_xml(&xret, "rpc", "Client must send an hello element before any RPC")< 0)
|
||||
|
|
@ -321,7 +321,7 @@ netconf_input_packet(clicon_handle h,
|
|||
clicon_debug(1, "%s", __FUNCTION__);
|
||||
rpcname = xml_name(xreq);
|
||||
rpcprefix = xml_prefix(xreq);
|
||||
framing = clicon_option_int(h, "netconf-framing");
|
||||
framing = clicon_data_int_get(h, "netconf-framing");
|
||||
if (xml2ns(xreq, rpcprefix, &namespace) < 0)
|
||||
goto done;
|
||||
if (strcmp(rpcname, "rpc") == 0){
|
||||
|
|
@ -406,7 +406,7 @@ netconf_input_frame(clicon_handle h,
|
|||
|
||||
clicon_debug(CLIXON_DBG_DETAIL, "%s", __FUNCTION__);
|
||||
clicon_debug(CLIXON_DBG_MSG, "Recv ext: %s", cbuf_get(cb));
|
||||
framing = clicon_option_int(h, "netconf-framing");
|
||||
framing = clicon_data_int_get(h, "netconf-framing");
|
||||
yspec = clicon_dbspec_yang(h);
|
||||
if ((str = strdup(cbuf_get(cb))) == NULL){
|
||||
clicon_err(OE_UNIX, errno, "strdup");
|
||||
|
|
@ -582,7 +582,7 @@ netconf_input_cb(int s,
|
|||
for (i=0; i<len; i++){
|
||||
if (buf[i] == 0)
|
||||
continue; /* Skip NULL chars (eg from terminals) */
|
||||
if (clicon_option_int(h, "netconf-framing") == NETCONF_SSH_CHUNKED){
|
||||
if (clicon_data_int_get(h, "netconf-framing") == NETCONF_SSH_CHUNKED){
|
||||
/* Track chunked framing defined in RFC6242 */
|
||||
if ((ret = netconf_input_chunked_framing(buf[i], &frame_state, &frame_size)) < 0)
|
||||
goto done;
|
||||
|
|
@ -663,7 +663,7 @@ send_hello(clicon_handle h,
|
|||
}
|
||||
if (netconf_hello_server(h, cb, id) < 0)
|
||||
goto done;
|
||||
framing = clicon_option_int(h, "netconf-framing");
|
||||
framing = clicon_data_int_get(h, "netconf-framing");
|
||||
if (netconf_output_encap(framing, cb) < 0)
|
||||
goto done;
|
||||
if (netconf_output(s, cb, "hello") < 0)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue