summaryrefslogtreecommitdiffstats
path: root/src/vnet/session/session_cli.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/vnet/session/session_cli.c')
-rw-r--r--src/vnet/session/session_cli.c52
1 files changed, 51 insertions, 1 deletions
diff --git a/src/vnet/session/session_cli.c b/src/vnet/session/session_cli.c
index b03353e564a..9264f47cca7 100644
--- a/src/vnet/session/session_cli.c
+++ b/src/vnet/session/session_cli.c
@@ -43,6 +43,52 @@ format_session_fifos (u8 * s, va_list * args)
return s;
}
+const char *session_state_str[] = {
+#define _(sym, str) str,
+ foreach_session_state
+#undef _
+};
+
+u8 *
+format_session_state (u8 * s, va_list * args)
+{
+ session_t *ss = va_arg (*args, session_t *);
+
+ if (ss->session_state < SESSION_N_STATES)
+ s = format (s, "%s", session_state_str[ss->session_state]);
+ else
+ s = format (s, "UNKNOWN STATE (%d)", ss->session_state);
+
+ return s;
+}
+
+const char *session_flags_str[] = {
+#define _(sym, str) str,
+ foreach_session_flag
+#undef _
+};
+
+u8 *
+format_session_flags (u8 * s, va_list * args)
+{
+ session_t *ss = va_arg (*args, session_t *);
+ int i, last = -1;
+
+ for (i = 0; i < SESSION_N_FLAGS; i++)
+ if (ss->flags & (1 << i))
+ last = i;
+
+ for (i = 0; i < last; i++)
+ {
+ if (ss->flags & (1 << i))
+ s = format (s, "%s, ", session_flags_str[i]);
+ }
+ if (last >= 0)
+ s = format (s, "%s", session_flags_str[last]);
+
+ return s;
+}
+
/**
* Format stream session as per the following format
*
@@ -85,7 +131,11 @@ format_session (u8 * s, va_list * args)
if (verbose == 1)
s = format (s, "%v", str);
if (verbose > 1)
- s = format (s, "%U", format_session_fifos, ss, verbose);
+ {
+ s = format (s, "%U", format_session_fifos, ss, verbose);
+ s = format (s, " session: state: %U flags: %U\n",
+ format_session_state, ss, format_session_flags, ss);
+ }
}
else if (ss->session_state == SESSION_STATE_LISTENING)
{