+ vl_msg_api_send_shmem (reg->vl_input_queue, (u8 *) & mp);
+
+ if (n_fds)
+ return session_send_fds (reg, fds, n_fds);
+
+ return 0;
+}
+
+static int
+send_del_segment_callback (u32 api_client_index, const ssvm_private_t * fs)
+{
+ vl_api_unmap_segment_t *mp;
+ vl_api_registration_t *reg;
+
+ reg = vl_mem_api_client_index_to_registration (api_client_index);
+ if (!reg)
+ {
+ clib_warning ("no registration: %u", api_client_index);
+ return -1;
+ }
+
+ mp = vl_mem_api_alloc_as_if_client_w_reg (reg, sizeof (*mp));
+ memset (mp, 0, sizeof (*mp));
+ mp->_vl_msg_id = clib_host_to_net_u16 (VL_API_UNMAP_SEGMENT);
+ strcpy ((char *) mp->segment_name, (char *) fs->name);
+
+ vl_msg_api_send_shmem (reg->vl_input_queue, (u8 *) & mp);
+
+ return 0;
+}
+
+static int
+send_app_cut_through_registration_add (u32 api_client_index, u64 mq_addr,
+ u64 peer_mq_addr)
+{
+ vl_api_app_cut_through_registration_add_t *mp;
+ vl_api_registration_t *reg;
+ svm_msg_q_t *mq, *peer_mq;
+ int fds[2];
+
+ reg = vl_mem_api_client_index_to_registration (api_client_index);
+ if (!reg)
+ {
+ clib_warning ("no registration: %u", api_client_index);
+ return -1;
+ }
+
+ mp = vl_mem_api_alloc_as_if_client_w_reg (reg, sizeof (*mp));
+ memset (mp, 0, sizeof (*mp));
+ mp->_vl_msg_id =
+ clib_host_to_net_u16 (VL_API_APP_CUT_THROUGH_REGISTRATION_ADD);
+
+ mp->evt_q_address = mq_addr;
+ mp->peer_evt_q_address = peer_mq_addr;
+
+ mq = uword_to_pointer (mq_addr, svm_msg_q_t *);
+ peer_mq = uword_to_pointer (peer_mq_addr, svm_msg_q_t *);
+
+ if (svm_msg_q_get_producer_eventfd (mq) != -1)
+ {
+ mp->fd_flags |= SESSION_FD_F_MQ_EVENTFD;
+ mp->n_fds = 2;
+ /* app will overwrite exactly the fds we pass here. So
+ * when we swap mq with peer_mq (accept vs connect) the
+ * fds will still be valid */
+ fds[0] = svm_msg_q_get_consumer_eventfd (mq);
+ fds[1] = svm_msg_q_get_producer_eventfd (peer_mq);
+ }
+
+ vl_msg_api_send_shmem (reg->vl_input_queue, (u8 *) & mp);
+
+ if (mp->n_fds != 0)
+ session_send_fds (reg, fds, mp->n_fds);