Formatting, whitespace
This commit is contained in:
parent
f26ea043c7
commit
411f509fd8
19 changed files with 288 additions and 288 deletions
|
|
@ -1587,11 +1587,11 @@ from_client_restart_plugin(clixon_handle h,
|
|||
* @retval -1 Error
|
||||
*/
|
||||
static int
|
||||
from_client_process_control(clixon_handle h,
|
||||
cxobj *xe,
|
||||
cbuf *cbret,
|
||||
void *arg,
|
||||
void *regarg)
|
||||
from_client_process_control(clixon_handle h,
|
||||
cxobj *xe,
|
||||
cbuf *cbret,
|
||||
void *arg,
|
||||
void *regarg)
|
||||
{
|
||||
int retval = -1;
|
||||
cxobj *x;
|
||||
|
|
@ -1631,7 +1631,7 @@ from_client_process_control(clixon_handle h,
|
|||
* @retval -1 Error
|
||||
*/
|
||||
static int
|
||||
from_client_hello(clixon_handle h,
|
||||
from_client_hello(clixon_handle h,
|
||||
cxobj *x,
|
||||
struct client_entry *ce,
|
||||
cbuf *cbret)
|
||||
|
|
|
|||
|
|
@ -408,10 +408,10 @@ startup_common(clixon_handle h,
|
|||
* @retval -1 Error - or validation failed (but cbret not set)
|
||||
*/
|
||||
int
|
||||
startup_validate(clixon_handle h,
|
||||
char *db,
|
||||
cxobj **xtr,
|
||||
cbuf *cbret)
|
||||
startup_validate(clixon_handle h,
|
||||
char *db,
|
||||
cxobj **xtr,
|
||||
cbuf *cbret)
|
||||
{
|
||||
int retval = -1;
|
||||
int ret;
|
||||
|
|
@ -454,9 +454,9 @@ startup_validate(clixon_handle h,
|
|||
* Only called from startup_mode_startup
|
||||
*/
|
||||
int
|
||||
startup_commit(clixon_handle h,
|
||||
char *db,
|
||||
cbuf *cbret)
|
||||
startup_commit(clixon_handle h,
|
||||
char *db,
|
||||
cbuf *cbret)
|
||||
{
|
||||
int retval = -1;
|
||||
int ret;
|
||||
|
|
|
|||
|
|
@ -137,7 +137,7 @@ confirmed_commit_state_get(clixon_handle h)
|
|||
}
|
||||
|
||||
static int
|
||||
confirmed_commit_state_set(clixon_handle h,
|
||||
confirmed_commit_state_set(clixon_handle h,
|
||||
enum confirmed_commit_state state)
|
||||
{
|
||||
struct confirmed_commit *cc = NULL;
|
||||
|
|
@ -211,8 +211,8 @@ confirmed_commit_fn_arg_get(clixon_handle h,
|
|||
|
||||
static int
|
||||
confirmed_commit_fn_arg_set(clixon_handle h,
|
||||
int (*fn)(int, void*),
|
||||
void *arg)
|
||||
int (*fn)(int, void*),
|
||||
void *arg)
|
||||
{
|
||||
struct confirmed_commit *cc = NULL;
|
||||
|
||||
|
|
@ -325,7 +325,7 @@ cancel_rollback_event(clixon_handle h)
|
|||
* @see do_rollback()
|
||||
*/
|
||||
static int
|
||||
rollback_fn(int fd,
|
||||
rollback_fn(int fd,
|
||||
void *arg)
|
||||
{
|
||||
clixon_handle h = arg;
|
||||
|
|
|
|||
|
|
@ -130,13 +130,13 @@ restconf_client_get_capabilities(clixon_handle h,
|
|||
* @retval -1 Error (fatal)
|
||||
*/
|
||||
static int
|
||||
client_get_streams(clixon_handle h,
|
||||
yang_stmt *yspec,
|
||||
char *xpath,
|
||||
cvec *nsc,
|
||||
yang_stmt *ymod,
|
||||
char *top,
|
||||
cxobj **xret)
|
||||
client_get_streams(clixon_handle h,
|
||||
yang_stmt *yspec,
|
||||
char *xpath,
|
||||
cvec *nsc,
|
||||
yang_stmt *ymod,
|
||||
char *top,
|
||||
cxobj **xret)
|
||||
{
|
||||
int retval = -1;
|
||||
yang_stmt *yns = NULL; /* yang namespace */
|
||||
|
|
@ -396,16 +396,16 @@ filter_xpath_again(clixon_handle h,
|
|||
* @retval -1 Error
|
||||
*/
|
||||
static int
|
||||
get_nacm_and_reply(clixon_handle h,
|
||||
cxobj *xret,
|
||||
cxobj **xvec,
|
||||
size_t xlen,
|
||||
char *xpath,
|
||||
cvec *nsc,
|
||||
char *username,
|
||||
int32_t depth,
|
||||
withdefaults_type wdef,
|
||||
cbuf *cbret)
|
||||
get_nacm_and_reply(clixon_handle h,
|
||||
cxobj *xret,
|
||||
cxobj **xvec,
|
||||
size_t xlen,
|
||||
char *xpath,
|
||||
cvec *nsc,
|
||||
char *username,
|
||||
int32_t depth,
|
||||
withdefaults_type wdef,
|
||||
cbuf *cbret)
|
||||
{
|
||||
int retval = -1;
|
||||
cxobj *xnacm = NULL;
|
||||
|
|
@ -447,12 +447,12 @@ get_nacm_and_reply(clixon_handle h,
|
|||
* @retval -1 Error
|
||||
*/
|
||||
static int
|
||||
element2value(clixon_handle h,
|
||||
cxobj *xe,
|
||||
char *name,
|
||||
char *defaultstr,
|
||||
cbuf *cbret,
|
||||
uint32_t *value)
|
||||
element2value(clixon_handle h,
|
||||
cxobj *xe,
|
||||
char *name,
|
||||
char *defaultstr,
|
||||
cbuf *cbret,
|
||||
uint32_t *value)
|
||||
{
|
||||
char *valstr;
|
||||
cxobj *x;
|
||||
|
|
|
|||
|
|
@ -75,8 +75,8 @@
|
|||
*/
|
||||
int
|
||||
clixon_plugin_reset_one(clixon_plugin_t *cp,
|
||||
clixon_handle h,
|
||||
char *db)
|
||||
clixon_handle h,
|
||||
char *db)
|
||||
{
|
||||
int retval = -1;
|
||||
plgreset_t *fn; /* callback */
|
||||
|
|
@ -137,7 +137,7 @@ clixon_plugin_reset_all(clixon_handle h,
|
|||
*/
|
||||
static int
|
||||
clixon_plugin_pre_daemon_one(clixon_plugin_t *cp,
|
||||
clixon_handle h)
|
||||
clixon_handle h)
|
||||
{
|
||||
int retval = -1;
|
||||
plgdaemon_t *fn; /* Daemonize plugin callback function */
|
||||
|
|
@ -199,7 +199,7 @@ clixon_plugin_pre_daemon_all(clixon_handle h)
|
|||
*/
|
||||
static int
|
||||
clixon_plugin_daemon_one(clixon_plugin_t *cp,
|
||||
clixon_handle h)
|
||||
clixon_handle h)
|
||||
{
|
||||
int retval = -1;
|
||||
plgdaemon_t *fn; /* Daemonize plugin callback function */
|
||||
|
|
@ -332,11 +332,11 @@ clixon_plugin_statedata_one(clixon_plugin_t *cp,
|
|||
* @note xret can be replaced in this function
|
||||
*/
|
||||
int
|
||||
clixon_plugin_statedata_all(clixon_handle h,
|
||||
yang_stmt *yspec,
|
||||
cvec *nsc,
|
||||
char *xpath,
|
||||
cxobj **xret)
|
||||
clixon_plugin_statedata_all(clixon_handle h,
|
||||
yang_stmt *yspec,
|
||||
cvec *nsc,
|
||||
char *xpath,
|
||||
cxobj **xret)
|
||||
{
|
||||
int retval = -1;
|
||||
int ret;
|
||||
|
|
@ -457,8 +457,7 @@ int
|
|||
clixon_plugin_lockdb_all(clixon_handle h,
|
||||
char *db,
|
||||
int lock,
|
||||
int id
|
||||
)
|
||||
int id)
|
||||
|
||||
{
|
||||
int retval = -1;
|
||||
|
|
@ -786,9 +785,9 @@ plugin_transaction_revert_all(clixon_handle h,
|
|||
* The commit failed is called for only failed plugin before revert all cb.
|
||||
*/
|
||||
static int
|
||||
plugin_transaction_commit_failed(clixon_plugin_t *cp,
|
||||
clixon_handle h,
|
||||
transaction_data_t *td)
|
||||
plugin_transaction_commit_failed(clixon_plugin_t *cp,
|
||||
clixon_handle h,
|
||||
transaction_data_t *td)
|
||||
{
|
||||
trans_cb_t *fn;
|
||||
|
||||
|
|
@ -806,7 +805,7 @@ plugin_transaction_commit_failed(clixon_plugin_t *cp,
|
|||
* @retval -1 Error
|
||||
*/
|
||||
int
|
||||
plugin_transaction_commit_one(clixon_plugin_t *cp,
|
||||
plugin_transaction_commit_one(clixon_plugin_t *cp,
|
||||
clixon_handle h,
|
||||
transaction_data_t *td)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -130,9 +130,9 @@ startup --+-------------------------------------> BROKEN XML
|
|||
* @note: if commit fails, copy factory to running
|
||||
*/
|
||||
int
|
||||
startup_mode_startup(clixon_handle h,
|
||||
char *db,
|
||||
cbuf *cbret)
|
||||
startup_mode_startup(clixon_handle h,
|
||||
char *db,
|
||||
cbuf *cbret)
|
||||
{
|
||||
int retval = -1;
|
||||
int ret = 0;
|
||||
|
|
|
|||
|
|
@ -85,15 +85,15 @@
|
|||
* @see struct clixon_handle, struct cli_handle
|
||||
*/
|
||||
struct backend_handle {
|
||||
int bh_magic; /* magic (HDR)*/
|
||||
clicon_hash_t *bh_copt; /* clicon option list (HDR) */
|
||||
clicon_hash_t *bh_data; /* internal clicon data (HDR) */
|
||||
clicon_hash_t *ch_db_elmnt; /* xml datastore element cache data */
|
||||
event_stream_t *bh_stream; /* notification streams, see clixon_stream.[ch] */
|
||||
int bh_magic; /* magic (HDR)*/
|
||||
clicon_hash_t *bh_copt; /* clicon option list (HDR) */
|
||||
clicon_hash_t *bh_data; /* internal clicon data (HDR) */
|
||||
clicon_hash_t *ch_db_elmnt; /* xml datastore element cache data */
|
||||
event_stream_t *bh_stream; /* notification streams, see clixon_stream.[ch] */
|
||||
|
||||
/* ------ end of common handle ------ */
|
||||
struct client_entry *bh_ce_list; /* The client list */
|
||||
int bh_ce_nr; /* Number of clients, just increment */
|
||||
struct client_entry *bh_ce_list; /* The client list */
|
||||
int bh_ce_nr; /* Number of clients, just increment */
|
||||
};
|
||||
|
||||
/*! Creates and returns a clicon config handle for other CLICON API calls
|
||||
|
|
|
|||
|
|
@ -192,10 +192,10 @@ xml_filter_recursive(cxobj *xfilter,
|
|||
|
||||
/*! Remove parts of configuration xml tree that does not match filter xml tree
|
||||
*
|
||||
* @param[in] xfilter Filter xml
|
||||
* @param[out] xconf Configuration xml
|
||||
* @retval 0 OK
|
||||
* @retval -1 Error
|
||||
* @param[in] xfilter Filter xml
|
||||
* @param[out] xconf Configuration xml
|
||||
* @retval 0 OK
|
||||
* @retval -1 Error
|
||||
* This is the top-level function, calls a recursive variant.
|
||||
*/
|
||||
int
|
||||
|
|
|
|||
|
|
@ -454,7 +454,7 @@ netconf_input_cb(int s,
|
|||
frame_size = 0;
|
||||
else
|
||||
frame_size = i32;
|
||||
/* Read input data from socket and append to cbbuf */
|
||||
/* Read input data from socket and append to cbuf */
|
||||
if ((len = netconf_input_read2(s, buf, buflen, &eof)) < 0)
|
||||
goto done;
|
||||
p = buf;
|
||||
|
|
@ -578,8 +578,8 @@ send_hello(clixon_handle h,
|
|||
static int
|
||||
netconf_terminate(clixon_handle h)
|
||||
{
|
||||
cvec *nsctx;
|
||||
cxobj *x;
|
||||
cvec *nsctx;
|
||||
cxobj *x;
|
||||
|
||||
if (clixon_exit_get() == 0)
|
||||
clixon_exit_set(1);
|
||||
|
|
@ -602,7 +602,7 @@ netconf_terminate(clixon_handle h)
|
|||
/*! Setup signal handlers
|
||||
*/
|
||||
static int
|
||||
netconf_signal_init (clixon_handle h)
|
||||
netconf_signal_init(clixon_handle h)
|
||||
{
|
||||
int retval = -1;
|
||||
|
||||
|
|
@ -616,7 +616,7 @@ netconf_signal_init (clixon_handle h)
|
|||
}
|
||||
|
||||
static int
|
||||
timeout_fn(int s,
|
||||
timeout_fn(int s,
|
||||
void *arg)
|
||||
{
|
||||
clixon_err(OE_EVENTS, ETIMEDOUT, "User request timeout");
|
||||
|
|
|
|||
|
|
@ -75,9 +75,9 @@
|
|||
|
||||
/*
|
||||
* <rpc [attributes]>
|
||||
<!- - tag elements in a request from a client application - ->
|
||||
</rpc>
|
||||
*/
|
||||
<!- - tag elements in a request from a client application - ->
|
||||
</rpc>
|
||||
*/
|
||||
|
||||
static int
|
||||
netconf_get_config_subtree(clixon_handle h,
|
||||
|
|
@ -100,7 +100,7 @@ netconf_get_config_subtree(clixon_handle h,
|
|||
NETCONF_BASE_NAMESPACE
|
||||
);
|
||||
}
|
||||
ok:
|
||||
ok:
|
||||
retval = 0;
|
||||
// done:
|
||||
return retval;
|
||||
|
|
@ -147,36 +147,36 @@ ok:
|
|||
* -----------------+-----------+---------------+--------------+
|
||||
* Example requests of each:
|
||||
* no filter + no config
|
||||
<rpc><get-config><source><candidate/></source></get-config></rpc>]]>]]>
|
||||
<rpc><get-config><source><candidate/></source></get-config></rpc>]]>]]>
|
||||
* filter subnet + no config:
|
||||
<rpc><get-config><source><candidate/></source><filter/></get-config></rpc>]]>]]>
|
||||
<rpc><get-config><source><candidate/></source><filter/></get-config></rpc>]]>]]>
|
||||
* filter xpath + select all:
|
||||
<rpc><get-config><source><candidate/></source><filter type="xpath" select="/"/></get-config></rpc>]]>]]>
|
||||
<rpc><get-config><source><candidate/></source><filter type="xpath" select="/"/></get-config></rpc>]]>]]>
|
||||
* filter subtree + config:
|
||||
<rpc><get-config><source><candidate/></source><filter type="subtree"><configuration><interfaces><interface><ipv4><enabled/></ipv4></interface></interfaces></configuration></filter></get-config></rpc>]]>]]>
|
||||
<rpc><get-config><source><candidate/></source><filter type="subtree"><configuration><interfaces><interface><ipv4><enabled/></ipv4></interface></interfaces></configuration></filter></get-config></rpc>]]>]]>
|
||||
* filter xpath + select:
|
||||
<rpc><get-config><source><candidate/></source><filter type="xpath" select="/interfaces/interface/ipv4"/></get-config></rpc>]]>]]>
|
||||
*/
|
||||
<rpc><get-config><source><candidate/></source><filter type="xpath" select="/interfaces/interface/ipv4"/></get-config></rpc>]]>]]>
|
||||
*/
|
||||
static int
|
||||
netconf_get_config(clixon_handle h,
|
||||
cxobj *xn,
|
||||
cxobj **xret)
|
||||
{
|
||||
int retval = -1;
|
||||
cxobj *xfilter; /* filter */
|
||||
char *ftype = NULL;
|
||||
cvec *nsc = NULL;
|
||||
char *prefix = NULL;
|
||||
int retval = -1;
|
||||
cxobj *xfilter; /* filter */
|
||||
char *ftype = NULL;
|
||||
cvec *nsc = NULL;
|
||||
char *prefix = NULL;
|
||||
|
||||
if(xml_nsctx_node(xn, &nsc) < 0)
|
||||
goto done;
|
||||
if(xml_nsctx_node(xn, &nsc) < 0)
|
||||
goto done;
|
||||
|
||||
/* Get prefix of netconf base namespace in the incoming message */
|
||||
if (xml_nsctx_get_prefix(nsc, NETCONF_BASE_NAMESPACE, &prefix) == 0){
|
||||
goto done;
|
||||
}
|
||||
/* Get prefix of netconf base namespace in the incoming message */
|
||||
if (xml_nsctx_get_prefix(nsc, NETCONF_BASE_NAMESPACE, &prefix) == 0){
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* ie <filter>...</filter> */
|
||||
/* ie <filter>...</filter> */
|
||||
if ((xfilter = xpath_first(xn, nsc, "%s%sfilter", prefix ? prefix : "", prefix ? ":" : "")) != NULL)
|
||||
ftype = xml_find_value(xfilter, "type");
|
||||
if (xfilter == NULL || ftype == NULL || strcmp(ftype, "subtree") == 0) {
|
||||
|
|
@ -193,12 +193,12 @@ netconf_get_config(clixon_handle h,
|
|||
}
|
||||
} else {
|
||||
clixon_xml_parse_va(YB_NONE, NULL, xret, NULL, "<rpc-reply xmlns=\"%s\"><rpc-error>"
|
||||
"<error-tag>operation-failed</error-tag>"
|
||||
"<error-type>applicatio</error-type>"
|
||||
"<error-severity>error</error-severity>"
|
||||
"<error-message>filter type not supported</error-message>"
|
||||
"<error-info>type</error-info>"
|
||||
"</rpc-error></rpc-reply>",
|
||||
"<error-tag>operation-failed</error-tag>"
|
||||
"<error-type>applicatio</error-type>"
|
||||
"<error-severity>error</error-severity>"
|
||||
"<error-message>filter type not supported</error-message>"
|
||||
"<error-info>type</error-info>"
|
||||
"</rpc-error></rpc-reply>",
|
||||
NETCONF_BASE_NAMESPACE);
|
||||
}
|
||||
retval = 0;
|
||||
|
|
@ -226,10 +226,10 @@ netconf_get_config(clixon_handle h,
|
|||
* </edit-config>
|
||||
*/
|
||||
static int
|
||||
get_edit_opts(cxobj *xn,
|
||||
enum test_option *testopt,
|
||||
enum error_option *erropt,
|
||||
cxobj **xret)
|
||||
get_edit_opts(cxobj *xn,
|
||||
enum test_option *testopt,
|
||||
enum error_option *erropt,
|
||||
cxobj **xret)
|
||||
{
|
||||
int retval = -1;
|
||||
cxobj *x;
|
||||
|
|
@ -252,10 +252,10 @@ get_edit_opts(cxobj *xn,
|
|||
if (strcmp(optstr, "stop-on-error") == 0)
|
||||
*erropt = STOP_ON_ERROR;
|
||||
else
|
||||
if (strcmp(optstr, "continue-on-error") == 0)
|
||||
*erropt = CONTINUE_ON_ERROR;
|
||||
else
|
||||
goto parerr;
|
||||
if (strcmp(optstr, "continue-on-error") == 0)
|
||||
*erropt = CONTINUE_ON_ERROR;
|
||||
else
|
||||
goto parerr;
|
||||
}
|
||||
}
|
||||
retval = 1; /* hunky dory */
|
||||
|
|
@ -272,41 +272,41 @@ get_edit_opts(cxobj *xn,
|
|||
|
||||
/*! Netconf edit configuration
|
||||
*
|
||||
Write the change on a tmp file, then load that into candidate configuration.
|
||||
<edit-config>
|
||||
<target>
|
||||
<candidate/>
|
||||
</target>
|
||||
Write the change on a tmp file, then load that into candidate configuration.
|
||||
<edit-config>
|
||||
<target>
|
||||
<candidate/>
|
||||
</target>
|
||||
|
||||
<!- - EITHER - ->
|
||||
<!- - EITHER - ->
|
||||
|
||||
<config>
|
||||
<configuration>
|
||||
<!- - tag elements representing the data to incorporate - ->
|
||||
</configuration>
|
||||
</config>
|
||||
<config>
|
||||
<configuration>
|
||||
<!- - tag elements representing the data to incorporate - ->
|
||||
</configuration>
|
||||
</config>
|
||||
|
||||
<!- - OR - ->
|
||||
<!- - OR - ->
|
||||
|
||||
<config-text>
|
||||
<configuration-text>
|
||||
<!- - tag elements inline configuration data in text format - ->
|
||||
</configuration-text>
|
||||
</config-text>
|
||||
<config-text>
|
||||
<configuration-text>
|
||||
<!- - tag elements inline configuration data in text format - ->
|
||||
</configuration-text>
|
||||
</config-text>
|
||||
|
||||
<!- - OR - ->
|
||||
<!- - OR - ->
|
||||
|
||||
<url>
|
||||
<!- - location specifier for file containing data - ->
|
||||
</url>
|
||||
<url>
|
||||
<!- - location specifier for file containing data - ->
|
||||
</url>
|
||||
|
||||
<default-operation>(merge | none | replace)</default-operation>
|
||||
<error-option>(stop-on-error | continue-on-error )</error-option>
|
||||
<test-option>(set | test-then-set | test-only)</test-option>
|
||||
<edit-config>
|
||||
<default-operation>(merge | none | replace)</default-operation>
|
||||
<error-option>(stop-on-error | continue-on-error )</error-option>
|
||||
<test-option>(set | test-then-set | test-only)</test-option>
|
||||
<edit-config>
|
||||
|
||||
CLIXON addition:
|
||||
<filter type="restconf" select="/data/profile=a" />
|
||||
CLIXON addition:
|
||||
<filter type="restconf" select="/data/profile=a" />
|
||||
|
||||
*
|
||||
* @param[in] h clicon handle
|
||||
|
|
@ -375,21 +375,21 @@ netconf_get(clixon_handle h,
|
|||
cxobj *xn,
|
||||
cxobj **xret)
|
||||
{
|
||||
int retval = -1;
|
||||
cxobj *xfilter; /* filter */
|
||||
char *ftype = NULL;
|
||||
cvec *nsc = NULL;
|
||||
char *prefix = NULL;
|
||||
int retval = -1;
|
||||
cxobj *xfilter; /* filter */
|
||||
char *ftype = NULL;
|
||||
cvec *nsc = NULL;
|
||||
char *prefix = NULL;
|
||||
|
||||
if(xml_nsctx_node(xn, &nsc) < 0)
|
||||
goto done;
|
||||
if(xml_nsctx_node(xn, &nsc) < 0)
|
||||
goto done;
|
||||
|
||||
/* Get prefix of netconf base namespace in the incoming message */
|
||||
if (xml_nsctx_get_prefix(nsc, NETCONF_BASE_NAMESPACE, &prefix) == 0){
|
||||
goto done;
|
||||
}
|
||||
/* Get prefix of netconf base namespace in the incoming message */
|
||||
if (xml_nsctx_get_prefix(nsc, NETCONF_BASE_NAMESPACE, &prefix) == 0){
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* ie <filter>...</filter> */
|
||||
/* ie <filter>...</filter> */
|
||||
if ((xfilter = xpath_first(xn, nsc, "%s%sfilter", prefix ? prefix : "", prefix ? ":" : "")) != NULL)
|
||||
ftype = xml_find_value(xfilter, "type");
|
||||
if (xfilter == NULL || ftype == NULL || strcmp(ftype, "subtree") == 0) {
|
||||
|
|
@ -405,12 +405,12 @@ netconf_get(clixon_handle h,
|
|||
goto done;
|
||||
} else {
|
||||
clixon_xml_parse_va(YB_NONE, NULL, xret, NULL, "<rpc-reply xmlns=\"%s\"><rpc-error>"
|
||||
"<error-tag>operation-failed</error-tag>"
|
||||
"<error-type>applicatio</error-type>"
|
||||
"<error-severity>error</error-severity>"
|
||||
"<error-message>filter type not supported</error-message>"
|
||||
"<error-info>type</error-info>"
|
||||
"</rpc-error></rpc-reply>",
|
||||
"<error-tag>operation-failed</error-tag>"
|
||||
"<error-type>applicatio</error-type>"
|
||||
"<error-severity>error</error-severity>"
|
||||
"<error-message>filter type not supported</error-message>"
|
||||
"<error-info>type</error-info>"
|
||||
"</rpc-error></rpc-reply>",
|
||||
NETCONF_BASE_NAMESPACE);
|
||||
}
|
||||
retval = 0;
|
||||
|
|
@ -424,16 +424,16 @@ netconf_get(clixon_handle h,
|
|||
*
|
||||
* and this session has registered for that event.
|
||||
* Filter it and forward it.
|
||||
<notification>
|
||||
<eventTime>2007-07-08T00:01:00Z</eventTime>
|
||||
<event xmlns="http://example.com/event/1.0">
|
||||
<eventClass>fault</eventClass>
|
||||
<reportingEntity>
|
||||
<card>Ethernet0</card>
|
||||
</reportingEntity>
|
||||
<severity>major</severity>
|
||||
</event>
|
||||
</notification>
|
||||
<notification>
|
||||
<eventTime>2007-07-08T00:01:00Z</eventTime>
|
||||
<event xmlns="http://example.com/event/1.0">
|
||||
<eventClass>fault</eventClass>
|
||||
<reportingEntity>
|
||||
<card>Ethernet0</card>
|
||||
</reportingEntity>
|
||||
<severity>major</severity>
|
||||
</event>
|
||||
</notification>
|
||||
* @see rfc5277:
|
||||
* An event notification is sent to the client who initiated a
|
||||
* <create-subscription> command asynchronously when an event of
|
||||
|
|
@ -518,18 +518,18 @@ netconf_notification_cb(int s,
|
|||
}
|
||||
|
||||
/*
|
||||
<create-subscription>
|
||||
<stream>RESULT</stream> # If not present, events in the default NETCONF stream will be sent.
|
||||
<filter type="xpath" select="XPATHEXPR"/>
|
||||
<startTime/> # only for replay (NYI)
|
||||
<stopTime/> # only for replay (NYI)
|
||||
</create-subscription>
|
||||
Dont support replay
|
||||
* @param[in] h clicon handle
|
||||
* @param[in] xn Sub-tree (under xorig) at <rpc>...</rpc> level.
|
||||
* @param[out] xret Return XML, error or OK
|
||||
* @see netconf_notification_cb for asynchronous stream notifications
|
||||
*/
|
||||
<create-subscription>
|
||||
<stream>RESULT</stream> # If not present, events in the default NETCONF stream will be sent.
|
||||
<filter type="xpath" select="XPATHEXPR"/>
|
||||
<startTime/> # only for replay (NYI)
|
||||
<stopTime/> # only for replay (NYI)
|
||||
</create-subscription>
|
||||
Dont support replay
|
||||
* @param[in] h clicon handle
|
||||
* @param[in] xn Sub-tree (under xorig) at <rpc>...</rpc> level.
|
||||
* @param[out] xret Return XML, error or OK
|
||||
* @see netconf_notification_cb for asynchronous stream notifications
|
||||
*/
|
||||
static int
|
||||
netconf_create_subscription(clixon_handle h,
|
||||
cxobj *xn,
|
||||
|
|
@ -560,9 +560,9 @@ netconf_create_subscription(clixon_handle h,
|
|||
if (xpath_first(*xret, NULL, "rpc-reply/rpc-error") != NULL)
|
||||
goto ok;
|
||||
if (clixon_event_reg_fd(s,
|
||||
netconf_notification_cb,
|
||||
h,
|
||||
"notification socket") < 0)
|
||||
netconf_notification_cb,
|
||||
h,
|
||||
"notification socket") < 0)
|
||||
goto done;
|
||||
ok:
|
||||
retval = 0;
|
||||
|
|
@ -588,17 +588,17 @@ netconf_application_rpc(clixon_handle h,
|
|||
cxobj *xn,
|
||||
cxobj **xret)
|
||||
{
|
||||
int retval = -1;
|
||||
yang_stmt *yspec = NULL; /* application yspec */
|
||||
yang_stmt *yrpc = NULL;
|
||||
yang_stmt *ymod = NULL;
|
||||
yang_stmt *youtput;
|
||||
cxobj *xoutput;
|
||||
cxobj *xerr = NULL;
|
||||
cbuf *cb = NULL;
|
||||
cbuf *cbret = NULL;
|
||||
int ret;
|
||||
int nr = 0;
|
||||
int retval = -1;
|
||||
yang_stmt *yspec = NULL; /* application yspec */
|
||||
yang_stmt *yrpc = NULL;
|
||||
yang_stmt *ymod = NULL;
|
||||
yang_stmt *youtput;
|
||||
cxobj *xoutput;
|
||||
cxobj *xerr = NULL;
|
||||
cbuf *cb = NULL;
|
||||
cbuf *cbret = NULL;
|
||||
int nr = 0;
|
||||
int ret;
|
||||
|
||||
/* First check system / netconf RPC:s */
|
||||
if ((cb = cbuf_new()) == NULL){
|
||||
|
|
@ -782,4 +782,5 @@ netconf_rpc_dispatch(clixon_handle h,
|
|||
if ((xa = xml_find(xn, "username")) != NULL)
|
||||
xml_purge(xa);
|
||||
return retval;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@
|
|||
*/
|
||||
static int
|
||||
fcgi_params_set(clixon_handle h,
|
||||
char **envp)
|
||||
char **envp)
|
||||
{
|
||||
int retval = -1;
|
||||
int i;
|
||||
|
|
|
|||
|
|
@ -191,10 +191,10 @@ static int session_id_context = 1;
|
|||
* @retval -1 Error
|
||||
*/
|
||||
static int
|
||||
restconf_native_handle_set(clixon_handle h,
|
||||
restconf_native_handle_set(clixon_handle h,
|
||||
restconf_native_handle *rh)
|
||||
{
|
||||
clicon_hash_t *cdat = clicon_data(h);
|
||||
clicon_hash_t *cdat = clicon_data(h);
|
||||
|
||||
/* It is the pointer to ys that should be copied by hash,
|
||||
so we send a ptr to the ptr to indicate what to copy.
|
||||
|
|
@ -204,10 +204,12 @@ restconf_native_handle_set(clixon_handle h,
|
|||
return 0;
|
||||
}
|
||||
|
||||
/* util function to append log string
|
||||
/*! util function to append log string
|
||||
*/
|
||||
static int
|
||||
print_cb(const char *str, size_t len, void *cb)
|
||||
print_cb(const char *str,
|
||||
size_t len,
|
||||
void *cb)
|
||||
{
|
||||
return cbuf_append_str((cbuf*)cb, (char*)str); /* Assume string */
|
||||
}
|
||||
|
|
@ -529,14 +531,14 @@ static int
|
|||
restconf_accept_client(int fd,
|
||||
void *arg)
|
||||
{
|
||||
int retval = -1;
|
||||
restconf_socket *rsock;
|
||||
clixon_handle h;
|
||||
int s = -1;
|
||||
struct sockaddr from = {0,};
|
||||
socklen_t len;
|
||||
char *name = NULL;
|
||||
void *addr;
|
||||
int retval = -1;
|
||||
restconf_socket *rsock;
|
||||
clixon_handle h;
|
||||
int s = -1;
|
||||
struct sockaddr from = {0,};
|
||||
socklen_t len;
|
||||
char *name = NULL;
|
||||
void *addr;
|
||||
|
||||
clixon_debug(CLIXON_DBG_RESTCONF, "%d", fd);
|
||||
if ((rsock = (restconf_socket *)arg) == NULL){
|
||||
|
|
|
|||
|
|
@ -159,7 +159,6 @@ api_data_get2(clixon_handle h,
|
|||
goto ok;
|
||||
}
|
||||
|
||||
|
||||
/* Ad-hoc method to determine json pagination request:
|
||||
* address list and one of "item/offset/.." is defined
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -127,7 +127,7 @@ RUN git clone https://github.com/clicon/mib-yangs.git /usr/local/share/mib-yangs
|
|||
# Stage 2
|
||||
# The second step skips the development environment and builds a runtime system
|
||||
FROM alpine
|
||||
MAINTAINER Olof Hagsand <olof@hagsand.se>
|
||||
LABEL maintainer="Olof Hagsand <olof@hagsand.se>"
|
||||
|
||||
# For clixon and cligen
|
||||
RUN apk add --update flex bison fcgi-dev
|
||||
|
|
|
|||
|
|
@ -127,7 +127,7 @@ RUN git clone https://github.com/clicon/mib-yangs.git /usr/local/share/mib-yangs
|
|||
# The second step skips the development environment and builds a runtime system
|
||||
# 3.20
|
||||
FROM alpine:latest
|
||||
MAINTAINER Olof Hagsand <olof@hagsand.se>
|
||||
LABEL maintainer="Olof Hagsand <olof@hagsand.se>"
|
||||
|
||||
# For clixon and cligen
|
||||
RUN apk add --update flex bison openssl
|
||||
|
|
|
|||
|
|
@ -112,8 +112,8 @@ xml_nsctx_namespace_netconf_default(clixon_handle h)
|
|||
* @see xml_nsctx_free Free the reutned handle
|
||||
*/
|
||||
cvec *
|
||||
xml_nsctx_init(char *prefix,
|
||||
char *ns)
|
||||
xml_nsctx_init(char *prefix,
|
||||
char *ns)
|
||||
{
|
||||
cvec *cvv = NULL;
|
||||
|
||||
|
|
@ -194,16 +194,16 @@ xml_nsctx_get_prefix(cvec *cvv,
|
|||
|
||||
/*! Set or replace namespace in namespace context
|
||||
*
|
||||
* @param[in] cvv Namespace context
|
||||
* @param[in] prefix Namespace prefix, or NULL for default
|
||||
* @param[in] ns Cached namespace to set (assume non-null?)
|
||||
* @retval 0 OK
|
||||
* @retval -1 Error
|
||||
* @param[in] cvv Namespace context
|
||||
* @param[in] prefix Namespace prefix, or NULL for default
|
||||
* @param[in] ns Cached namespace to set (assume non-null?)
|
||||
* @retval 0 OK
|
||||
* @retval -1 Error
|
||||
*/
|
||||
int
|
||||
xml_nsctx_add(cvec *cvv,
|
||||
char *prefix,
|
||||
char *ns)
|
||||
xml_nsctx_add(cvec *cvv,
|
||||
char *prefix,
|
||||
char *ns)
|
||||
{
|
||||
int retval = -1;
|
||||
cg_var *cv;
|
||||
|
|
@ -219,7 +219,7 @@ xml_nsctx_add(cvec *cvv,
|
|||
|
||||
static int
|
||||
xml_nsctx_node1(cxobj *xn,
|
||||
cvec *nsc)
|
||||
cvec *nsc)
|
||||
{
|
||||
int retval = -1;
|
||||
cxobj *xa = NULL;
|
||||
|
|
@ -546,9 +546,10 @@ xml2ns(cxobj *x,
|
|||
|
||||
/*! Recursively check prefix / namespaces (and populate ns cache)
|
||||
*
|
||||
* @retval 1 OK
|
||||
* @retval 0 (Some) prefix not found
|
||||
* @retval -1 Error
|
||||
* @param[in] xt XML node
|
||||
* @retval 1 OK
|
||||
* @retval 0 (Some) prefix not found
|
||||
* @retval -1 Error
|
||||
*/
|
||||
int
|
||||
xml2ns_recurse(cxobj *xt)
|
||||
|
|
|
|||
|
|
@ -812,7 +812,6 @@ meta_stmt : organization_stmt { _PARSE_DEBUG("meta-stmt -> organization-s
|
|||
| reference_stmt { _PARSE_DEBUG("meta-stmt -> reference-stmt"); }
|
||||
;
|
||||
|
||||
|
||||
/* length-stmt */
|
||||
length_stmt : K_LENGTH string ';' /* XXX length-arg-str */
|
||||
{ if (ysp_add(_yy, Y_LENGTH, $2, NULL) == NULL) _YYERROR("length_stmt");
|
||||
|
|
|
|||
|
|
@ -160,8 +160,8 @@ module clixon-restconf {
|
|||
leaf debug {
|
||||
description
|
||||
"Set debug level of restconf daemon.
|
||||
0 is no debug, 1 is debugging, more is detailed debug.
|
||||
Debug logs will be directed to log-destination with LOG_DEBUG level (for syslog)";
|
||||
Debug logs will be directed to log-destination with LOG_DEBUG level (for syslog)
|
||||
Note: must be decimal";
|
||||
type uint32;
|
||||
default 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -67,10 +67,9 @@ YANGSPECS += ietf-origin@2018-02-14.yang
|
|||
YANGSPECS += ietf-netconf-with-defaults@2011-06-01.yang
|
||||
YANGSPECS += ietf-netconf-monitoring@2010-10-04.yang
|
||||
|
||||
# in draft-ietf-netconf-list-pagination-04.html
|
||||
YANGSPECS += ietf-list-pagination@2024-07-08.yang
|
||||
# in draft-ietf-netconf-list-pagination-nc-04
|
||||
YANGSPECS += ietf-list-pagination-nc@2024-07-08.yang
|
||||
# IETF list-pagination drafts
|
||||
YANGSPECS += ietf-list-pagination@2024-10-21.yang
|
||||
YANGSPECS += ietf-list-pagination-nc@2024-10-21.yang
|
||||
|
||||
all:
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue