2 * Copyright (c) 2020 Cisco and/or its affiliates.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at:
7 * http://www.apache.org/licenses/LICENSE-2.0
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
18 #include <vnet/vnet.h>
20 #include <vnet/ip/ip_types_api.h>
21 #include <vpp/app/version.h>
23 #include <vlibapi/api.h>
24 #include <vlibmemory/api.h>
26 #include <vnet/crypto/crypto.h>
28 /* define message IDs */
29 #include <vnet/format_fns.h>
30 #include <vnet/crypto/crypto.api_enum.h>
31 #include <vnet/crypto/crypto.api_types.h>
34 * Base message ID fot the plugin
36 static u32 crypto_base_msg_id;
38 #define REPLY_MSG_ID_BASE crypto_base_msg_id
40 #include <vlibapi/api_helper_macros.h>
43 vl_api_crypto_set_async_dispatch_t_handler (vl_api_crypto_set_async_dispatch_t
46 vl_api_crypto_set_async_dispatch_reply_t *rmp;
49 vnet_crypto_set_async_dispatch_mode ((u8) mp->mode);
51 REPLY_MACRO (VL_API_CRYPTO_SET_ASYNC_DISPATCH_REPLY);
55 vl_api_crypto_set_handler_t_handler (vl_api_crypto_set_handler_t * mp)
57 vnet_crypto_main_t *cm = &crypto_main;
58 vl_api_crypto_set_handler_reply_t *rmp;
62 crypto_op_class_type_t oct;
64 engine = (char *) mp->engine;
65 alg_name = (char *) mp->alg_name;
66 oct = (crypto_op_class_type_t) mp->oct;
68 if (strcmp ("all", alg_name) == 0)
76 hash_foreach_mem (key, value, cm->async_alg_index_by_name,
79 rv += vnet_crypto_set_async_handler2 (key, engine);
89 hash_foreach_mem (key, value, cm->alg_index_by_name,
92 rv += vnet_crypto_set_handler2 (key, engine, oct);
100 rv = vnet_crypto_set_async_handler2 (alg_name, engine);
102 rv = vnet_crypto_set_handler2 (alg_name, engine, oct);
105 REPLY_MACRO (VL_API_CRYPTO_SET_HANDLER_REPLY);
108 #include <vnet/crypto/crypto.api.c>
111 crypto_api_hookup (vlib_main_t * vm)
113 /* Ask for a correctly-sized block of API message decode slots */
114 crypto_base_msg_id = setup_message_id_table ();
119 VLIB_API_INIT_FUNCTION (crypto_api_hookup);
122 * fd.io coding-style-patch-verification: ON
125 * eval: (c-set-style "gnu")