api: vat2 and json autogeneration for api messages
[vpp.git] / src / vnet / session / session_api.c
index 12aea49..90c0772 100644 (file)
@@ -180,7 +180,7 @@ mq_send_session_accepted_cb (session_t * s)
       mp->rmt.is_ip4 = session_type_is_ip4 (listener->session_type);
       mp->rmt.port = ct->c_rmt_port;
       mp->handle = session_handle (s);
-      vpp_queue = session_main_get_vpp_event_queue (0);
+      vpp_queue = session_main_get_vpp_event_queue (s->thread_index);
       mp->vpp_event_queue_address = pointer_to_uword (vpp_queue);
     }
   svm_msg_q_add_and_unlock (app_mq, msg);
@@ -318,7 +318,7 @@ mq_send_session_connected_cb (u32 app_wrk_index, u32 api_context,
       mp->handle = session_handle (s);
       mp->lcl.port = cct->c_lcl_port;
       mp->lcl.is_ip4 = cct->c_is_ip4;
-      vpp_mq = session_main_get_vpp_event_queue (0);
+      vpp_mq = session_main_get_vpp_event_queue (s->thread_index);
       mp->vpp_event_queue_address = pointer_to_uword (vpp_mq);
       mp->server_rx_fifo = pointer_to_uword (s->rx_fifo);
       mp->server_tx_fifo = pointer_to_uword (s->tx_fifo);
@@ -614,6 +614,12 @@ vl_api_app_attach_t_handler (vl_api_app_attach_t * mp)
       rv = VNET_API_ERROR_FEATURE_DISABLED;
       goto done;
     }
+  /* Only support binary api with socket transport */
+  if (vl_api_registration_file_index (reg) == VL_API_INVALID_FI)
+    {
+      rv = VNET_API_ERROR_APP_UNSUPPORTED_CFG;
+      goto done;
+    }
 
   STATIC_ASSERT (sizeof (u64) * APP_OPTIONS_N_OPTIONS <=
                 sizeof (mp->options),
@@ -623,7 +629,6 @@ vl_api_app_attach_t_handler (vl_api_app_attach_t * mp)
   a->api_client_index = mp->client_index;
   a->options = mp->options;
   a->session_cb_vft = &session_mq_cb_vft;
-
   a->namespace_id = vl_api_from_api_to_new_vec (mp, &mp->namespace_id);
 
   if ((rv = vnet_application_attach (a)))