Neale Ranns | 999c8ee | 2019-02-01 03:31:24 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2015 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 | #ifndef __IPSEC_IF_H__ |
| 16 | #define __IPSEC_IF_H__ |
| 17 | |
| 18 | #include <vnet/ipsec/ipsec_sa.h> |
| 19 | |
| 20 | typedef enum |
| 21 | { |
| 22 | IPSEC_IF_SET_KEY_TYPE_NONE, |
| 23 | IPSEC_IF_SET_KEY_TYPE_LOCAL_CRYPTO, |
| 24 | IPSEC_IF_SET_KEY_TYPE_REMOTE_CRYPTO, |
| 25 | IPSEC_IF_SET_KEY_TYPE_LOCAL_INTEG, |
| 26 | IPSEC_IF_SET_KEY_TYPE_REMOTE_INTEG, |
| 27 | } ipsec_if_set_key_type_t; |
| 28 | |
| 29 | typedef struct |
| 30 | { |
| 31 | /* Required for pool_get_aligned */ |
| 32 | CLIB_CACHE_LINE_ALIGN_MARK (cacheline0); |
| 33 | u32 input_sa_index; |
| 34 | u32 output_sa_index; |
| 35 | u32 hw_if_index; |
| 36 | u32 show_instance; |
| 37 | } ipsec_tunnel_if_t; |
| 38 | |
| 39 | typedef struct |
| 40 | { |
| 41 | u8 is_add; |
| 42 | u8 esn; |
| 43 | u8 anti_replay; |
Neale Ranns | 8d7c502 | 2019-02-06 01:41:05 -0800 | [diff] [blame] | 44 | ip46_address_t local_ip, remote_ip; |
Neale Ranns | 999c8ee | 2019-02-01 03:31:24 -0800 | [diff] [blame] | 45 | u32 local_spi; |
| 46 | u32 remote_spi; |
| 47 | ipsec_crypto_alg_t crypto_alg; |
| 48 | u8 local_crypto_key_len; |
| 49 | u8 local_crypto_key[128]; |
| 50 | u8 remote_crypto_key_len; |
| 51 | u8 remote_crypto_key[128]; |
| 52 | ipsec_integ_alg_t integ_alg; |
| 53 | u8 local_integ_key_len; |
| 54 | u8 local_integ_key[128]; |
| 55 | u8 remote_integ_key_len; |
| 56 | u8 remote_integ_key[128]; |
| 57 | u8 renumber; |
| 58 | u32 show_instance; |
| 59 | u8 udp_encap; |
| 60 | u32 tx_table_id; |
| 61 | } ipsec_add_del_tunnel_args_t; |
| 62 | |
| 63 | typedef struct |
| 64 | { |
| 65 | u8 is_add; |
| 66 | u32 local_sa_id; |
| 67 | u32 remote_sa_id; |
| 68 | ip4_address_t local_ip; |
| 69 | ip4_address_t remote_ip; |
| 70 | } ipsec_add_del_ipsec_gre_tunnel_args_t; |
| 71 | |
| 72 | extern int ipsec_add_del_tunnel_if_internal (vnet_main_t * vnm, |
| 73 | ipsec_add_del_tunnel_args_t * |
| 74 | args, u32 * sw_if_index); |
| 75 | extern int ipsec_add_del_tunnel_if (ipsec_add_del_tunnel_args_t * args); |
| 76 | extern int ipsec_add_del_ipsec_gre_tunnel (vnet_main_t * vnm, |
| 77 | ipsec_add_del_ipsec_gre_tunnel_args_t |
| 78 | * args); |
| 79 | |
| 80 | extern int ipsec_set_interface_key (vnet_main_t * vnm, u32 hw_if_index, |
| 81 | ipsec_if_set_key_type_t type, |
| 82 | u8 alg, u8 * key); |
| 83 | extern int ipsec_set_interface_sa (vnet_main_t * vnm, u32 hw_if_index, |
| 84 | u32 sa_id, u8 is_outbound); |
| 85 | |
| 86 | #endif /* __IPSEC_IF_H__ */ |
| 87 | |
| 88 | /* |
| 89 | * fd.io coding-style-patch-verification: ON |
| 90 | * |
| 91 | * Local Variables: |
| 92 | * eval: (c-set-style "gnu") |
| 93 | * End: |
| 94 | */ |