ipsec: Changes to make ipsec encoder/decoders reusable by the plugins
[vpp.git] / src / vnet / ipsec / ipsec_types_api.h
1 /*
2  * Copyright (c) 2019 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 /**
17  * Encode/decode function from/to API to internal types
18  */
19 #ifndef __IPSEC_TYPES_API_H__
20 #define __IPSEC_TYPES_API_H__
21
22 #include <vnet/ipsec/ipsec.h>
23 #include <vnet/ipsec/ipsec.api_types.h>
24
25 extern int ipsec_proto_decode (vl_api_ipsec_proto_t in,
26                                ipsec_protocol_t * out);
27 extern vl_api_ipsec_proto_t ipsec_proto_encode (ipsec_protocol_t p);
28
29 extern int ipsec_crypto_algo_decode (vl_api_ipsec_crypto_alg_t in,
30                                      ipsec_crypto_alg_t * out);
31 extern vl_api_ipsec_crypto_alg_t ipsec_crypto_algo_encode (ipsec_crypto_alg_t
32                                                            c);
33
34 extern int ipsec_integ_algo_decode (vl_api_ipsec_integ_alg_t in,
35                                     ipsec_integ_alg_t * out);
36 extern vl_api_ipsec_integ_alg_t ipsec_integ_algo_encode (ipsec_integ_alg_t i);
37
38 extern void ipsec_key_decode (const vl_api_key_t * key, ipsec_key_t * out);
39 extern void ipsec_key_encode (const ipsec_key_t * in, vl_api_key_t * out);
40
41 extern ipsec_sa_flags_t ipsec_sa_flags_decode (vl_api_ipsec_sad_flags_t in);
42 extern vl_api_ipsec_sad_flags_t ipsec_sad_flags_encode (const ipsec_sa_t *
43                                                         sa);
44
45 #endif
46
47 /*
48  * fd.io coding-style-patch-verification: ON
49  *
50  * Local Variables:
51  * eval: (c-set-style "gnu")
52  * End:
53  */