- Restconf nghttp2 compiles

This commit is contained in:
Olof hagsand 2021-06-03 22:47:54 +02:00
parent 37da0aa45e
commit b680e3c5ac
13 changed files with 1375 additions and 378 deletions

View file

@ -70,19 +70,23 @@ enum clicon_err{
OE_SYSLOG, /* syslog error */
OE_ROUTING, /* routing daemon error (eg quagga) */
OE_XML, /* xml parsing etc */
OE_SSL, /* Openssl errors, see eg ssl_get_error */
OE_RESTCONF, /* RESTCONF errors */
OE_PLUGIN, /* plugin loading, etc */
OE_YANG , /* Yang error */
OE_FATAL, /* Fatal error */
OE_UNDEF,
/*-- From here error extensions using clixon_err_cat_reg, XXX register dynamically? --*/
OE_SSL, /* Openssl errors, see eg ssl_get_error */
OE_NGHTTP2, /* nghttp2 errors, see HAVE_LIBNGHTTP2 */
};
/* Clixon error category log callback
* @param[in] handle Application-specific handle
* @param[in] suberr Application-specific handle
* @param[out] cb Read log/error string into this buffer
*/
typedef int (clixon_cat_log_cb)(void *handle, cbuf *cb);
typedef int (clixon_cat_log_cb)(void *handle, int suberr, cbuf *cb);
/*
* Variables

View file

@ -116,12 +116,14 @@ static struct errvec EV[] = {
{"Syslog error", OE_SYSLOG},
{"Routing demon error", OE_ROUTING},
{"XML error", OE_XML},
{"OpenSSL error", OE_SSL},
{"RESTCONF error", OE_RESTCONF},
{"Plugins", OE_PLUGIN},
{"Yang error", OE_YANG},
{"FATAL", OE_FATAL},
{"Undefined", OE_UNDEF},
/* From here error extensions using clixon_err_cat_reg */
{"OpenSSL error", OE_SSL},
{"Nghttp2 error", OE_NGHTTP2},
{NULL, -1}
};
@ -224,7 +226,7 @@ clicon_err_fn(const char *fn,
va_end(args);
strncpy(clicon_err_reason, msg, ERR_STRLEN-1);
/* Check category callbacks */
/* Check category callbacks as defined in clixon_err_cat_reg */
if ((cec = find_category(category)) != NULL &&
cec->cec_logfn){
cbuf *cb = NULL;
@ -232,7 +234,7 @@ clicon_err_fn(const char *fn,
fprintf(stderr, "cbuf_new: %s\n", strerror(errno)); /* dont use clicon_err here due to recursion */
goto done;
}
if (cec->cec_logfn(cec->cec_handle, cb) < 0)
if (cec->cec_logfn(cec->cec_handle, suberr, cb) < 0)
goto done;
/* Here we could take care of specific errno, like application-defined errors */
clicon_log(LOG_ERR, "%s: %d: %s: %s: %s",