FD.io VPP  v21.06-3-gbb25fbf28
Vector Packet Processing
crypto_api.c
Go to the documentation of this file.
1 /*
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:
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
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.
14  */
15 
16 #include <stddef.h>
17 
18 #include <vnet/vnet.h>
19 
20 #include <vnet/ip/ip_types_api.h>
21 #include <vpp/app/version.h>
22 
23 #include <vlibapi/api.h>
24 #include <vlibmemory/api.h>
25 
26 #include <vnet/crypto/crypto.h>
27 
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>
32 
33 /**
34  * Base message ID fot the plugin
35  */
37 
38 #define REPLY_MSG_ID_BASE crypto_base_msg_id
39 
41 
42 static void
44  * mp)
45 {
46  vl_api_crypto_set_async_dispatch_reply_t *rmp;
47  int rv = 0;
48 
50 
51  REPLY_MACRO (VL_API_CRYPTO_SET_ASYNC_DISPATCH_REPLY);
52 }
53 
54 static void
56 {
57  vl_api_crypto_set_handler_reply_t *rmp;
58  int rv = 0;
59  char *engine;
60  char *alg_name;
62 
63  engine = (char *) mp->engine;
64  alg_name = (char *) mp->alg_name;
65  oct = (crypto_op_class_type_t) mp->oct;
66 
67  if (mp->is_async)
68  rv = vnet_crypto_set_async_handler2 (alg_name, engine);
69  else
70  rv = vnet_crypto_set_handler2 (alg_name, engine, oct);
71 
72  REPLY_MACRO (VL_API_CRYPTO_SET_HANDLER_REPLY);
73 }
74 
75 #include <vnet/crypto/crypto.api.c>
76 
79 {
80  /* Ask for a correctly-sized block of API message decode slots */
82 
83  return 0;
84 }
85 
87 
88 /*
89  * fd.io coding-style-patch-verification: ON
90  *
91  * Local Variables:
92  * eval: (c-set-style "gnu")
93  * End:
94  */
api.h
crypto_op_class_type_t
crypto_op_class_type_t
Definition: crypto.h:235
vl_api_crypto_set_async_dispatch_t::mode
vl_api_crypto_dispatch_mode_t mode
Definition: crypto.api:41
crypto.h
vl_api_crypto_set_handler_t_handler
static void vl_api_crypto_set_handler_t_handler(vl_api_crypto_set_handler_t *mp)
Definition: crypto_api.c:55
vl_api_crypto_set_handler_t::is_async
u8 is_async
Definition: crypto.api:60
vm
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
Definition: nat44_ei.c:3047
api.h
vl_api_crypto_set_handler_t
crypto: set crypto handler
Definition: crypto.api:53
vl_api_crypto_set_handler_t::oct
vl_api_crypto_op_class_type_t oct
Definition: crypto.api:59
vl_api_crypto_set_async_dispatch_t_handler
static void vl_api_crypto_set_async_dispatch_t_handler(vl_api_crypto_set_async_dispatch_t *mp)
Definition: crypto_api.c:43
setup_message_id_table
static void setup_message_id_table(api_main_t *am)
Definition: bfd_api.c:451
vl_api_crypto_set_async_dispatch_t
crypto: use polling or interrupt dispatch
Definition: crypto.api:37
VLIB_API_INIT_FUNCTION
VLIB_API_INIT_FUNCTION(crypto_api_hookup)
vnet_crypto_set_async_dispatch_mode
void vnet_crypto_set_async_dispatch_mode(u8 mode)
Definition: crypto.c:608
REPLY_MACRO
#define REPLY_MACRO(t)
Definition: api_helper_macros.h:30
crypto_api_hookup
clib_error_t * crypto_api_hookup(vlib_main_t *vm)
Definition: crypto_api.c:78
if
if(node->flags &VLIB_NODE_FLAG_TRACE) vnet_interface_output_trace(vm
vl_api_crypto_set_handler_t::engine
string engine[16]
Definition: crypto.api:58
format_fns.h
u32
unsigned int u32
Definition: types.h:88
api_helper_macros.h
vnet_crypto_set_async_handler2
int vnet_crypto_set_async_handler2(char *alg_name, char *engine)
Definition: crypto.c:509
vlib_main_t
Definition: main.h:102
vl_api_crypto_set_handler_t::alg_name
string alg_name[32]
Definition: crypto.api:57
u8
unsigned char u8
Definition: types.h:56
clib_error_t
Definition: clib_error.h:21
rv
int __clib_unused rv
Definition: application.c:491
vnet.h
crypto_base_msg_id
static u32 crypto_base_msg_id
Base message ID fot the plugin.
Definition: crypto_api.c:36
ip_types_api.h
vnet_crypto_set_handler2
int vnet_crypto_set_handler2(char *alg_name, char *engine, crypto_op_class_type_t oct)
Definition: crypto.c:156