aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/plugins/tlsopenssl/CMakeLists.txt4
-rw-r--r--src/plugins/tlsopenssl/tls_openssl.api1
-rw-r--r--src/plugins/tlsopenssl/tls_openssl_all_api_h.h18
-rw-r--r--src/plugins/tlsopenssl/tls_openssl_api.c72
-rw-r--r--src/plugins/tlsopenssl/tls_openssl_msg_enum.h30
-rw-r--r--src/plugins/tlsopenssl/tls_openssl_test.c89
6 files changed, 9 insertions, 205 deletions
diff --git a/src/plugins/tlsopenssl/CMakeLists.txt b/src/plugins/tlsopenssl/CMakeLists.txt
index 07b587b4ca3..8ac36cfe3fd 100644
--- a/src/plugins/tlsopenssl/CMakeLists.txt
+++ b/src/plugins/tlsopenssl/CMakeLists.txt
@@ -23,10 +23,6 @@ if(OPENSSL_FOUND)
API_FILES
tls_openssl.api
- INSTALL_HEADERS
- tls_openssl_all_api_h.h
- tls_openssl_msg_enum.h
-
API_TEST_SOURCES
tls_openssl_test.c
diff --git a/src/plugins/tlsopenssl/tls_openssl.api b/src/plugins/tlsopenssl/tls_openssl.api
index 8111f51065c..cfdeeb6a627 100644
--- a/src/plugins/tlsopenssl/tls_openssl.api
+++ b/src/plugins/tlsopenssl/tls_openssl.api
@@ -20,4 +20,5 @@ autoreply define tls_openssl_set_engine {
/* cipher */
u8 ciphers[64];
+ option vat_help = "tls openssl set [engine <engine name>] [alg [algorithm] [async]";
};
diff --git a/src/plugins/tlsopenssl/tls_openssl_all_api_h.h b/src/plugins/tlsopenssl/tls_openssl_all_api_h.h
deleted file mode 100644
index 96b63f2e1a4..00000000000
--- a/src/plugins/tlsopenssl/tls_openssl_all_api_h.h
+++ /dev/null
@@ -1,18 +0,0 @@
-/*
- * tls_openssl_all_api_h.h - skeleton vpp engine plug-in api #include file
- *
- * Copyright (c) 2019 Intel Corporation
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/* Include the generated file, see BUILT_SOURCES in Makefile.am */
-#include <tlsopenssl/tls_openssl.api.h>
diff --git a/src/plugins/tlsopenssl/tls_openssl_api.c b/src/plugins/tlsopenssl/tls_openssl_api.c
index 99ef3fe27c3..b305bf2677f 100644
--- a/src/plugins/tlsopenssl/tls_openssl_api.c
+++ b/src/plugins/tlsopenssl/tls_openssl_api.c
@@ -20,37 +20,14 @@
#include <tlsopenssl/tls_openssl.h>
/* define message IDs */
-#include <tlsopenssl/tls_openssl_msg_enum.h>
+#include <tlsopenssl/tls_openssl.api_enum.h>
+#include <tlsopenssl/tls_openssl.api_types.h>
-/* define message structures */
-#define vl_typedefs
-#include <tlsopenssl/tls_openssl_all_api_h.h>
-#undef vl_typedefs
-
-/* define generated endian-swappers */
-#define vl_endianfun
-#include <tlsopenssl/tls_openssl_all_api_h.h>
-#undef vl_endianfun
-
-/* instantiate all the print functions we know about */
#define vl_print(handle, ...) vlib_cli_output (handle, __VA_ARGS__)
-#define vl_printfun
-#include <tlsopenssl/tls_openssl_all_api_h.h>
-#undef vl_printfun
-
-/* Get the API version number */
-#define vl_api_version(n, v) static u32 api_version = (v);
-#include <tlsopenssl/tls_openssl_all_api_h.h>
-#undef vl_api_version
#define REPLY_MSG_ID_BASE om->msg_id_base
#include <vlibapi/api_helper_macros.h>
-/* List of message types that this plugin understands */
-
-#define foreach_tls_openssl_plugin_api_msg \
- _ (TLS_OPENSSL_SET_ENGINE, tls_openssl_set_engine)
-
extern openssl_main_t openssl_main;
/* API message handler */
@@ -83,55 +60,16 @@ vl_api_tls_openssl_set_engine_t_handler (vl_api_tls_openssl_set_engine_t * mp)
REPLY_MACRO (VL_API_TLS_OPENSSL_SET_ENGINE_REPLY);
}
-/* Set up the API message handling tables */
-static clib_error_t *
-tls_openssl_plugin_api_hookup (vlib_main_t * vm)
-{
- openssl_main_t *om = &openssl_main;
-#define _(N, n) \
- vl_msg_api_set_handlers ((VL_API_##N + om->msg_id_base), #n, \
- vl_api_##n##_t_handler, vl_noop_handler, \
- vl_api_##n##_t_endian, vl_api_##n##_t_print, \
- sizeof (vl_api_##n##_t), 1);
- foreach_tls_openssl_plugin_api_msg;
-#undef _
-
- return 0;
-}
-
-#define vl_msg_name_crc_list
-#include <tlsopenssl/tls_openssl_all_api_h.h>
-#undef vl_msg_name_crc_list
-
-static void
-setup_message_id_table (openssl_main_t * om, api_main_t * am)
-{
-#define _(id, n, crc) \
- vl_msg_api_add_msg_name_crc (am, #n "_" #crc, id + om->msg_id_base);
- foreach_vl_msg_name_crc_tls_openssl;
-#undef _
-}
-
+#include <tlsopenssl/tls_openssl.api.c>
clib_error_t *
tls_openssl_api_init (vlib_main_t * vm)
{
openssl_main_t *om = &openssl_main;
- clib_error_t *error = 0;
- u8 *name;
-
- name = format (0, "tls_openssl_%08x%c", api_version, 0);
/* Ask for a correctly-sized block of API message decode slots */
- om->msg_id_base =
- vl_msg_api_get_msg_ids ((char *) name, VL_MSG_FIRST_AVAILABLE);
-
- error = tls_openssl_plugin_api_hookup (vm);
+ om->msg_id_base = setup_message_id_table ();
- /* Add our API messages to the global name_crc hash table */
- setup_message_id_table (om, &api_main);
- vec_free (name);
-
- return error;
+ return 0;
}
/*
diff --git a/src/plugins/tlsopenssl/tls_openssl_msg_enum.h b/src/plugins/tlsopenssl/tls_openssl_msg_enum.h
deleted file mode 100644
index d1f74d0b4dd..00000000000
--- a/src/plugins/tlsopenssl/tls_openssl_msg_enum.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * tlsopenssl_msg_enum.h - skeleton vpp engine plug-in message enumeration
- *
- * Copyright (c) 2019 Intel Corportation
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef included_tlsopenssl_msg_enum_h
-#define included_tlsopenssl_msg_enum_h
-
-#include <vppinfra/byte_order.h>
-
-#define vl_msg_id(n,h) n,
-typedef enum {
-#include <tlsopenssl/tls_openssl_all_api_h.h>
- /* We'll want to know how many messages IDs we need... */
- VL_MSG_FIRST_AVAILABLE,
-} vl_msg_id_t;
-#undef vl_msg_id
-
-#endif /* included_tlsopenssl_msg_enum_h*/
diff --git a/src/plugins/tlsopenssl/tls_openssl_test.c b/src/plugins/tlsopenssl/tls_openssl_test.c
index aa64fb86bbb..9a660758dee 100644
--- a/src/plugins/tlsopenssl/tls_openssl_test.c
+++ b/src/plugins/tlsopenssl/tls_openssl_test.c
@@ -23,29 +23,8 @@
uword unformat_sw_if_index (unformat_input_t * input, va_list * args);
/* Declare message IDs */
-#include <tlsopenssl/tls_openssl_msg_enum.h>
-
-/* define message structures */
-#define vl_typedefs
-#include <tlsopenssl/tls_openssl_all_api_h.h>
-#undef vl_typedefs
-
-/* declare message handlers for each api */
-
-#define vl_endianfun /* define message structures */
-#include <tlsopenssl/tls_openssl_all_api_h.h>
-#undef vl_endianfun
-
-/* instantiate all the print functions we know about */
-#define vl_print(handle, ...)
-#define vl_printfun
-#include <tlsopenssl/tls_openssl_all_api_h.h>
-#undef vl_printfun
-
-/* Get the API version number. */
-#define vl_api_version(n,v) static u32 api_version=(v);
-#include <tlsopenssl/tls_openssl_all_api_h.h>
-#undef vl_api_version
+#include <tlsopenssl/tls_openssl.api_enum.h>
+#include <tlsopenssl/tls_openssl.api_types.h>
typedef struct
{
@@ -59,33 +38,6 @@ tls_openssl_test_main_t tls_openssl_test_main;
#define __plugin_msg_base tls_openssl_test_main.msg_id_base
#include <vlibapi/vat_helper_macros.h>
-#define foreach_standard_reply_retval_handler \
-_(tls_openssl_set_engine_reply)
-
-#define _(n) \
- static void vl_api_##n##_t_handler \
- (vl_api_##n##_t * mp) \
- { \
- vat_main_t * vam = tls_openssl_test_main.vat_main; \
- i32 retval = ntohl(mp->retval); \
- if (vam->async_mode) { \
- vam->async_errors += (retval < 0); \
- } else { \
- vam->retval = retval; \
- vam->result_ready = 1; \
- } \
- }
-foreach_standard_reply_retval_handler;
-#undef _
-
-/*
- * Table of message reply handlers, must include boilerplate handlers
- * we just generated
- */
-#define foreach_vpe_api_reply_msg \
-_(TLS_OPENSSL_SET_ENGINE_REPLY, tls_openssl_set_engine_reply)
-
-
static int
api_tls_openssl_set_engine (vat_main_t * vam)
{
@@ -154,42 +106,7 @@ api_tls_openssl_set_engine (vat_main_t * vam)
return ret;
}
-/*
- * List of messages that the api test plugin sends,
- * and that the data plane plugin processes
- */
-#define foreach_vpe_api_msg \
-_(tls_openssl_set_engine, "tls openssl set [engine <engine name>]" \
-"[alg [algorithm] [async]\n")
-
-static void
-tls_openssl_api_hookup (vat_main_t * vam)
-{
- tls_openssl_test_main_t *htmp = &tls_openssl_test_main;
- /* Hook up handlers for replies from the data plane plug-in */
-#define _(N,n) \
- vl_msg_api_set_handlers((VL_API_##N + htmp->msg_id_base), \
- #n, \
- vl_api_##n##_t_handler, \
- vl_noop_handler, \
- vl_api_##n##_t_endian, \
- vl_api_##n##_t_print, \
- sizeof(vl_api_##n##_t), 1);
- foreach_vpe_api_reply_msg;
-#undef _
-
- /* API messages we can send */
-#define _(n,h) hash_set_mem (vam->function_by_name, #n, api_##n);
- foreach_vpe_api_msg;
-#undef _
-
- /* Help strings */
-#define _(n,h) hash_set_mem (vam->help_by_name, #n, h);
- foreach_vpe_api_msg;
-#undef _
-}
-
-VAT_PLUGIN_REGISTER (tls_openssl);
+#include <tlsopenssl/tls_openssl.api_test.c>
/*
* fd.io coding-style-patch-verification: ON