+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);
+ 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;
+ }
+
+ return pool_elt_at_index (vcm->sessions, p[0]);
+}
+
+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);
+}
+