summaryrefslogtreecommitdiffstats
path: root/src/plugins/tlsopenssl
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/tlsopenssl')
-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
1'>681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048