summaryrefslogtreecommitdiffstats
path: root/src/vnet/session/application_interface.h
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2019-10-21 16:07:46 -0700
committerDave Barach <openvpp@barachs.net>2020-04-03 22:10:22 +0000
commit00e01d3e875bb18397ff81e0f58f9b468477f473 (patch)
tree277b9ce692a465644de5d3481b42e6cce6394f46 /src/vnet/session/application_interface.h
parent39aa7a5202a6a875bd6f5d341cb07f19ab0bf51e (diff)
session: improve error reporting
Type: improvement Change-Id: I9dd850a1ce85b0adb5136233f176117e0ee38817 Signed-off-by: Florin Coras <fcoras@cisco.com>
Diffstat (limited to 'src/vnet/session/application_interface.h')
-rw-r--r--src/vnet/session/application_interface.h20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/vnet/session/application_interface.h b/src/vnet/session/application_interface.h
index b1ab847073a..7d5d044cc5a 100644
--- a/src/vnet/session/application_interface.h
+++ b/src/vnet/session/application_interface.h
@@ -42,7 +42,7 @@ typedef struct session_cb_vft_
/** Connection request callback */
int (*session_connected_callback) (u32 app_wrk_index, u32 opaque,
- session_t * s, u8 code);
+ session_t * s, session_error_t code);
/** Notify app that session is closing */
void (*session_disconnect_callback) (session_t * s);
@@ -741,6 +741,24 @@ app_recv (app_session_t * s, u8 * data, u32 len)
return app_recv_stream (s, data, len);
}
+/* *INDENT-OFF* */
+static char *session_error_str[] = {
+#define _(sym, str) str,
+ foreach_session_error
+#undef _
+};
+/* *INDENT-ON* */
+
+static inline u8 *
+format_session_error (u8 * s, va_list * args)
+{
+ session_error_t error = va_arg (*args, session_error_t);
+ if (-error >= 0 && -error < SESSION_N_ERRORS)
+ s = format (s, "%s", session_error_str[-error]);
+ else
+ s = format (s, "invalid session err %u", -error);
+ return s;
+}
#endif /* __included_uri_h__ */
/*