+static inline void
+vppcom_session_table_add_listener (u64 listener_handle, u32 value)
+{
+ /* Session and listener handles have different formats. The latter has
+ * the thread index in the upper 32 bits while the former has the session
+ * type. Knowing that, for listeners we just flip the MSB to 1 */
+ listener_handle |= 1ULL << 63;
+ hash_set (vcm->session_index_by_vpp_handles, listener_handle, value);
+}
+
+static inline session_t *
+vppcom_session_table_lookup_listener (u64 listener_handle)
+{
+ uword *p;
+ u64 handle = listener_handle | (1ULL << 63);
+ session_t *session;
+
+ p = hash_get (vcm->session_index_by_vpp_handles, handle);
+ if (!p)
+ {
+ clib_warning ("[%d] couldn't find listen session: unknown vpp "
+ "listener handle %llx", getpid (), listener_handle);
+ return 0;
+ }
+ if (pool_is_free_index (vcm->sessions, p[0]))
+ {
+ if (VPPCOM_DEBUG > 1)
+ clib_warning ("[%d] invalid listen session, sid (%u)", getpid (),
+ p[0]);
+ return 0;
+ }
+
+ session = pool_elt_at_index (vcm->sessions, p[0]);
+ ASSERT (session->is_listen);
+ return session;
+}
+
+static inline void
+vppcom_session_table_del_listener (u64 listener_handle)
+{
+ listener_handle |= 1ULL << 63;
+ hash_unset (vcm->session_index_by_vpp_handles, listener_handle);
+}
+
+static void
+write_elog (void)
+{
+ elog_main_t *em = &vcm->elog_main;
+ char *chroot_file;
+ clib_error_t *error = 0;
+
+ chroot_file =
+ (char *) format (0, "%s/%d-%d-vcl-elog%c", vcm->cfg.event_log_path,
+ vcm->my_client_index, getpid (), 0);
+ error = elog_write_file (em, chroot_file, 1 /* flush ring */ );
+ if (error)
+ {
+ clib_error_report (error);
+ }
+ if (VPPCOM_DEBUG > 0)
+ clib_warning ("[%d] Event Log:'%s' ", getpid (), chroot_file);
+
+}
+