+static inline u8
+vcl_session_is_closing (vcl_session_t * s)
+{
+ return (s->session_state == VCL_STATE_VPP_CLOSING
+ || s->session_state == VCL_STATE_DISCONNECT);
+}
+
+static inline u8
+vcl_session_is_closed (vcl_session_t * s)
+{
+ return (!s || (s->session_state == VCL_STATE_CLOSED));
+}
+
+static inline int
+vcl_session_closing_error (vcl_session_t * s)
+{
+ /* Return 0 on closing sockets */
+ return s->session_state == VCL_STATE_DISCONNECT ? VPPCOM_ECONNRESET : 0;
+}
+
+static inline int
+vcl_session_closed_error (vcl_session_t * s)
+{
+ return s->session_state == VCL_STATE_DISCONNECT
+ ? VPPCOM_ECONNRESET : VPPCOM_ENOTCONN;
+}
+
+static inline void
+vcl_ip_copy_from_ep (ip46_address_t * ip, vppcom_endpt_t * ep)
+{
+ if (ep->is_ip4)
+ clib_memcpy_fast (&ip->ip4, ep->ip, sizeof (ip4_address_t));
+ else
+ clib_memcpy_fast (&ip->ip6, ep->ip, sizeof (ip6_address_t));
+}
+
+static inline void
+vcl_ip_copy_to_ep (ip46_address_t * ip, vppcom_endpt_t * ep, u8 is_ip4)
+{
+ ep->is_ip4 = is_ip4;
+ if (is_ip4)
+ clib_memcpy_fast (ep->ip, &ip->ip4, sizeof (ip4_address_t));
+ else
+ clib_memcpy_fast (ep->ip, &ip->ip6, sizeof (ip6_address_t));
+}
+
+static inline int
+vcl_proto_is_dgram (uint8_t proto)
+{
+ return proto == VPPCOM_PROTO_UDP;
+}
+
+static inline u8
+vcl_session_has_attr (vcl_session_t * s, u8 attr)
+{
+ return (s->attributes & (1 << attr)) ? 1 : 0;
+}
+
+static inline void
+vcl_session_set_attr (vcl_session_t * s, u8 attr)
+{
+ s->attributes |= 1 << attr;
+}
+
+static inline void
+vcl_session_clear_attr (vcl_session_t * s, u8 attr)
+{
+ s->attributes &= ~(1 << attr);
+}
+
+/*
+ * Helpers
+ */
+vcl_mq_evt_conn_t *vcl_mq_evt_conn_alloc (vcl_worker_t * wrk);
+u32 vcl_mq_evt_conn_index (vcl_worker_t * wrk, vcl_mq_evt_conn_t * mqc);
+vcl_mq_evt_conn_t *vcl_mq_evt_conn_get (vcl_worker_t * wrk, u32 mq_conn_idx);
+int vcl_mq_epoll_add_evfd (vcl_worker_t * wrk, svm_msg_q_t * mq);
+int vcl_mq_epoll_del_evfd (vcl_worker_t * wrk, u32 mqc_index);
+
+vcl_worker_t *vcl_worker_alloc_and_init (void);
+void vcl_worker_cleanup (vcl_worker_t * wrk, u8 notify_vpp);
+int vcl_worker_register_with_vpp (void);
+svm_msg_q_t *vcl_worker_ctrl_mq (vcl_worker_t * wrk);
+
+void vcl_flush_mq_events (void);
+int vcl_session_cleanup (vcl_worker_t * wrk, vcl_session_t * session,
+ vcl_session_handle_t sh, u8 do_disconnect);
+
+void vcl_segment_table_add (u64 segment_handle, u32 svm_segment_index);
+u32 vcl_segment_table_lookup (u64 segment_handle);
+void vcl_segment_table_del (u64 segment_handle);
+
+int vcl_session_read_ready (vcl_session_t * session);
+int vcl_session_write_ready (vcl_session_t * session);
+
+static inline vcl_worker_t *
+vcl_worker_get (u32 wrk_index)
+{
+ return pool_elt_at_index (vcm->workers, wrk_index);
+}
+
+static inline vcl_worker_t *
+vcl_worker_get_if_valid (u32 wrk_index)
+{
+ if (pool_is_free_index (vcm->workers, wrk_index))
+ return 0;
+ return pool_elt_at_index (vcm->workers, wrk_index);
+}
+
+static inline vcl_worker_t *
+vcl_worker_get_current (void)
+{
+ return vcl_worker_get (vcl_get_worker_index ());
+}
+
+static inline u8
+vcl_n_workers (void)
+{
+ return pool_elts (vcm->workers);
+}
+
+static inline svm_msg_q_t *
+vcl_session_vpp_evt_q (vcl_worker_t * wrk, vcl_session_t * s)
+{
+ return wrk->vpp_event_queues[s->vpp_thread_index];
+}
+
+static inline u64
+vcl_vpp_worker_segment_handle (u32 wrk_index)
+{
+ return (VCL_INVALID_SEGMENT_HANDLE - wrk_index - 1);
+}
+
+void vcl_send_session_worker_update (vcl_worker_t * wrk, vcl_session_t * s,
+ u32 wrk_index);
+int vcl_send_worker_rpc (u32 dst_wrk_index, void *data, u32 data_len);
+
+int vcl_segment_attach (u64 segment_handle, char *name,
+ ssvm_segment_type_t type, int fd);
+void vcl_segment_detach (u64 segment_handle);
+void vcl_send_session_unlisten (vcl_worker_t * wrk, vcl_session_t * s);