Changed ca_errmsg callback to a more generic variant
Includes all error, log and debug messages See [Customized NETCONF error message](https://github.com/clicon/clixon/issues/454)
This commit is contained in:
parent
798a9fbfcb
commit
9e54f0602f
83 changed files with 739 additions and 616 deletions
|
|
@ -67,10 +67,10 @@
|
|||
#include "clixon_hash.h"
|
||||
#include "clixon_handle.h"
|
||||
#include "clixon_yang.h"
|
||||
#include "clixon_log.h"
|
||||
#include "clixon_debug.h"
|
||||
#include "clixon_string.h"
|
||||
#include "clixon_xml.h"
|
||||
#include "clixon_log.h"
|
||||
#include "clixon_debug.h"
|
||||
#include "clixon_path.h"
|
||||
#include "clixon_api_path_parse.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -108,11 +108,11 @@
|
|||
#include "clixon_string.h"
|
||||
#include "clixon_hash.h"
|
||||
#include "clixon_handle.h"
|
||||
#include "clixon_yang.h"
|
||||
#include "clixon_xml.h"
|
||||
#include "clixon_err.h"
|
||||
#include "clixon_log.h"
|
||||
#include "clixon_debug.h"
|
||||
#include "clixon_yang.h"
|
||||
#include "clixon_xml.h"
|
||||
#include "clixon_path.h"
|
||||
#include "clixon_api_path_parse.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -53,13 +53,13 @@
|
|||
#include "clixon_string.h"
|
||||
#include "clixon_hash.h"
|
||||
#include "clixon_handle.h"
|
||||
#include "clixon_yang.h"
|
||||
#include "clixon_xml.h"
|
||||
#include "clixon_err.h"
|
||||
#include "clixon_log.h"
|
||||
#include "clixon_debug.h"
|
||||
#include "clixon_err.h"
|
||||
#include "clixon_yang.h"
|
||||
#include "clixon_options.h"
|
||||
#include "clixon_proc.h"
|
||||
#include "clixon_xml.h"
|
||||
#include "clixon_xml_nsctx.h"
|
||||
#include "clixon_xml_io.h"
|
||||
#include "clixon_xpath_ctx.h"
|
||||
|
|
|
|||
|
|
@ -64,11 +64,11 @@
|
|||
#include "clixon_queue.h"
|
||||
#include "clixon_hash.h"
|
||||
#include "clixon_handle.h"
|
||||
#include "clixon_yang.h"
|
||||
#include "clixon_xml.h"
|
||||
#include "clixon_err.h"
|
||||
#include "clixon_log.h"
|
||||
#include "clixon_debug.h"
|
||||
#include "clixon_yang.h"
|
||||
#include "clixon_xml.h"
|
||||
#include "clixon_xml_sort.h"
|
||||
#include "clixon_yang_module.h"
|
||||
#include "clixon_options.h"
|
||||
|
|
|
|||
|
|
@ -65,13 +65,13 @@
|
|||
#include "clixon_queue.h"
|
||||
#include "clixon_hash.h"
|
||||
#include "clixon_handle.h"
|
||||
#include "clixon_yang.h"
|
||||
#include "clixon_xml.h"
|
||||
#include "clixon_err.h"
|
||||
#include "clixon_log.h"
|
||||
#include "clixon_debug.h"
|
||||
#include "clixon_string.h"
|
||||
#include "clixon_file.h"
|
||||
#include "clixon_yang.h"
|
||||
#include "clixon_xml.h"
|
||||
#include "clixon_yang_module.h"
|
||||
#include "clixon_plugin.h"
|
||||
#include "clixon_options.h"
|
||||
|
|
|
|||
|
|
@ -60,12 +60,12 @@
|
|||
#include "clixon_queue.h"
|
||||
#include "clixon_hash.h"
|
||||
#include "clixon_handle.h"
|
||||
#include "clixon_yang.h"
|
||||
#include "clixon_xml.h"
|
||||
#include "clixon_err.h"
|
||||
#include "clixon_log.h"
|
||||
#include "clixon_debug.h"
|
||||
#include "clixon_file.h"
|
||||
#include "clixon_yang.h"
|
||||
#include "clixon_xml.h"
|
||||
#include "clixon_xml_sort.h"
|
||||
#include "clixon_xml_bind.h"
|
||||
#include "clixon_options.h"
|
||||
|
|
|
|||
|
|
@ -60,12 +60,12 @@
|
|||
#include "clixon_queue.h"
|
||||
#include "clixon_hash.h"
|
||||
#include "clixon_handle.h"
|
||||
#include "clixon_yang.h"
|
||||
#include "clixon_xml.h"
|
||||
#include "clixon_err.h"
|
||||
#include "clixon_log.h"
|
||||
#include "clixon_debug.h"
|
||||
#include "clixon_file.h"
|
||||
#include "clixon_yang.h"
|
||||
#include "clixon_xml.h"
|
||||
#include "clixon_xml_sort.h"
|
||||
#include "clixon_options.h"
|
||||
#include "clixon_data.h"
|
||||
|
|
|
|||
|
|
@ -50,6 +50,7 @@
|
|||
#include <string.h>
|
||||
#include <time.h>
|
||||
#include <errno.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
|
|
@ -60,14 +61,22 @@
|
|||
#include "clixon_queue.h"
|
||||
#include "clixon_hash.h"
|
||||
#include "clixon_handle.h"
|
||||
#include "clixon_yang.h"
|
||||
#include "clixon_xml.h"
|
||||
#include "clixon_err.h"
|
||||
#include "clixon_log.h"
|
||||
#include "clixon_debug.h"
|
||||
#include "clixon_xml_io.h"
|
||||
#include "clixon_yang_module.h"
|
||||
#include "clixon_plugin.h"
|
||||
|
||||
/*
|
||||
* Local Variables
|
||||
*/
|
||||
|
||||
/* Cache handle since debug calls do not have handle parameter */
|
||||
static clixon_handle _debug_clixon_h = NULL;
|
||||
|
||||
/*! The global debug level. 0 means no debug
|
||||
*
|
||||
* @note There are pros and cons in having the debug state as a global variable. The
|
||||
|
|
@ -96,6 +105,7 @@ int
|
|||
clixon_debug_init(clixon_handle h,
|
||||
int dbglevel)
|
||||
{
|
||||
_debug_clixon_h = h;
|
||||
_debug_level = dbglevel; /* Global variable */
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -110,56 +120,65 @@ clixon_debug_get(void)
|
|||
|
||||
/*! Print a debug message with debug-level. Settings determine where msg appears.
|
||||
*
|
||||
* Do not use this fn directly, use the clixon_debug() macro
|
||||
* If the dbglevel passed in the function is equal to or lower than the one set by
|
||||
* clixon_debug_init(level). That is, only print debug messages <= than what you want:
|
||||
* print message if level >= dbglevel.
|
||||
* The message is sent to clixon_log. EIther to syslog, stderr or both, depending on
|
||||
* clixon_log_init() setting
|
||||
* @param[in] h Clixon handle
|
||||
* @param[in] dbglevel Mask of CLIXON_DBG_DEFAULT and other masks
|
||||
* @param[in] x XML tree logged without prettyprint
|
||||
* @param[in] format Message to print as argv.
|
||||
* @retval 0 OK
|
||||
* @retval -1 Error
|
||||
* @see clixon_debug_xml Specialization for XML tree
|
||||
* @see CLIXON_DBG_DEFAULT and other flags
|
||||
*/
|
||||
int
|
||||
clixon_debug(int dbglevel,
|
||||
const char *format, ...)
|
||||
clixon_debug_fn(clixon_handle h,
|
||||
int dbglevel,
|
||||
cxobj *x,
|
||||
const char *format, ...)
|
||||
{
|
||||
int retval = -1;
|
||||
va_list args;
|
||||
size_t len;
|
||||
char *msg = NULL;
|
||||
va_list ap;
|
||||
size_t trunc;
|
||||
cbuf *cb = NULL;
|
||||
|
||||
/* Mask debug level with global dbg variable */
|
||||
if ((dbglevel & clixon_debug_get()) == 0)
|
||||
return 0;
|
||||
/* first round: compute length of debug message */
|
||||
va_start(args, format);
|
||||
len = vsnprintf(NULL, 0, format, args);
|
||||
va_end(args);
|
||||
|
||||
if (h == NULL) /* Accept NULL, use saved clixon handle */
|
||||
h = _debug_clixon_h;
|
||||
va_start(ap, format);
|
||||
if (clixon_plugin_errmsg_all(h, NULL, 0, LOG_TYPE_DEBUG,
|
||||
NULL, NULL, x, format, ap, &cb) < 0)
|
||||
goto done;
|
||||
va_end(ap);
|
||||
if (cb != NULL){ /* Customized: expand clixon_err_args */
|
||||
clixon_log_str(LOG_DEBUG, cbuf_get(cb));
|
||||
goto ok;
|
||||
}
|
||||
if ((cb = cbuf_new()) == NULL){
|
||||
fprintf(stderr, "cbuf_new: %s\n", strerror(errno));
|
||||
goto done;
|
||||
}
|
||||
va_start(ap, format);
|
||||
vcprintf(cb, format, ap);
|
||||
va_end(ap);
|
||||
if (x){
|
||||
cprintf(cb, ": ");
|
||||
if (clixon_xml2cbuf(cb, x, 0, 0, NULL, -1, 0) < 0)
|
||||
goto done;
|
||||
}
|
||||
/* Truncate long debug strings */
|
||||
if ((trunc = clixon_log_string_limit_get()) && trunc < len)
|
||||
len = trunc;
|
||||
/* allocate a message string exactly fitting the message length */
|
||||
if ((msg = malloc(len+1)) == NULL){
|
||||
clixon_err(OE_UNIX, errno, "malloc");
|
||||
goto done;
|
||||
}
|
||||
/* second round: compute write message from format and args */
|
||||
va_start(args, format);
|
||||
if (vsnprintf(msg, len+1, format, args) < 0){
|
||||
va_end(args);
|
||||
clixon_err(OE_UNIX, errno, "vsnprintf");
|
||||
goto done;
|
||||
}
|
||||
va_end(args);
|
||||
clixon_log_str(LOG_DEBUG, msg);
|
||||
if ((trunc = clixon_log_string_limit_get()) && trunc < cbuf_len(cb))
|
||||
cbuf_trunc(cb, trunc);
|
||||
clixon_log_str(LOG_DEBUG, cbuf_get(cb));
|
||||
ok:
|
||||
retval = 0;
|
||||
done:
|
||||
if (msg)
|
||||
free(msg);
|
||||
done:
|
||||
if (cb)
|
||||
cbuf_free(cb);
|
||||
return retval;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,6 +52,7 @@
|
|||
#include <syslog.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
|
|
@ -62,9 +63,14 @@
|
|||
#include "clixon_queue.h"
|
||||
#include "clixon_hash.h"
|
||||
#include "clixon_handle.h"
|
||||
#include "clixon_yang.h"
|
||||
#include "clixon_xml.h"
|
||||
#include "clixon_log.h"
|
||||
#include "clixon_debug.h"
|
||||
#include "clixon_err.h"
|
||||
#include "clixon_xml_io.h"
|
||||
#include "clixon_yang_module.h"
|
||||
#include "clixon_plugin.h"
|
||||
|
||||
/*
|
||||
* Types
|
||||
|
|
@ -258,7 +264,7 @@ find_category(int category)
|
|||
* @retval -1 Error
|
||||
* @see clixon_err_fn for a variable-argument variant
|
||||
*/
|
||||
int
|
||||
static int
|
||||
clixon_err_args(clixon_handle h,
|
||||
const char *fn,
|
||||
const int line,
|
||||
|
|
@ -272,7 +278,7 @@ clixon_err_args(clixon_handle h,
|
|||
|
||||
/* Set the global variables */
|
||||
strncpy(_err_reason, msg, ERR_STRLEN-1);
|
||||
_err_category = category;
|
||||
_err_category = category;
|
||||
_err_subnr = suberr;
|
||||
/* Check category callbacks as defined in clixon_err_cat_reg */
|
||||
if ((cec = find_category(category)) != NULL &&
|
||||
|
|
@ -285,14 +291,14 @@ clixon_err_args(clixon_handle h,
|
|||
goto done;
|
||||
/* Here we could take care of specific errno, like application-defined errors */
|
||||
if (fn)
|
||||
clixon_log(h, LOG_ERR, "%s: %d: %s: %s: %s",
|
||||
clixon_log_fn(h, 0, LOG_ERR, NULL, "%s: %d: %s: %s: %s",
|
||||
fn,
|
||||
line,
|
||||
clixon_strerror1(category, EV),
|
||||
cbuf_get(cb),
|
||||
msg);
|
||||
else
|
||||
clixon_log(h, LOG_ERR, "%s: %s: %s",
|
||||
clixon_log_fn(h, 0, LOG_ERR, NULL, "%s: %s: %s",
|
||||
clixon_strerror1(category, EV),
|
||||
cbuf_get(cb),
|
||||
msg);
|
||||
|
|
@ -300,27 +306,27 @@ clixon_err_args(clixon_handle h,
|
|||
else if (suberr){ /* Actually log it */
|
||||
/* Here we could take care of specific errno, like application-defined errors */
|
||||
if (fn)
|
||||
clixon_log(h, LOG_ERR, "%s: %d: %s: %s: %s",
|
||||
fn,
|
||||
line,
|
||||
clixon_strerror1(category, EV),
|
||||
msg,
|
||||
suberr==XMLPARSE_ERRNO?"XML parse error":strerror(suberr));
|
||||
clixon_log_fn(h, 0, LOG_ERR, NULL, "%s: %d: %s: %s: %s",
|
||||
fn,
|
||||
line,
|
||||
clixon_strerror1(category, EV),
|
||||
msg,
|
||||
suberr==XMLPARSE_ERRNO?"XML parse error":strerror(suberr));
|
||||
else
|
||||
clixon_log(h, LOG_ERR, "%s: %s: %s",
|
||||
clixon_log_fn(h, 0, LOG_ERR, NULL, "%s: %s: %s",
|
||||
clixon_strerror1(category, EV),
|
||||
msg,
|
||||
suberr==XMLPARSE_ERRNO?"XML parse error":strerror(suberr));
|
||||
}
|
||||
else{
|
||||
if (fn)
|
||||
clixon_log(h, LOG_ERR, "%s: %d: %s: %s",
|
||||
clixon_log_fn(h, 0, LOG_ERR, NULL, "%s: %d: %s: %s",
|
||||
fn,
|
||||
line,
|
||||
clixon_strerror1(category, EV),
|
||||
msg);
|
||||
else
|
||||
clixon_log(h, LOG_ERR, "%s: %s",
|
||||
clixon_log_fn(h, 0, LOG_ERR, NULL, "%s: %s",
|
||||
clixon_strerror1(category, EV),
|
||||
msg);
|
||||
}
|
||||
|
|
@ -331,8 +337,55 @@ clixon_err_args(clixon_handle h,
|
|||
return retval;
|
||||
}
|
||||
|
||||
/*! Generate netconf error msg to cbuf using callback to use in string printout or logs
|
||||
*
|
||||
* If no callback is registered, a default error message is genereated
|
||||
* @param[in] xerr Netconf error message on the level: <rpc-error>
|
||||
* @param[out] cberr Translation from netconf err to cbuf.
|
||||
* @retval 0 OK, with cberr set
|
||||
* @retval -1 Error
|
||||
* @code
|
||||
* cbuf *cb = NULL;
|
||||
* if ((cb = cbuf_new()) ==NULL){
|
||||
* err;
|
||||
* if (netconf_err2cb(h, xerr, cb) < 0)
|
||||
* err;
|
||||
* printf("%s", cbuf_get(cb));
|
||||
* cbuf_free(cb);
|
||||
* @endcode
|
||||
* @see clixon_err_netconf_fn
|
||||
*/
|
||||
int
|
||||
netconf_err2cb(clixon_handle h,
|
||||
cxobj *xerr,
|
||||
cbuf *cberr)
|
||||
{
|
||||
int retval = -1;
|
||||
cxobj *x;
|
||||
|
||||
if ((x = xml_find_type(xerr, NULL, "error-type", CX_ELMNT)) != NULL)
|
||||
cprintf(cberr, "%s ", xml_body(x));
|
||||
if ((x = xml_find_type(xerr, NULL, "error-tag", CX_ELMNT)) != NULL)
|
||||
cprintf(cberr, "%s ", xml_body(x));
|
||||
if ((x = xml_find_type(xerr, NULL, "error-message", CX_ELMNT)) != NULL)
|
||||
cprintf(cberr, "%s ", xml_body(x));
|
||||
if ((x = xml_find_type(xerr, NULL, "error-info", CX_ELMNT)) != NULL &&
|
||||
xml_child_nr(x) > 0){
|
||||
if (clixon_xml2cbuf(cberr, xml_child_i(x, 0), 0, 0, NULL, -1, 0) < 0)
|
||||
goto done;
|
||||
}
|
||||
if ((x = xml_find_type(xerr, NULL, "error-app-tag", CX_ELMNT)) != NULL)
|
||||
cprintf(cberr, ": %s ", xml_body(x));
|
||||
if ((x = xml_find_type(xerr, NULL, "error-path", CX_ELMNT)) != NULL)
|
||||
cprintf(cberr, ": %s ", xml_body(x));
|
||||
retval = 0;
|
||||
done:
|
||||
return retval;
|
||||
}
|
||||
|
||||
/*! Report an error.
|
||||
*
|
||||
* Do not use this fn directly, use the clixon_err() macro
|
||||
* Library routines should call this function when an error occurs.
|
||||
* The function does he following:
|
||||
* - Logs to syslog with LOG_ERR
|
||||
|
|
@ -351,46 +404,71 @@ clixon_err_args(clixon_handle h,
|
|||
* @param[in] line Inline file line number (when called from clixon_err() macro)
|
||||
* @param[in] category Clixon error category, See enum clixon_err
|
||||
* @param[in] suberr Error number, typically errno
|
||||
* @param[in] xerr Optional netconf error xml tree on the form: [rpc-reply/]rpc-error
|
||||
* @param[in] format Error string, format with argv
|
||||
* @retval 0 OK
|
||||
* @retval -1 Error
|
||||
* @see clixon_err_netconf For variant with netconf error message
|
||||
* @see clixon_err_netconf_fn For variant with netconf error message
|
||||
*/
|
||||
int
|
||||
clixon_err_fn(const char *fn,
|
||||
const int line,
|
||||
int category,
|
||||
int suberr,
|
||||
const char *format, ...)
|
||||
clixon_err_fn(clixon_handle h,
|
||||
const char *fn,
|
||||
const int line,
|
||||
int category,
|
||||
int suberr,
|
||||
cxobj *xerr,
|
||||
const char *format, ...)
|
||||
{
|
||||
int retval = -1;
|
||||
va_list args;
|
||||
int len;
|
||||
char *msg = NULL;
|
||||
int retval = -1;
|
||||
va_list ap;
|
||||
cbuf *cb = NULL;
|
||||
|
||||
/* first round: compute length of error message */
|
||||
va_start(args, format);
|
||||
len = vsnprintf(NULL, 0, format, args);
|
||||
va_end(args);
|
||||
/* allocate a message string exactly fitting the message length */
|
||||
if ((msg = malloc(len+1)) == NULL){
|
||||
fprintf(stderr, "malloc: %s\n", strerror(errno)); /* dont use clixon_err here due to recursion */
|
||||
if (h == NULL) /* Accept NULL, use saved clixon handle */
|
||||
h = _err_clixon_h;
|
||||
if (xerr){
|
||||
/* Accept xml errors on formats:
|
||||
* <rpc-reply><rpc-error>,
|
||||
* <rpc-error>
|
||||
*/
|
||||
if (strcmp(xml_name(xerr), "rpc-reply") == 0)
|
||||
xerr = xml_find_type(xerr, NULL, "rpc-error", CX_ELMNT);
|
||||
if (strcmp(xml_name(xerr), "rpc-error") != 0){
|
||||
errno = EINVAL;
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
va_start(ap, format);
|
||||
if (clixon_plugin_errmsg_all(h, fn, line, LOG_TYPE_ERR,
|
||||
&category, &suberr, xerr, format, ap, &cb) < 0)
|
||||
goto done;
|
||||
va_end(ap);
|
||||
if (cb != NULL){ /* Customized: expand clixon_err_args */
|
||||
strncpy(_err_reason, cbuf_get(cb), ERR_STRLEN-1);
|
||||
_err_category = category;
|
||||
_err_subnr = suberr;
|
||||
clixon_log_fn(h, 0, LOG_ERR, xerr, "%s", cbuf_get(cb));
|
||||
goto ok;
|
||||
}
|
||||
if ((cb = cbuf_new()) == NULL){
|
||||
fprintf(stderr, "cbuf_new: %s\n", strerror(errno));
|
||||
goto done;
|
||||
}
|
||||
/* second round: compute write message from format and args */
|
||||
va_start(args, format);
|
||||
if (vsnprintf(msg, len+1, format, args) < 0){
|
||||
va_end(args);
|
||||
fprintf(stderr, "vsnprintf: %s\n", strerror(errno)); /* dont use clixon_err here due to recursion */
|
||||
goto done;
|
||||
va_start(ap, format);
|
||||
vcprintf(cb, format, ap);
|
||||
va_end(ap);
|
||||
if (xerr) {
|
||||
cprintf(cb, ": ");
|
||||
/* Translate netconf error to string */
|
||||
if (netconf_err2cb(h, xerr, cb) < 0)
|
||||
goto done;
|
||||
}
|
||||
va_end(args);
|
||||
if (clixon_err_args(_err_clixon_h, fn, line, category, suberr, msg) < 0)
|
||||
if (clixon_err_args(h, fn, line, category, suberr, cbuf_get(cb)) < 0)
|
||||
goto done;
|
||||
ok:
|
||||
retval = 0;
|
||||
done:
|
||||
if (msg)
|
||||
free(msg);
|
||||
if (cb)
|
||||
cbuf_free(cb);
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -50,6 +50,7 @@
|
|||
#include <string.h>
|
||||
#include <signal.h>
|
||||
#include <syslog.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
|
|
@ -58,6 +59,8 @@
|
|||
#include "clixon_queue.h"
|
||||
#include "clixon_hash.h"
|
||||
#include "clixon_handle.h"
|
||||
#include "clixon_yang.h"
|
||||
#include "clixon_xml.h"
|
||||
#include "clixon_log.h"
|
||||
#include "clixon_debug.h"
|
||||
#include "clixon_err.h"
|
||||
|
|
|
|||
|
|
@ -60,6 +60,8 @@
|
|||
#include "clixon_hash.h"
|
||||
#include "clixon_handle.h"
|
||||
#include "clixon_string.h"
|
||||
#include "clixon_yang.h"
|
||||
#include "clixon_xml.h"
|
||||
#include "clixon_err.h"
|
||||
#include "clixon_log.h"
|
||||
#include "clixon_debug.h"
|
||||
|
|
|
|||
|
|
@ -53,11 +53,11 @@
|
|||
#include "clixon_queue.h"
|
||||
#include "clixon_hash.h"
|
||||
#include "clixon_handle.h"
|
||||
#include "clixon_log.h"
|
||||
#include "clixon_debug.h"
|
||||
#include "clixon_err.h"
|
||||
#include "clixon_yang.h"
|
||||
#include "clixon_xml.h"
|
||||
#include "clixon_err.h"
|
||||
#include "clixon_log.h"
|
||||
#include "clixon_debug.h"
|
||||
#include "clixon_stream.h"
|
||||
#include "clixon_data.h"
|
||||
#include "clixon_options.h"
|
||||
|
|
|
|||
|
|
@ -97,6 +97,8 @@
|
|||
#include "clixon_queue.h"
|
||||
#include "clixon_hash.h"
|
||||
#include "clixon_handle.h"
|
||||
#include "clixon_yang.h"
|
||||
#include "clixon_xml.h"
|
||||
#include "clixon_err.h"
|
||||
|
||||
#define HASH_SIZE 1031 /* Number of hash buckets. Should be a prime */
|
||||
|
|
|
|||
|
|
@ -64,10 +64,10 @@
|
|||
#include "clixon_hash.h"
|
||||
#include "clixon_handle.h"
|
||||
#include "clixon_yang.h"
|
||||
#include "clixon_log.h"
|
||||
#include "clixon_debug.h"
|
||||
#include "clixon_string.h"
|
||||
#include "clixon_xml.h"
|
||||
#include "clixon_log.h"
|
||||
#include "clixon_debug.h"
|
||||
#include "clixon_path.h"
|
||||
#include "clixon_instance_id_parse.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -119,11 +119,11 @@
|
|||
#include "clixon_string.h"
|
||||
#include "clixon_hash.h"
|
||||
#include "clixon_handle.h"
|
||||
#include "clixon_yang.h"
|
||||
#include "clixon_xml.h"
|
||||
#include "clixon_err.h"
|
||||
#include "clixon_log.h"
|
||||
#include "clixon_debug.h"
|
||||
#include "clixon_yang.h"
|
||||
#include "clixon_xml.h"
|
||||
#include "clixon_path.h"
|
||||
#include "clixon_instance_id_parse.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -62,12 +62,12 @@
|
|||
#include "clixon_string.h"
|
||||
#include "clixon_hash.h"
|
||||
#include "clixon_handle.h"
|
||||
#include "clixon_yang.h"
|
||||
#include "clixon_xml.h"
|
||||
#include "clixon_err.h"
|
||||
#include "clixon_log.h"
|
||||
#include "clixon_debug.h"
|
||||
#include "clixon_options.h"
|
||||
#include "clixon_yang.h"
|
||||
#include "clixon_xml.h"
|
||||
#include "clixon_yang_type.h"
|
||||
#include "clixon_yang_module.h"
|
||||
#include "clixon_xml_sort.h"
|
||||
|
|
|
|||
|
|
@ -45,6 +45,7 @@
|
|||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
#include <errno.h>
|
||||
#include <sys/param.h>
|
||||
#include <netinet/in.h>
|
||||
|
||||
#include "clixon_json_parse.tab.h" /* generated */
|
||||
|
|
@ -56,9 +57,9 @@
|
|||
#include "clixon_handle.h"
|
||||
#include "clixon_string.h"
|
||||
#include "clixon_yang.h"
|
||||
#include "clixon_xml.h"
|
||||
#include "clixon_log.h"
|
||||
#include "clixon_debug.h"
|
||||
#include "clixon_xml.h"
|
||||
#include "clixon_json_parse.h"
|
||||
|
||||
/* Redefine main lex function so that you can send arguments to it: _yy is added to arg list */
|
||||
|
|
|
|||
|
|
@ -128,12 +128,12 @@ object.
|
|||
#include "clixon_queue.h"
|
||||
#include "clixon_hash.h"
|
||||
#include "clixon_handle.h"
|
||||
#include "clixon_yang.h"
|
||||
#include "clixon_xml.h"
|
||||
#include "clixon_err.h"
|
||||
#include "clixon_log.h"
|
||||
#include "clixon_debug.h"
|
||||
#include "clixon_string.h"
|
||||
#include "clixon_yang.h"
|
||||
#include "clixon_xml.h"
|
||||
|
||||
#include "clixon_json_parse.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -50,6 +50,7 @@
|
|||
#include <string.h>
|
||||
#include <time.h>
|
||||
#include <errno.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
|
|
@ -60,9 +61,14 @@
|
|||
#include "clixon_queue.h"
|
||||
#include "clixon_hash.h"
|
||||
#include "clixon_handle.h"
|
||||
#include "clixon_yang.h"
|
||||
#include "clixon_xml.h"
|
||||
#include "clixon_err.h"
|
||||
#include "clixon_debug.h"
|
||||
#include "clixon_log.h"
|
||||
#include "clixon_xml_io.h"
|
||||
#include "clixon_yang_module.h"
|
||||
#include "clixon_plugin.h"
|
||||
|
||||
/*
|
||||
* Local Variables
|
||||
|
|
@ -320,58 +326,68 @@ clixon_log_str(int level,
|
|||
|
||||
/*! Make a logging call to syslog using variable arg syntax.
|
||||
*
|
||||
* @param[in] h Clixon handle (may be NULL)
|
||||
* @param[in] level Log level, eg LOG_DEBUG,LOG_INFO,...,LOG_EMERG. This
|
||||
* is OR:d with facility == LOG_USER
|
||||
* @param[in] format Message to print as argv.
|
||||
* @retval 0 OK
|
||||
* @retval -1 Error
|
||||
* Do not use this fn directly, use the clixon_log() macro
|
||||
* @param[in] h Clixon handle (may be NULL)
|
||||
* @param[in] user If set, invoke user callback
|
||||
* @param[in] level Log level, eg LOG_DEBUG,LOG_INFO,...,LOG_EMERG. This
|
||||
* is OR:d with facility == LOG_USER
|
||||
* @param[in] x XML tree that is logged without prettyprint
|
||||
* @param[in] format Message to print as argv.
|
||||
* @retval 0 OK
|
||||
* @retval -1 Error
|
||||
* @code
|
||||
clixon_log(h, LOG_NOTICE, "%s: dump to dtd not supported", __PROGRAM__);
|
||||
* @endcode
|
||||
* @see clixon_log_init clixon_log_str
|
||||
* @see clixon_log_xml
|
||||
* The reason the "user" parameter is present is that internal calls (eg from clixon_err) may not
|
||||
* want to invoke user callbacks a second time.
|
||||
*/
|
||||
int
|
||||
clixon_log(clixon_handle h,
|
||||
int level,
|
||||
const char *format, ...)
|
||||
clixon_log_fn(clixon_handle h,
|
||||
int user,
|
||||
int level,
|
||||
cxobj *x,
|
||||
const char *format, ...)
|
||||
{
|
||||
int retval = -1;
|
||||
va_list args;
|
||||
size_t len;
|
||||
char *msg = NULL;
|
||||
va_list ap;
|
||||
size_t trunc;
|
||||
cbuf *cb = NULL;
|
||||
|
||||
/* first round: compute length of debug message */
|
||||
va_start(args, format);
|
||||
len = vsnprintf(NULL, 0, format, args);
|
||||
va_end(args);
|
||||
|
||||
if (h == NULL) /* Accept NULL, use saved clixon handle */
|
||||
h = _log_clixon_h;
|
||||
if (user){
|
||||
va_start(ap, format);
|
||||
if (clixon_plugin_errmsg_all(h, NULL, 0, LOG_TYPE_LOG,
|
||||
NULL, NULL, x, format, ap, &cb) < 0)
|
||||
goto done;
|
||||
va_end(ap);
|
||||
if (cb != NULL){ /* Customized: expand clixon_err_args */
|
||||
clixon_log(h, LOG_ERR, "%s", cbuf_get(cb));
|
||||
goto ok;
|
||||
}
|
||||
}
|
||||
if ((cb = cbuf_new()) == NULL){
|
||||
fprintf(stderr, "cbuf_new: %s\n", strerror(errno));
|
||||
goto done;
|
||||
}
|
||||
va_start(ap, format);
|
||||
vcprintf(cb, format, ap);
|
||||
va_end(ap);
|
||||
if (x){
|
||||
cprintf(cb, ": ");
|
||||
if (clixon_xml2cbuf(cb, x, 0, 0, NULL, -1, 0) < 0)
|
||||
goto done;
|
||||
}
|
||||
/* Truncate long debug strings */
|
||||
if ((trunc = clixon_log_string_limit_get()) && trunc < len)
|
||||
len = trunc;
|
||||
|
||||
/* allocate a message string exactly fitting the message length */
|
||||
if ((msg = malloc(len+1)) == NULL){
|
||||
fprintf(stderr, "malloc: %s\n", strerror(errno)); /* dont use clixon_err here due to recursion */
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* second round: compute write message from format and args */
|
||||
va_start(args, format);
|
||||
if (vsnprintf(msg, len+1, format, args) < 0){
|
||||
va_end(args);
|
||||
fprintf(stderr, "vsnprintf: %s\n", strerror(errno)); /* dont use clixon_err here due to recursion */
|
||||
goto done;
|
||||
}
|
||||
va_end(args);
|
||||
if ((trunc = clixon_log_string_limit_get()) && trunc < cbuf_len(cb))
|
||||
cbuf_trunc(cb, trunc);
|
||||
/* Actually log it */
|
||||
clixon_log_str(level, msg);
|
||||
|
||||
clixon_log_str(level, cbuf_get(cb));
|
||||
ok:
|
||||
retval = 0;
|
||||
done:
|
||||
if (msg)
|
||||
free(msg);
|
||||
done:
|
||||
if (cb)
|
||||
cbuf_free(cb);
|
||||
return retval;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -58,11 +58,11 @@
|
|||
#include "clixon_hash.h"
|
||||
#include "clixon_string.h"
|
||||
#include "clixon_handle.h"
|
||||
#include "clixon_yang.h"
|
||||
#include "clixon_xml.h"
|
||||
#include "clixon_err.h"
|
||||
#include "clixon_log.h"
|
||||
#include "clixon_debug.h"
|
||||
#include "clixon_yang.h"
|
||||
#include "clixon_xml.h"
|
||||
#include "clixon_options.h"
|
||||
#include "clixon_data.h"
|
||||
#include "clixon_netconf_lib.h"
|
||||
|
|
|
|||
|
|
@ -66,11 +66,11 @@
|
|||
#include "clixon_hash.h"
|
||||
#include "clixon_string.h"
|
||||
#include "clixon_handle.h"
|
||||
#include "clixon_yang.h"
|
||||
#include "clixon_xml.h"
|
||||
#include "clixon_err.h"
|
||||
#include "clixon_log.h"
|
||||
#include "clixon_debug.h"
|
||||
#include "clixon_yang.h"
|
||||
#include "clixon_xml.h"
|
||||
#include "clixon_xml_io.h"
|
||||
#include "clixon_proto.h"
|
||||
#include "clixon_netconf_lib.h"
|
||||
|
|
|
|||
|
|
@ -60,11 +60,11 @@
|
|||
#include "clixon_hash.h"
|
||||
#include "clixon_string.h"
|
||||
#include "clixon_handle.h"
|
||||
#include "clixon_yang.h"
|
||||
#include "clixon_xml.h"
|
||||
#include "clixon_err.h"
|
||||
#include "clixon_log.h"
|
||||
#include "clixon_debug.h"
|
||||
#include "clixon_yang.h"
|
||||
#include "clixon_xml.h"
|
||||
#include "clixon_options.h"
|
||||
#include "clixon_data.h"
|
||||
#include "clixon_xml_bind.h"
|
||||
|
|
@ -2337,126 +2337,3 @@ netconf_input_chunked_framing(char ch,
|
|||
retval = -1; /* Error */
|
||||
goto done;
|
||||
}
|
||||
|
||||
/*! Generate netconf error msg to cbuf using callback to use in string printout or logs
|
||||
*
|
||||
* If no callback is registered, a default error message is genereated
|
||||
* @param[in] xerr Netconf error message on the level: <rpc-error>
|
||||
* @param[out] cberr Translation from netconf err to cbuf.
|
||||
* @retval 0 OK, with cberr set
|
||||
* @retval -1 Error
|
||||
* @code
|
||||
* cbuf *cb = NULL;
|
||||
* if ((cb = cbuf_new()) ==NULL){
|
||||
* err;
|
||||
* if (netconf_err2cb(h, xerr, cb) < 0)
|
||||
* err;
|
||||
* printf("%s", cbuf_get(cb));
|
||||
* cbuf_free(cb);
|
||||
* @endcode
|
||||
* @see clixon_err_netconf_fn
|
||||
*/
|
||||
int
|
||||
netconf_err2cb(clixon_handle h,
|
||||
cxobj *xerr,
|
||||
cbuf *cberr)
|
||||
{
|
||||
int retval = -1;
|
||||
cxobj *x;
|
||||
size_t len;
|
||||
|
||||
// XXX: some calls are <rpc-reply><rpc-error>, change calls instead
|
||||
if (strcmp(xml_name(xerr), "rpc-error") != 0)
|
||||
xerr = xml_child_i_type(xerr, 0, CX_ELMNT);
|
||||
len = cbuf_len(cberr);
|
||||
if (clixon_plugin_netconf_errmsg_all(h, xerr, cberr) < 0)
|
||||
goto done;
|
||||
if (cbuf_len(cberr) == len){ /* Same as on-entry, use default */
|
||||
if ((x=xpath_first(xerr, NULL, "//error-type"))!=NULL)
|
||||
cprintf(cberr, "%s ", xml_body(x));
|
||||
if ((x=xpath_first(xerr, NULL, "//error-tag"))!=NULL)
|
||||
cprintf(cberr, "%s ", xml_body(x));
|
||||
if ((x=xpath_first(xerr, NULL, "//error-message"))!=NULL)
|
||||
cprintf(cberr, "%s ", xml_body(x));
|
||||
if ((x=xpath_first(xerr, NULL, "//error-info")) != NULL &&
|
||||
xml_child_nr(x) > 0){
|
||||
if (clixon_xml2cbuf(cberr, xml_child_i(x, 0), 0, 0, NULL, -1, 0) < 0)
|
||||
goto done;
|
||||
}
|
||||
if ((x=xpath_first(xerr, NULL, "//error-app-tag"))!=NULL)
|
||||
cprintf(cberr, ": %s ", xml_body(x));
|
||||
if ((x=xpath_first(xerr, NULL, "//error-path"))!=NULL)
|
||||
cprintf(cberr, ": %s ", xml_body(x));
|
||||
}
|
||||
retval = 0;
|
||||
done:
|
||||
return retval;
|
||||
}
|
||||
|
||||
/*! Generate and print textual error log from Netconf error message
|
||||
*
|
||||
* Get a text error message from netconf error message and generate error logmsg:
|
||||
* <msg>: "<arg>": <netconf-error> or <msg>: <netconf-error>
|
||||
*
|
||||
* @param[in] h Clixon handle
|
||||
* @param[in] fn Inline function name (when called from clixon_err() macro)
|
||||
* @param[in] line Inline file line number (when called from clixon_err() macro)
|
||||
* @param[in] xerr Netconf error xml tree on the form: <rpc-error>
|
||||
* @param[in] format Format string
|
||||
* @param[in] arg String argument to format (optional)
|
||||
* @retval 0 OK
|
||||
* @retval -1 Error
|
||||
* @see netconf_err2cb
|
||||
* @see clixon_err_netconf macro
|
||||
*/
|
||||
int
|
||||
clixon_err_netconf_fn(clixon_handle h,
|
||||
const char *fn,
|
||||
const int line,
|
||||
int category,
|
||||
int suberr,
|
||||
cxobj *xerr,
|
||||
const char *format, ...)
|
||||
{
|
||||
int retval = -1;
|
||||
va_list args;
|
||||
int len;
|
||||
char *msg = NULL;
|
||||
cbuf *cb = NULL;
|
||||
|
||||
/* first round: compute length of error message */
|
||||
va_start(args, format);
|
||||
len = vsnprintf(NULL, 0, format, args);
|
||||
va_end(args);
|
||||
|
||||
/* allocate a message string exactly fitting the message length */
|
||||
if ((msg = malloc(len+1)) == NULL){
|
||||
fprintf(stderr, "malloc: %s\n", strerror(errno)); /* dont use clixon_err here due to recursion */
|
||||
goto done;
|
||||
}
|
||||
/* second round: compute write message from format and args */
|
||||
va_start(args, format);
|
||||
if (vsnprintf(msg, len+1, format, args) < 0){
|
||||
va_end(args);
|
||||
fprintf(stderr, "vsnprintf: %s\n", strerror(errno)); /* dont use clixon_err here due to recursion */
|
||||
goto done;
|
||||
}
|
||||
va_end(args);
|
||||
if ((cb = cbuf_new()) == NULL){
|
||||
clixon_err(OE_XML, errno, "cbuf_new");
|
||||
goto done;
|
||||
}
|
||||
cprintf(cb, "%s: ", msg);
|
||||
/* Translate netconf error to string */
|
||||
if (netconf_err2cb(h, xerr, cb) < 0)
|
||||
goto done;
|
||||
if (clixon_err_args(h, fn, line, category, suberr, cbuf_get(cb)) < 0)
|
||||
goto done;
|
||||
retval = 0;
|
||||
done:
|
||||
if (msg)
|
||||
free(msg);
|
||||
if (cb)
|
||||
cbuf_free(cb);
|
||||
return retval;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -55,11 +55,11 @@
|
|||
#include "clixon_queue.h"
|
||||
#include "clixon_hash.h"
|
||||
#include "clixon_handle.h"
|
||||
#include "clixon_yang.h"
|
||||
#include "clixon_xml.h"
|
||||
#include "clixon_err.h"
|
||||
#include "clixon_log.h"
|
||||
#include "clixon_debug.h"
|
||||
#include "clixon_yang.h"
|
||||
#include "clixon_xml.h"
|
||||
#include "clixon_yang_module.h"
|
||||
#include "clixon_xml_io.h"
|
||||
#include "clixon_netconf_lib.h"
|
||||
|
|
|
|||
|
|
@ -44,6 +44,8 @@
|
|||
#include "clixon_queue.h"
|
||||
#include "clixon_hash.h"
|
||||
#include "clixon_handle.h"
|
||||
#include "clixon_yang.h"
|
||||
#include "clixon_xml.h"
|
||||
#include "clixon_err.h"
|
||||
#include "clixon_log.h"
|
||||
#include "clixon_debug.h"
|
||||
|
|
|
|||
|
|
@ -66,13 +66,13 @@
|
|||
#include "clixon_queue.h"
|
||||
#include "clixon_hash.h"
|
||||
#include "clixon_handle.h"
|
||||
#include "clixon_yang.h"
|
||||
#include "clixon_xml.h"
|
||||
#include "clixon_err.h"
|
||||
#include "clixon_log.h"
|
||||
#include "clixon_debug.h"
|
||||
#include "clixon_string.h"
|
||||
#include "clixon_file.h"
|
||||
#include "clixon_yang.h"
|
||||
#include "clixon_xml.h"
|
||||
#include "clixon_xml_sort.h"
|
||||
#include "clixon_json.h"
|
||||
#include "clixon_text_syntax.h"
|
||||
|
|
|
|||
|
|
@ -88,12 +88,12 @@
|
|||
#include "clixon_hash.h"
|
||||
#include "clixon_handle.h"
|
||||
#include "clixon_string.h"
|
||||
#include "clixon_yang.h"
|
||||
#include "clixon_xml.h"
|
||||
#include "clixon_err.h"
|
||||
#include "clixon_log.h"
|
||||
#include "clixon_debug.h"
|
||||
#include "clixon_options.h"
|
||||
#include "clixon_yang.h"
|
||||
#include "clixon_xml.h"
|
||||
#include "clixon_xml_nsctx.h"
|
||||
#include "clixon_xml_vec.h"
|
||||
#include "clixon_xml_sort.h"
|
||||
|
|
@ -1215,7 +1215,7 @@ api_path2xml_vec(char **vec,
|
|||
* @param[in] strict Break if api-path is not "complete" otherwise ignore and continue
|
||||
* @param[out] xbotp Resulting xml tree (end of xpath) (optional)
|
||||
* @param[out] ybotp Yang spec matching xbotp
|
||||
* @param[out] xerr Netconf error message (if retval=0)
|
||||
* @param[out] xerr Netconf error message as rpc-reply/rpc-error (if retval=0)
|
||||
* @retval 1 OK
|
||||
* @retval 0 Invalid api_path or associated XML, netconf error
|
||||
* @retval -1 Fatal error
|
||||
|
|
|
|||
|
|
@ -59,13 +59,13 @@
|
|||
#include "clixon_string.h"
|
||||
#include "clixon_hash.h"
|
||||
#include "clixon_handle.h"
|
||||
#include "clixon_yang.h"
|
||||
#include "clixon_xml.h"
|
||||
#include "clixon_err.h"
|
||||
#include "clixon_log.h"
|
||||
#include "clixon_debug.h"
|
||||
#include "clixon_file.h"
|
||||
#include "clixon_yang.h"
|
||||
#include "clixon_options.h"
|
||||
#include "clixon_xml.h"
|
||||
#include "clixon_xml_nsctx.h"
|
||||
#include "clixon_xml_map.h"
|
||||
#include "clixon_yang_module.h"
|
||||
|
|
@ -797,7 +797,6 @@ clixon_plugin_datastore_upgrade_one(clixon_plugin_t *cp,
|
|||
const char *db,
|
||||
cxobj *xt,
|
||||
modstate_diff_t *msd)
|
||||
|
||||
{
|
||||
int retval = -1;
|
||||
datastore_upgrade_t *fn;
|
||||
|
|
@ -985,32 +984,47 @@ clixon_plugin_yang_patch_all(clixon_handle h,
|
|||
return retval;
|
||||
}
|
||||
|
||||
/*! Callback plugin to customize Netconf error message
|
||||
/*! Call plugin to customize log, error, or debug message
|
||||
*
|
||||
* @param[in] cp Plugin handle
|
||||
* @param[in] h Clixon handle
|
||||
* @param[in] xerr Netconf error message on the level: <rpc-error>
|
||||
* @param[out] cberr Translation from netconf err to cbuf.
|
||||
* @retval 0 OK
|
||||
* @retval -1 Error
|
||||
* The plugin creates cbmsg as a positive result, it may also modify category and suberr
|
||||
* @param[in] cp Plugin handle
|
||||
* @param[in] h Clixon handle
|
||||
* @param[in] fn Inline function name (when called from clixon_err() macro)
|
||||
* @param[in] line Inline file line number (when called from clixon_err() macro)
|
||||
* @param[in] type Log message type
|
||||
* @param[in,out] category Clixon error category, See enum clixon_err
|
||||
* @param[in,out] suberr Error number, typically errno
|
||||
* @param[in] xerr Netconf error xml tree on the form: <rpc-error>
|
||||
* @param[in] format Format string
|
||||
* @param[in] ap Variable argument list
|
||||
* @param[out] cbmsg Log string as cbuf, if set bypass ordinary logging
|
||||
* @retval 0 OK
|
||||
* @retval -1 Error
|
||||
*/
|
||||
int
|
||||
clixon_plugin_netconf_errmsg_one(clixon_plugin_t *cp,
|
||||
clixon_handle h,
|
||||
cxobj *xerr,
|
||||
cbuf *cberr)
|
||||
clixon_plugin_errmsg_one(clixon_plugin_t *cp,
|
||||
clixon_handle h,
|
||||
const char *fn0,
|
||||
const int line,
|
||||
enum clixon_log_type type,
|
||||
int *category,
|
||||
int *suberr,
|
||||
cxobj *xerr,
|
||||
const char *format,
|
||||
va_list ap,
|
||||
cbuf **cbmsg)
|
||||
{
|
||||
int retval = -1;
|
||||
netconf_errmsg_t *fn;
|
||||
void *wh = NULL;
|
||||
int retval = -1;
|
||||
errmsg_t *fn;
|
||||
void *wh = NULL;
|
||||
|
||||
if ((fn = cp->cp_api.ca_errmsg) != NULL){
|
||||
wh = NULL;
|
||||
if (clixon_resource_check(h, &wh, cp->cp_name, __FUNCTION__) < 0)
|
||||
goto done;
|
||||
if (fn(h, xerr, cberr) < 0) {
|
||||
if (fn(h, fn0, line, type, category, suberr, xerr, format, ap, cbmsg) < 0) {
|
||||
if (clixon_err_category() < 0)
|
||||
clixon_log(h, LOG_WARNING, "%s: Internal error: Netconf err callback in plugin: %s returned -1 but did not make a clixon_err call",
|
||||
clixon_log(h, LOG_WARNING, "%s: Internal error: Logmsg callback in plugin: %s returned -1 but did not make a clixon_err call",
|
||||
__FUNCTION__, cp->cp_name);
|
||||
clixon_resource_check(h, &wh, cp->cp_name, __FUNCTION__);
|
||||
goto done;
|
||||
|
|
@ -1023,25 +1037,44 @@ clixon_plugin_netconf_errmsg_one(clixon_plugin_t *cp,
|
|||
return retval;
|
||||
}
|
||||
|
||||
/*! Call plugin customize Netconf error message
|
||||
/*! Call plugin to customize log, error, or debug message
|
||||
*
|
||||
* @param[in] h Clixon handle
|
||||
* @param[in] xerr Netconf error message on the level: <rpc-error>
|
||||
* @param[out] cberr Translation from netconf err to cbuf.
|
||||
* @retval 0 OK
|
||||
* @retval -1 Error
|
||||
* @param[in] h Clixon handle
|
||||
* @param[in] fn Inline function name (when called from clixon_err() macro)
|
||||
* @param[in] line Inline file line number (when called from clixon_err() macro)
|
||||
* @param[in] type Log message type
|
||||
* @param[in,out] category Clixon error category, See enum clixon_err
|
||||
* @param[in,out] suberr Error number, typically errno
|
||||
* @param[in] xerr Netconf error xml tree on the form: <rpc-error>
|
||||
* @param[in] format Format string
|
||||
* @param[in] ap Variable argument list
|
||||
* @param[out] cbmsg Log string as cbuf, if set bypass ordinary logging
|
||||
* @retval 0 OK
|
||||
* @retval -1 Error
|
||||
*/
|
||||
int
|
||||
clixon_plugin_netconf_errmsg_all(clixon_handle h,
|
||||
cxobj *xerr,
|
||||
cbuf *cberr)
|
||||
clixon_plugin_errmsg_all(clixon_handle h,
|
||||
const char *fn,
|
||||
const int line,
|
||||
enum clixon_log_type type,
|
||||
int *category,
|
||||
int *suberr,
|
||||
cxobj *xerr,
|
||||
const char *format,
|
||||
va_list ap,
|
||||
cbuf **cbmsg)
|
||||
{
|
||||
int retval = -1;
|
||||
int retval = -1;
|
||||
clixon_plugin_t *cp = NULL;
|
||||
|
||||
while ((cp = clixon_plugin_each(h, cp)) != NULL) {
|
||||
if (clixon_plugin_netconf_errmsg_one(cp, h, xerr, cberr) < 0)
|
||||
goto done;
|
||||
if (h != NULL){ /* Silently ignore if not properly init:d */
|
||||
*cbmsg = NULL;
|
||||
while ((cp = clixon_plugin_each(h, cp)) != NULL) {
|
||||
if (clixon_plugin_errmsg_one(cp, h, fn, line, type, category, suberr, xerr, format, ap, cbmsg) < 0)
|
||||
goto done;
|
||||
if (*cbmsg != NULL)
|
||||
break;
|
||||
}
|
||||
}
|
||||
retval = 0;
|
||||
done:
|
||||
|
|
|
|||
|
|
@ -115,6 +115,8 @@
|
|||
#include "clixon_queue.h"
|
||||
#include "clixon_hash.h"
|
||||
#include "clixon_handle.h"
|
||||
#include "clixon_yang.h"
|
||||
#include "clixon_xml.h"
|
||||
#include "clixon_err.h"
|
||||
#include "clixon_log.h"
|
||||
#include "clixon_debug.h"
|
||||
|
|
@ -124,8 +126,6 @@
|
|||
#include "clixon_sig.h"
|
||||
#include "clixon_string.h"
|
||||
#include "clixon_queue.h"
|
||||
#include "clixon_yang.h"
|
||||
#include "clixon_xml.h"
|
||||
#include "clixon_netconf_lib.h"
|
||||
#include "clixon_proc.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -69,12 +69,12 @@
|
|||
#include "clixon_hash.h"
|
||||
#include "clixon_handle.h"
|
||||
#include "clixon_event.h"
|
||||
#include "clixon_yang.h"
|
||||
#include "clixon_xml.h"
|
||||
#include "clixon_err.h"
|
||||
#include "clixon_log.h"
|
||||
#include "clixon_debug.h"
|
||||
#include "clixon_yang.h"
|
||||
#include "clixon_sig.h"
|
||||
#include "clixon_xml.h"
|
||||
#include "clixon_xml_io.h"
|
||||
#include "clixon_netconf_lib.h"
|
||||
#include "clixon_options.h"
|
||||
|
|
|
|||
|
|
@ -61,11 +61,11 @@
|
|||
#include "clixon_queue.h"
|
||||
#include "clixon_hash.h"
|
||||
#include "clixon_handle.h"
|
||||
#include "clixon_yang.h"
|
||||
#include "clixon_xml.h"
|
||||
#include "clixon_err.h"
|
||||
#include "clixon_log.h"
|
||||
#include "clixon_debug.h"
|
||||
#include "clixon_yang.h"
|
||||
#include "clixon_xml.h"
|
||||
#include "clixon_options.h"
|
||||
#include "clixon_data.h"
|
||||
#include "clixon_yang_module.h"
|
||||
|
|
@ -1441,7 +1441,7 @@ clicon_rpc_validate(clixon_handle h,
|
|||
goto done;
|
||||
if (clicon_rpc_msg(h, msg, &xret) < 0)
|
||||
goto done;
|
||||
if ((xerr = xpath_first(xret, NULL, "//rpc-error")) != NULL){
|
||||
if ((xerr = xpath_first(xret, NULL, "rpc-reply/rpc-error")) != NULL){
|
||||
clixon_err_netconf(h, OE_NETCONF, 0, xerr, CLIXON_ERRSTR_VALIDATE_FAILED);
|
||||
retval = 0;
|
||||
goto done;
|
||||
|
|
|
|||
|
|
@ -59,10 +59,11 @@
|
|||
#include "clixon_queue.h"
|
||||
#include "clixon_hash.h"
|
||||
#include "clixon_handle.h"
|
||||
#include "clixon_yang.h"
|
||||
#include "clixon_xml.h"
|
||||
#include "clixon_err.h"
|
||||
#include "clixon_log.h"
|
||||
#include "clixon_debug.h"
|
||||
#include "clixon_yang.h"
|
||||
#include "clixon_options.h"
|
||||
#include "clixon_regex.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -55,6 +55,8 @@
|
|||
#include "clixon_queue.h"
|
||||
#include "clixon_hash.h"
|
||||
#include "clixon_handle.h"
|
||||
#include "clixon_yang.h"
|
||||
#include "clixon_xml.h"
|
||||
#include "clixon_err.h"
|
||||
#include "clixon_log.h"
|
||||
#include "clixon_debug.h"
|
||||
|
|
|
|||
|
|
@ -74,12 +74,12 @@
|
|||
#include "clixon_string.h"
|
||||
#include "clixon_hash.h"
|
||||
#include "clixon_handle.h"
|
||||
#include "clixon_yang.h"
|
||||
#include "clixon_xml.h"
|
||||
#include "clixon_err.h"
|
||||
#include "clixon_log.h"
|
||||
#include "clixon_debug.h"
|
||||
#include "clixon_event.h"
|
||||
#include "clixon_yang.h"
|
||||
#include "clixon_xml.h"
|
||||
#include "clixon_xml_io.h"
|
||||
#include "clixon_netconf_lib.h"
|
||||
#include "clixon_options.h"
|
||||
|
|
|
|||
|
|
@ -52,6 +52,8 @@
|
|||
#include "clixon_hash.h"
|
||||
#include "clixon_handle.h"
|
||||
#include "clixon_string.h"
|
||||
#include "clixon_yang.h"
|
||||
#include "clixon_xml.h"
|
||||
#include "clixon_err.h"
|
||||
|
||||
/*! Split string into a vector based on character delimiters. Using malloc
|
||||
|
|
|
|||
|
|
@ -56,12 +56,12 @@
|
|||
#include "clixon_string.h"
|
||||
#include "clixon_hash.h"
|
||||
#include "clixon_handle.h"
|
||||
#include "clixon_yang.h"
|
||||
#include "clixon_xml.h"
|
||||
#include "clixon_err.h"
|
||||
#include "clixon_log.h"
|
||||
#include "clixon_debug.h"
|
||||
#include "clixon_options.h"
|
||||
#include "clixon_yang.h"
|
||||
#include "clixon_xml.h"
|
||||
#include "clixon_xml_io.h"
|
||||
#include "clixon_xml_sort.h"
|
||||
#include "clixon_xml_nsctx.h"
|
||||
|
|
|
|||
|
|
@ -73,12 +73,12 @@
|
|||
#include "clixon_queue.h"
|
||||
#include "clixon_hash.h"
|
||||
#include "clixon_handle.h"
|
||||
#include "clixon_yang.h"
|
||||
#include "clixon_xml.h"
|
||||
#include "clixon_err.h"
|
||||
#include "clixon_log.h"
|
||||
#include "clixon_debug.h"
|
||||
#include "clixon_string.h"
|
||||
#include "clixon_yang.h"
|
||||
#include "clixon_xml.h"
|
||||
#include "clixon_xml_nsctx.h"
|
||||
#include "clixon_xml_vec.h"
|
||||
#include "clixon_data.h"
|
||||
|
|
|
|||
|
|
@ -62,6 +62,8 @@
|
|||
#include "clixon_queue.h"
|
||||
#include "clixon_hash.h"
|
||||
#include "clixon_handle.h"
|
||||
#include "clixon_yang.h"
|
||||
#include "clixon_xml.h"
|
||||
#include "clixon_err.h"
|
||||
#include "clixon_log.h"
|
||||
#include "clixon_debug.h"
|
||||
|
|
|
|||
|
|
@ -61,11 +61,11 @@
|
|||
#include "clixon_hash.h"
|
||||
#include "clixon_handle.h"
|
||||
#include "clixon_string.h"
|
||||
#include "clixon_yang.h"
|
||||
#include "clixon_xml.h"
|
||||
#include "clixon_err.h"
|
||||
#include "clixon_log.h"
|
||||
#include "clixon_debug.h"
|
||||
#include "clixon_yang.h"
|
||||
#include "clixon_xml.h"
|
||||
#include "clixon_data.h"
|
||||
#include "clixon_netconf_lib.h"
|
||||
#include "clixon_options.h"
|
||||
|
|
@ -985,7 +985,7 @@ check_mandatory(cxobj *xt,
|
|||
* 1. Check if mandatory leafs present as subs.
|
||||
* 2. Check leaf values, eg int ranges and string regexps.
|
||||
* @param[in] xt XML node to be validated
|
||||
* @param[out] xret Error XML tree. Free with xml_free after use
|
||||
* @param[out] xret Error XML tree, as rpc-reply/rpc-error. Free with xml_free after use
|
||||
* @retval 1 Validation OK
|
||||
* @retval 0 Validation failed (cbret set)
|
||||
* @retval -1 Error
|
||||
|
|
|
|||
|
|
@ -61,11 +61,11 @@
|
|||
#include "clixon_hash.h"
|
||||
#include "clixon_handle.h"
|
||||
#include "clixon_string.h"
|
||||
#include "clixon_yang.h"
|
||||
#include "clixon_xml.h"
|
||||
#include "clixon_err.h"
|
||||
#include "clixon_log.h"
|
||||
#include "clixon_debug.h"
|
||||
#include "clixon_yang.h"
|
||||
#include "clixon_xml.h"
|
||||
#include "clixon_data.h"
|
||||
#include "clixon_netconf_lib.h"
|
||||
#include "clixon_options.h"
|
||||
|
|
|
|||
|
|
@ -62,11 +62,11 @@
|
|||
#include "clixon_queue.h"
|
||||
#include "clixon_hash.h"
|
||||
#include "clixon_handle.h"
|
||||
#include "clixon_yang.h"
|
||||
#include "clixon_xml.h"
|
||||
#include "clixon_err.h"
|
||||
#include "clixon_log.h"
|
||||
#include "clixon_debug.h"
|
||||
#include "clixon_yang.h"
|
||||
#include "clixon_xml.h"
|
||||
#include "clixon_options.h" /* xml_bind_yang */
|
||||
#include "clixon_yang_module.h"
|
||||
#include "clixon_xml_map.h" /* xml_bind_yang */
|
||||
|
|
@ -2699,139 +2699,6 @@ xml_add_attr(cxobj *xn,
|
|||
goto ret;
|
||||
}
|
||||
|
||||
/*! Specialization of clixon_log with xml tree
|
||||
*
|
||||
* @param[in] h Clixon handle
|
||||
* @param[in] dbglevel
|
||||
* @param[in] level log level, eg LOG_DEBUG,LOG_INFO,...,LOG_EMERG.
|
||||
* @param[in] x XML tree that is logged without prettyprint
|
||||
* @param[in] format Message to print as argv.
|
||||
* @retval 0 OK
|
||||
* @retval -1 Error
|
||||
* @see clixon_debug_xml which uses debug setting instead of direct syslog
|
||||
*/
|
||||
int
|
||||
clixon_log_xml(clixon_handle h,
|
||||
int level,
|
||||
cxobj *x,
|
||||
const char *format, ...)
|
||||
{
|
||||
int retval = -1;
|
||||
va_list args;
|
||||
size_t len;
|
||||
char *msg = NULL;
|
||||
cbuf *cb = NULL;
|
||||
size_t trunc;
|
||||
|
||||
/* Print xml as cbuf */
|
||||
if ((cb = cbuf_new()) == NULL){
|
||||
clixon_err(OE_XML, errno, "cbuf_new");
|
||||
goto done;
|
||||
}
|
||||
if (clixon_xml2cbuf(cb, x, 0, 0, NULL, -1, 0) < 0)
|
||||
goto done;
|
||||
/* first round: compute length of debug message */
|
||||
va_start(args, format);
|
||||
len = vsnprintf(NULL, 0, format, args);
|
||||
va_end(args);
|
||||
/* Truncate long debug strings */
|
||||
if ((trunc = clixon_log_string_limit_get()) && trunc < len)
|
||||
len = trunc;
|
||||
|
||||
/* allocate a message string exactly fitting the message length */
|
||||
if ((msg = malloc(len+1)) == NULL){
|
||||
fprintf(stderr, "malloc: %s\n", strerror(errno)); /* dont use clixon_err here due to recursion */
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* second round: compute write message from format and args */
|
||||
va_start(args, format);
|
||||
if (vsnprintf(msg, len+1, format, args) < 0){
|
||||
va_end(args);
|
||||
fprintf(stderr, "vsnprintf: %s\n", strerror(errno)); /* dont use clixon_err here due to recursion */
|
||||
goto done;
|
||||
}
|
||||
va_end(args);
|
||||
|
||||
/* Actually log it */
|
||||
clixon_log(h, level, "%s: %s", msg, cbuf_get(cb));
|
||||
|
||||
retval = 0;
|
||||
done:
|
||||
if (cb)
|
||||
cbuf_free(cb);
|
||||
if (msg)
|
||||
free(msg);
|
||||
return retval;
|
||||
}
|
||||
|
||||
/*! Specialization of clixon_debug with xml tree
|
||||
*
|
||||
* @param[in] dbglevel Mask of CLIXON_DBG_DEFAULT and other masks
|
||||
* @param[in] x XML tree that is logged without prettyprint
|
||||
* @param[in] format Message to print as argv.
|
||||
* @retval 0 OK
|
||||
* @retval -1 Error
|
||||
* @see clicon_log_xml For syslog
|
||||
* @see clixon_debug base function and see CLIXON_DBG_* flags
|
||||
*/
|
||||
int
|
||||
clixon_debug_xml(int dbglevel,
|
||||
cxobj *x,
|
||||
const char *format, ...)
|
||||
{
|
||||
int retval = -1;
|
||||
va_list args;
|
||||
size_t len;
|
||||
char *msg = NULL;
|
||||
cbuf *cb = NULL;
|
||||
size_t trunc;
|
||||
|
||||
/* Mask debug level with global dbg variable */
|
||||
if ((dbglevel & clixon_debug_get()) == 0)
|
||||
return 0;
|
||||
/* Print xml as cbuf */
|
||||
if ((cb = cbuf_new()) == NULL){
|
||||
clixon_err(OE_XML, errno, "cbuf_new");
|
||||
goto done;
|
||||
}
|
||||
if (clixon_xml2cbuf(cb, x, 0, 0, NULL, -1, 0) < 0)
|
||||
goto done;
|
||||
/* first round: compute length of debug message */
|
||||
va_start(args, format);
|
||||
len = vsnprintf(NULL, 0, format, args);
|
||||
va_end(args);
|
||||
/* Truncate long debug strings */
|
||||
if ((trunc = clixon_log_string_limit_get()) && trunc < len)
|
||||
len = trunc;
|
||||
|
||||
/* allocate a message string exactly fitting the message length */
|
||||
if ((msg = malloc(len+1)) == NULL){
|
||||
fprintf(stderr, "malloc: %s\n", strerror(errno)); /* dont use clixon_err here due to recursion */
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* second round: compute write message from format and args */
|
||||
va_start(args, format);
|
||||
if (vsnprintf(msg, len+1, format, args) < 0){
|
||||
va_end(args);
|
||||
fprintf(stderr, "vsnprintf: %s\n", strerror(errno)); /* dont use clixon_err here due to recursion */
|
||||
goto done;
|
||||
}
|
||||
va_end(args);
|
||||
|
||||
/* Actually log it */
|
||||
clixon_debug(dbglevel, "%s: %s", msg, cbuf_get(cb));
|
||||
|
||||
retval = 0;
|
||||
done:
|
||||
if (cb)
|
||||
cbuf_free(cb);
|
||||
if (msg)
|
||||
free(msg);
|
||||
return retval;
|
||||
}
|
||||
|
||||
#ifdef XML_EXPLICIT_INDEX
|
||||
/*! Is this XML object a search index, ie it is registered as a yang clixon cc:search_index
|
||||
*
|
||||
|
|
|
|||
|
|
@ -61,21 +61,20 @@
|
|||
#include "clixon_queue.h"
|
||||
#include "clixon_hash.h"
|
||||
#include "clixon_handle.h"
|
||||
#include "clixon_log.h"
|
||||
#include "clixon_debug.h"
|
||||
#include "clixon_err.h"
|
||||
#include "clixon_string.h"
|
||||
#include "clixon_yang.h"
|
||||
#include "clixon_xml.h"
|
||||
#include "clixon_log.h"
|
||||
#include "clixon_debug.h"
|
||||
#include "clixon_err.h"
|
||||
#include "clixon_options.h"
|
||||
#include "clixon_data.h"
|
||||
#include "clixon_yang_module.h"
|
||||
#include "clixon_yang_schema_mount.h"
|
||||
#include "clixon_plugin.h"
|
||||
#include "clixon_xml_nsctx.h"
|
||||
#include "clixon_xpath_ctx.h"
|
||||
#include "clixon_xpath.h"
|
||||
#include "clixon_netconf_lib.h"
|
||||
#include "clixon_yang_module.h"
|
||||
#include "clixon_plugin.h"
|
||||
#include "clixon_xml_sort.h"
|
||||
#include "clixon_yang_type.h"
|
||||
|
|
|
|||
|
|
@ -61,11 +61,11 @@
|
|||
#include "clixon_hash.h"
|
||||
#include "clixon_string.h"
|
||||
#include "clixon_handle.h"
|
||||
#include "clixon_err.h"
|
||||
#include "clixon_yang.h"
|
||||
#include "clixon_xml.h"
|
||||
#include "clixon_err.h"
|
||||
#include "clixon_log.h"
|
||||
#include "clixon_debug.h"
|
||||
#include "clixon_xml.h"
|
||||
#include "clixon_options.h"
|
||||
#include "clixon_data.h"
|
||||
#include "clixon_yang_module.h"
|
||||
|
|
@ -469,10 +469,7 @@ clixon_xml_changelog_init(clixon_handle h)
|
|||
clixon_err(OE_XML, errno, "cbuf_new");
|
||||
goto done;
|
||||
}
|
||||
if (netconf_err2cb(h, xret, cbret) < 0)
|
||||
goto done;
|
||||
clixon_err(OE_YANG, 0, "validation failed: %s", cbuf_get(cbret));
|
||||
goto done;
|
||||
clixon_err_netconf(h, OE_YANG, 0, xret, "validation failed");
|
||||
}
|
||||
if (clicon_xml_changelog_set(h, xt) < 0)
|
||||
goto done;
|
||||
|
|
|
|||
|
|
@ -60,11 +60,11 @@
|
|||
#include "clixon_hash.h"
|
||||
#include "clixon_string.h"
|
||||
#include "clixon_handle.h"
|
||||
#include "clixon_log.h"
|
||||
#include "clixon_debug.h"
|
||||
#include "clixon_err.h"
|
||||
#include "clixon_yang.h"
|
||||
#include "clixon_xml.h"
|
||||
#include "clixon_err.h"
|
||||
#include "clixon_log.h"
|
||||
#include "clixon_debug.h"
|
||||
#include "clixon_xpath_ctx.h"
|
||||
#include "clixon_xpath.h"
|
||||
#include "clixon_data.h"
|
||||
|
|
|
|||
|
|
@ -61,11 +61,11 @@
|
|||
#include "clixon_queue.h"
|
||||
#include "clixon_hash.h"
|
||||
#include "clixon_handle.h"
|
||||
#include "clixon_yang.h"
|
||||
#include "clixon_xml.h"
|
||||
#include "clixon_err.h"
|
||||
#include "clixon_log.h"
|
||||
#include "clixon_debug.h"
|
||||
#include "clixon_yang.h"
|
||||
#include "clixon_xml.h"
|
||||
#include "clixon_options.h"
|
||||
#include "clixon_yang_module.h"
|
||||
#include "clixon_xml_bind.h"
|
||||
|
|
|
|||
|
|
@ -61,12 +61,12 @@
|
|||
#include "clixon_queue.h"
|
||||
#include "clixon_hash.h"
|
||||
#include "clixon_handle.h"
|
||||
#include "clixon_log.h"
|
||||
#include "clixon_debug.h"
|
||||
#include "clixon_err.h"
|
||||
#include "clixon_string.h"
|
||||
#include "clixon_yang.h"
|
||||
#include "clixon_xml.h"
|
||||
#include "clixon_log.h"
|
||||
#include "clixon_debug.h"
|
||||
#include "clixon_err.h"
|
||||
#include "clixon_options.h"
|
||||
#include "clixon_data.h"
|
||||
#include "clixon_yang_module.h"
|
||||
|
|
|
|||
|
|
@ -62,12 +62,12 @@
|
|||
#include "clixon_queue.h"
|
||||
#include "clixon_hash.h"
|
||||
#include "clixon_handle.h"
|
||||
#include "clixon_yang.h"
|
||||
#include "clixon_xml.h"
|
||||
#include "clixon_err.h"
|
||||
#include "clixon_log.h"
|
||||
#include "clixon_debug.h"
|
||||
#include "clixon_options.h"
|
||||
#include "clixon_yang.h"
|
||||
#include "clixon_xml.h"
|
||||
#include "clixon_yang_module.h"
|
||||
#include "clixon_netconf_lib.h"
|
||||
#include "clixon_xml_sort.h"
|
||||
|
|
|
|||
|
|
@ -76,13 +76,13 @@
|
|||
#include "clixon_queue.h"
|
||||
#include "clixon_hash.h"
|
||||
#include "clixon_handle.h"
|
||||
#include "clixon_yang.h"
|
||||
#include "clixon_xml.h"
|
||||
#include "clixon_err.h"
|
||||
#include "clixon_log.h"
|
||||
#include "clixon_debug.h"
|
||||
#include "clixon_string.h"
|
||||
#include "clixon_handle.h"
|
||||
#include "clixon_yang.h"
|
||||
#include "clixon_xml.h"
|
||||
#include "clixon_xml_sort.h"
|
||||
#include "clixon_xml_parse.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -58,11 +58,11 @@
|
|||
#include "clixon_queue.h"
|
||||
#include "clixon_hash.h"
|
||||
#include "clixon_handle.h"
|
||||
#include "clixon_yang.h"
|
||||
#include "clixon_xml.h"
|
||||
#include "clixon_err.h"
|
||||
#include "clixon_log.h"
|
||||
#include "clixon_debug.h"
|
||||
#include "clixon_yang.h"
|
||||
#include "clixon_xml.h"
|
||||
#include "clixon_xml_nsctx.h"
|
||||
#include "clixon_xml_io.h"
|
||||
#include "clixon_xpath_ctx.h"
|
||||
|
|
|
|||
|
|
@ -57,11 +57,11 @@
|
|||
#include "clixon_queue.h"
|
||||
#include "clixon_hash.h"
|
||||
#include "clixon_handle.h"
|
||||
#include "clixon_yang.h"
|
||||
#include "clixon_xml.h"
|
||||
#include "clixon_err.h"
|
||||
#include "clixon_log.h"
|
||||
#include "clixon_debug.h"
|
||||
#include "clixon_yang.h"
|
||||
#include "clixon_xml.h"
|
||||
#include "clixon_xml_io.h"
|
||||
#include "clixon_xml_vec.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -85,11 +85,11 @@
|
|||
#include "clixon_queue.h"
|
||||
#include "clixon_hash.h"
|
||||
#include "clixon_handle.h"
|
||||
#include "clixon_yang.h"
|
||||
#include "clixon_xml.h"
|
||||
#include "clixon_err.h"
|
||||
#include "clixon_log.h"
|
||||
#include "clixon_debug.h"
|
||||
#include "clixon_yang.h"
|
||||
#include "clixon_xml.h"
|
||||
#include "clixon_xml_nsctx.h"
|
||||
#include "clixon_netconf_lib.h"
|
||||
#include "clixon_yang_module.h"
|
||||
|
|
|
|||
|
|
@ -55,11 +55,11 @@
|
|||
#include "clixon_queue.h"
|
||||
#include "clixon_hash.h"
|
||||
#include "clixon_handle.h"
|
||||
#include "clixon_yang.h"
|
||||
#include "clixon_xml.h"
|
||||
#include "clixon_err.h"
|
||||
#include "clixon_log.h"
|
||||
#include "clixon_debug.h"
|
||||
#include "clixon_yang.h"
|
||||
#include "clixon_xml.h"
|
||||
#include "clixon_xpath_ctx.h"
|
||||
#include "clixon_xpath.h"
|
||||
#include "clixon_xpath_parse.h"
|
||||
|
|
|
|||
|
|
@ -77,12 +77,12 @@
|
|||
#include "clixon_queue.h"
|
||||
#include "clixon_hash.h"
|
||||
#include "clixon_handle.h"
|
||||
#include "clixon_yang.h"
|
||||
#include "clixon_xml.h"
|
||||
#include "clixon_err.h"
|
||||
#include "clixon_log.h"
|
||||
#include "clixon_debug.h"
|
||||
#include "clixon_yang.h"
|
||||
#include "clixon_yang_type.h"
|
||||
#include "clixon_xml.h"
|
||||
#include "clixon_xml_sort.h"
|
||||
#include "clixon_xml_nsctx.h"
|
||||
#include "clixon_xpath_ctx.h"
|
||||
|
|
|
|||
|
|
@ -59,13 +59,13 @@
|
|||
#include "clixon_queue.h"
|
||||
#include "clixon_hash.h"
|
||||
#include "clixon_handle.h"
|
||||
#include "clixon_yang.h"
|
||||
#include "clixon_xml.h"
|
||||
#include "clixon_err.h"
|
||||
#include "clixon_log.h"
|
||||
#include "clixon_debug.h"
|
||||
#include "clixon_options.h"
|
||||
#include "clixon_yang.h"
|
||||
#include "clixon_yang_type.h"
|
||||
#include "clixon_xml.h"
|
||||
#include "clixon_xml_map.h"
|
||||
#include "clixon_yang_module.h"
|
||||
#include "clixon_validate.h"
|
||||
|
|
|
|||
|
|
@ -59,11 +59,11 @@
|
|||
#include "clixon_queue.h"
|
||||
#include "clixon_hash.h"
|
||||
#include "clixon_handle.h"
|
||||
#include "clixon_yang.h"
|
||||
#include "clixon_xml.h"
|
||||
#include "clixon_err.h"
|
||||
#include "clixon_log.h"
|
||||
#include "clixon_debug.h"
|
||||
#include "clixon_yang.h"
|
||||
#include "clixon_xml.h"
|
||||
#include "clixon_xml_vec.h"
|
||||
#include "clixon_xml_sort.h"
|
||||
#include "clixon_xpath_ctx.h"
|
||||
|
|
|
|||
|
|
@ -72,10 +72,10 @@ There are some special lexical rules in https://www.w3.org/TR/xpath-10
|
|||
#include "clixon_hash.h"
|
||||
#include "clixon_handle.h"
|
||||
#include "clixon_yang.h"
|
||||
#include "clixon_log.h"
|
||||
#include "clixon_debug.h"
|
||||
#include "clixon_string.h"
|
||||
#include "clixon_xml.h"
|
||||
#include "clixon_log.h"
|
||||
#include "clixon_debug.h"
|
||||
#include "clixon_xpath_ctx.h"
|
||||
#include "clixon_xpath.h"
|
||||
#include "clixon_xpath_parse.h"
|
||||
|
|
|
|||
|
|
@ -121,12 +121,12 @@
|
|||
#include "clixon_queue.h"
|
||||
#include "clixon_hash.h"
|
||||
#include "clixon_handle.h"
|
||||
#include "clixon_yang.h"
|
||||
#include "clixon_xml.h"
|
||||
#include "clixon_err.h"
|
||||
#include "clixon_log.h"
|
||||
#include "clixon_debug.h"
|
||||
#include "clixon_string.h"
|
||||
#include "clixon_yang.h"
|
||||
#include "clixon_xml.h"
|
||||
#include "clixon_xpath_ctx.h"
|
||||
#include "clixon_xpath.h"
|
||||
#include "clixon_xpath_function.h"
|
||||
|
|
|
|||
|
|
@ -58,11 +58,11 @@
|
|||
#include "clixon_queue.h"
|
||||
#include "clixon_hash.h"
|
||||
#include "clixon_handle.h"
|
||||
#include "clixon_yang.h"
|
||||
#include "clixon_xml.h"
|
||||
#include "clixon_err.h"
|
||||
#include "clixon_log.h"
|
||||
#include "clixon_debug.h"
|
||||
#include "clixon_yang.h"
|
||||
#include "clixon_xml.h"
|
||||
#include "clixon_xml_nsctx.h"
|
||||
#include "clixon_yang_module.h"
|
||||
#include "clixon_xpath_ctx.h"
|
||||
|
|
|
|||
|
|
@ -68,13 +68,13 @@
|
|||
#include "clixon_queue.h"
|
||||
#include "clixon_hash.h"
|
||||
#include "clixon_handle.h"
|
||||
#include "clixon_log.h"
|
||||
#include "clixon_debug.h"
|
||||
#include "clixon_err.h"
|
||||
#include "clixon_file.h"
|
||||
#include "clixon_yang.h"
|
||||
#include "clixon_hash.h"
|
||||
#include "clixon_xml.h"
|
||||
#include "clixon_err.h"
|
||||
#include "clixon_log.h"
|
||||
#include "clixon_debug.h"
|
||||
#include "clixon_xml_nsctx.h"
|
||||
#include "clixon_yang_module.h"
|
||||
#include "clixon_plugin.h"
|
||||
|
|
|
|||
|
|
@ -63,8 +63,9 @@
|
|||
#include "clixon_queue.h"
|
||||
#include "clixon_hash.h"
|
||||
#include "clixon_handle.h"
|
||||
#include "clixon_err.h"
|
||||
#include "clixon_yang.h"
|
||||
#include "clixon_xml.h"
|
||||
#include "clixon_err.h"
|
||||
#include "clixon_yang_cardinality.h"
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -65,12 +65,12 @@
|
|||
#include "clixon_queue.h"
|
||||
#include "clixon_hash.h"
|
||||
#include "clixon_handle.h"
|
||||
#include "clixon_log.h"
|
||||
#include "clixon_debug.h"
|
||||
#include "clixon_err.h"
|
||||
#include "clixon_file.h"
|
||||
#include "clixon_yang.h"
|
||||
#include "clixon_xml.h"
|
||||
#include "clixon_err.h"
|
||||
#include "clixon_log.h"
|
||||
#include "clixon_debug.h"
|
||||
#include "clixon_xml_io.h"
|
||||
#include "clixon_xml_nsctx.h"
|
||||
#include "clixon_xpath_ctx.h"
|
||||
|
|
|
|||
|
|
@ -191,10 +191,11 @@
|
|||
#include "clixon_string.h"
|
||||
#include "clixon_hash.h"
|
||||
#include "clixon_handle.h"
|
||||
#include "clixon_yang.h"
|
||||
#include "clixon_xml.h"
|
||||
#include "clixon_err.h"
|
||||
#include "clixon_log.h"
|
||||
#include "clixon_debug.h"
|
||||
#include "clixon_yang.h"
|
||||
#include "clixon_yang_parse_lib.h"
|
||||
#include "clixon_yang_parse.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -79,13 +79,13 @@
|
|||
#include "clixon_queue.h"
|
||||
#include "clixon_hash.h"
|
||||
#include "clixon_handle.h"
|
||||
#include "clixon_file.h"
|
||||
#include "clixon_hash.h"
|
||||
#include "clixon_yang.h"
|
||||
#include "clixon_xml.h"
|
||||
#include "clixon_log.h"
|
||||
#include "clixon_debug.h"
|
||||
#include "clixon_err.h"
|
||||
#include "clixon_file.h"
|
||||
#include "clixon_yang.h"
|
||||
#include "clixon_hash.h"
|
||||
#include "clixon_xml.h"
|
||||
#include "clixon_xml_nsctx.h"
|
||||
#include "clixon_xpath_ctx.h"
|
||||
#include "clixon_xpath.h"
|
||||
|
|
|
|||
|
|
@ -71,11 +71,11 @@
|
|||
#include "clixon_hash.h"
|
||||
#include "clixon_string.h"
|
||||
#include "clixon_handle.h"
|
||||
#include "clixon_yang.h"
|
||||
#include "clixon_xml.h"
|
||||
#include "clixon_err.h"
|
||||
#include "clixon_log.h"
|
||||
#include "clixon_debug.h"
|
||||
#include "clixon_yang.h"
|
||||
#include "clixon_xml.h"
|
||||
#include "clixon_xml_io.h"
|
||||
#include "clixon_xml_map.h"
|
||||
#include "clixon_data.h"
|
||||
|
|
|
|||
|
|
@ -83,11 +83,11 @@
|
|||
#include "clixon_hash.h"
|
||||
#include "clixon_string.h"
|
||||
#include "clixon_handle.h"
|
||||
#include "clixon_yang.h"
|
||||
#include "clixon_xml.h"
|
||||
#include "clixon_err.h"
|
||||
#include "clixon_log.h"
|
||||
#include "clixon_debug.h"
|
||||
#include "clixon_yang.h"
|
||||
#include "clixon_xml.h"
|
||||
#include "clixon_yang_module.h"
|
||||
#include "clixon_xml_vec.h"
|
||||
#include "clixon_data.h"
|
||||
|
|
@ -107,7 +107,7 @@ clixon_yang_schemanode_parseerror(void *arg,
|
|||
{
|
||||
clixon_yang_schemanode_yacc *ife = (clixon_yang_schemanode_yacc *)arg;
|
||||
|
||||
clixon_err_fn(NULL, 0, OE_YANG, 0, "yang_schemanode_parse: file:%s:%d \"%s\" %s: at or before: %s",
|
||||
clixon_err(OE_YANG, 0, "yang_schemanode_parse: file:%s:%d \"%s\" %s: at or before: %s",
|
||||
ife->if_mainfile,
|
||||
ife->if_linenum,
|
||||
ife->if_parse_string,
|
||||
|
|
|
|||
|
|
@ -51,10 +51,11 @@
|
|||
#include "clixon_queue.h"
|
||||
#include "clixon_hash.h"
|
||||
#include "clixon_handle.h"
|
||||
#include "clixon_yang.h"
|
||||
#include "clixon_xml.h"
|
||||
#include "clixon_log.h"
|
||||
#include "clixon_debug.h"
|
||||
#include "clixon_err.h"
|
||||
#include "clixon_yang.h"
|
||||
#include "clixon_yang_sub_parse.h"
|
||||
#include "clixon_yang_schemanode_parse.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -94,11 +94,11 @@
|
|||
#include "clixon_hash.h"
|
||||
#include "clixon_string.h"
|
||||
#include "clixon_handle.h"
|
||||
#include "clixon_yang.h"
|
||||
#include "clixon_xml.h"
|
||||
#include "clixon_err.h"
|
||||
#include "clixon_log.h"
|
||||
#include "clixon_debug.h"
|
||||
#include "clixon_yang.h"
|
||||
#include "clixon_xml.h"
|
||||
#include "clixon_yang_module.h"
|
||||
#include "clixon_xml_vec.h"
|
||||
#include "clixon_data.h"
|
||||
|
|
@ -113,11 +113,11 @@
|
|||
|
||||
void
|
||||
clixon_yang_sub_parseerror(void *arg,
|
||||
char *s)
|
||||
char *s)
|
||||
{
|
||||
clixon_yang_sub_parse_yacc *ife = (clixon_yang_sub_parse_yacc *)arg;
|
||||
|
||||
clixon_err_fn(NULL, 0, OE_YANG, 0, "yang_sub_parse: file:%s:%d \"%s\" %s: at or before: %s",
|
||||
clixon_err(OE_YANG, 0, "yang_sub_parse: file:%s:%d \"%s\" %s: at or before: %s",
|
||||
ife->if_mainfile,
|
||||
ife->if_linenum,
|
||||
ife->if_parse_string,
|
||||
|
|
|
|||
|
|
@ -89,9 +89,10 @@
|
|||
#include "clixon_hash.h"
|
||||
#include "clixon_handle.h"
|
||||
#include "clixon_regex.h"
|
||||
#include "clixon_err.h"
|
||||
#include "clixon_yang.h"
|
||||
#include "clixon_xml.h"
|
||||
#include "clixon_log.h"
|
||||
#include "clixon_err.h"
|
||||
#include "clixon_xml_nsctx.h"
|
||||
#include "clixon_xpath_ctx.h"
|
||||
#include "clixon_xpath.h"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue