+ vppcom_proto_str (session->session_type), session->session_state,
+ vppcom_session_state_str (session->session_state));
+ return VPPCOM_OK;
+ }
+
+ session->transport.is_ip4 = server_ep->is_ip4;
+ if (session->transport.is_ip4)
+ clib_memcpy_fast (&session->transport.rmt_ip.ip4, server_ep->ip,
+ sizeof (ip4_address_t));
+ else
+ clib_memcpy_fast (&session->transport.rmt_ip.ip6, server_ep->ip,
+ sizeof (ip6_address_t));
+ session->transport.rmt_port = server_ep->port;
+ session->parent_handle = VCL_INVALID_SESSION_HANDLE;
+
+ VDBG (0, "session handle %u: connecting to server %s %U "
+ "port %d proto %s", session_handle,
+ session->transport.is_ip4 ? "IPv4" : "IPv6",
+ format_ip46_address,
+ &session->transport.rmt_ip, session->transport.is_ip4 ?
+ IP46_TYPE_IP4 : IP46_TYPE_IP6,
+ clib_net_to_host_u16 (session->transport.rmt_port),
+ vppcom_proto_str (session->session_type));
+
+ /*
+ * Send connect request and wait for reply from vpp
+ */
+ vppcom_send_connect_sock (session);
+ rv = vppcom_wait_for_session_state_change (session_index, STATE_CONNECT,
+ vcm->cfg.session_timeout);
+
+ session = vcl_session_get (wrk, session_index);
+ VDBG (0, "session %u [0x%llx]: connect %s!", session->session_index,
+ session->vpp_handle, rv ? "failed" : "succeeded");
+
+ return rv;
+}
+
+int
+vppcom_session_stream_connect (uint32_t session_handle,
+ uint32_t parent_session_handle)
+{
+ vcl_worker_t *wrk = vcl_worker_get_current ();
+ vcl_session_t *session, *parent_session;
+ u32 session_index, parent_session_index;
+ int rv;
+
+ session = vcl_session_get_w_handle (wrk, session_handle);
+ if (!session)
+ return VPPCOM_EBADFD;
+ parent_session = vcl_session_get_w_handle (wrk, parent_session_handle);
+ if (!parent_session)
+ return VPPCOM_EBADFD;
+
+ session_index = session->session_index;
+ parent_session_index = parent_session->session_index;
+ if (PREDICT_FALSE (session->is_vep))
+ {
+ VDBG (0, "ERROR: cannot connect epoll session %u!",
+ session->session_index);
+ return VPPCOM_EBADFD;
+ }
+
+ if (PREDICT_FALSE (session->session_state & CLIENT_STATE_OPEN))
+ {
+ VDBG (0, "session handle %u [0x%llx]: session already "
+ "connected to session %u [0x%llx] proto %s, state 0x%x (%s)",
+ session_handle, session->vpp_handle,
+ parent_session_handle, parent_session->vpp_handle,
+ vppcom_proto_str (session->session_type), session->session_state,