FEATURE: libnetconf errors passing
Errors during session connection can be passed into nc_callback_print().
They are passed to GUI by now samely as from nc_callback_error_reply().
diff --git a/src/mod_netconf.c b/src/mod_netconf.c
index 56d1542..09ca131 100644
--- a/src/mod_netconf.c
+++ b/src/mod_netconf.c
@@ -956,19 +956,21 @@
void clb_print(NC_VERB_LEVEL level, const char* msg)
{
+#define FOREACH(I) \
+ I(NC_VERB_ERROR) I(NC_VERB_WARNING) \
+ I(NC_VERB_VERBOSE) I(NC_VERB_DEBUG)
+#define CASE(VAL) case VAL: DEBUG("%s: %s", #VAL, msg); \
+ break;
+
switch (level) {
- case NC_VERB_ERROR:
- DEBUG("%s", msg);
- break;
- case NC_VERB_WARNING:
- DEBUG("%s", msg);
- break;
- case NC_VERB_VERBOSE:
- DEBUG("%s", msg);
- break;
- case NC_VERB_DEBUG:
- DEBUG("%s", msg);
- break;
+ FOREACH(CASE)
+ }
+ if (level == NC_VERB_ERROR) {
+ /* return global error */
+ netconf_callback_error_process(NULL /* tag */, NULL /* type */,
+ NULL /* severity */, NULL /* apptag */,
+ NULL /* path */, msg, NULL /* attribute */,
+ NULL /* element */, NULL /* ns */, NULL /* sid */);
}
}