2 * tls_openssl_test.c - skeleton vpp-api-test plug-in
4 * Copyright (c) 2019 Intel Corporation
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at:
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
18 #include <vlibapi/api.h>
19 #include <vlibmemory/api.h>
20 #include <vppinfra/error.h>
23 uword unformat_sw_if_index (unformat_input_t * input, va_list * args);
25 /* Declare message IDs */
26 #include <tlsopenssl/tls_openssl.api_enum.h>
27 #include <tlsopenssl/tls_openssl.api_types.h>
31 /* API message ID base */
34 } tls_openssl_test_main_t;
36 tls_openssl_test_main_t tls_openssl_test_main;
38 #define __plugin_msg_base tls_openssl_test_main.msg_id_base
39 #include <vlibapi/vat_helper_macros.h>
42 api_tls_openssl_set_engine (vat_main_t * vam)
44 unformat_input_t *line_input = vam->input;
45 vl_api_tls_openssl_set_engine_t *mp;
52 /* Parse args required to build the message */
53 while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
55 if (unformat (line_input, "engine %s", &engine_name))
57 else if (unformat (line_input, "async"))
61 else if (unformat (line_input, "alg %s", &engine_alg))
63 else if (unformat (line_input, "ciphers %s", &ciphers))
67 errmsg ("unknown input `%U'", format_unformat_error, line_input);
74 errmsg ("Must specify engine name");
79 engine_alg = format (0, "ALL");
82 for (int i = 0; i < strnlen ((char *) engine_alg, 63); i++)
83 engine_alg[i] = toupper (engine_alg[i]);
87 /* Construct the API message */
88 M (TLS_OPENSSL_SET_ENGINE, mp);
89 mp->async_enable = async;
91 clib_memcpy_fast (mp->engine, engine_name,
92 strnlen ((const char *) engine_name, 63));
94 clib_memcpy_fast (mp->algorithm, engine_alg,
95 strnlen ((const char *) engine_alg, 63));
98 clib_memcpy_fast (mp->ciphers, ciphers,
99 strnlen ((const char *) ciphers, 63));
104 /* Wait for a reply... */
109 #include <tlsopenssl/tls_openssl.api_test.c>
112 * fd.io coding-style-patch-verification: ON
115 * eval: (c-set-style "gnu")