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_SPD_H__ |
| 16 | #define __IPSEC_SPD_H__ |
| 17 | |
| 18 | #include <vlib/vlib.h> |
| 19 | |
Neale Ranns | a09c1ff | 2019-02-04 01:10:30 -0800 | [diff] [blame] | 20 | #define foreach_ipsec_spd_policy_type \ |
| 21 | _(IP4_OUTBOUND, "ip4-outbound") \ |
| 22 | _(IP6_OUTBOUND, "ip6-outbound") \ |
| 23 | _(IP4_INBOUND_PROTECT, "ip4-inbound-protect") \ |
| 24 | _(IP6_INBOUND_PROTECT, "ip6-inbound-protect") \ |
| 25 | _(IP4_INBOUND_BYPASS, "ip4-inbound-bypass") \ |
| 26 | _(IP6_INBOUND_BYPASS, "ip6-inbound-bypass") |
| 27 | |
| 28 | typedef enum ipsec_spd_policy_t_ |
| 29 | { |
| 30 | #define _(s,v) IPSEC_SPD_POLICY_##s, |
| 31 | foreach_ipsec_spd_policy_type |
| 32 | #undef _ |
| 33 | IPSEC_SPD_POLICY_N_TYPES, |
| 34 | } ipsec_spd_policy_t; |
| 35 | |
| 36 | #define FOR_EACH_IPSEC_SPD_POLICY_TYPE(_t) \ |
| 37 | for (_t = 0; _t < IPSEC_SPD_POLICY_N_TYPES; _t++) |
Neale Ranns | 999c8ee | 2019-02-01 03:31:24 -0800 | [diff] [blame] | 38 | |
| 39 | /** |
| 40 | * @brief A Secruity Policy Database |
| 41 | */ |
Neale Ranns | a09c1ff | 2019-02-04 01:10:30 -0800 | [diff] [blame] | 42 | typedef struct |
Neale Ranns | 999c8ee | 2019-02-01 03:31:24 -0800 | [diff] [blame] | 43 | { |
Neale Ranns | a09c1ff | 2019-02-04 01:10:30 -0800 | [diff] [blame] | 44 | /** the User's ID for this policy */ |
Neale Ranns | 999c8ee | 2019-02-01 03:31:24 -0800 | [diff] [blame] | 45 | u32 id; |
Neale Ranns | a09c1ff | 2019-02-04 01:10:30 -0800 | [diff] [blame] | 46 | /** vectors for each of the policy types */ |
| 47 | u32 *policies[IPSEC_SPD_POLICY_N_TYPES]; |
Neale Ranns | 999c8ee | 2019-02-01 03:31:24 -0800 | [diff] [blame] | 48 | } ipsec_spd_t; |
| 49 | |
| 50 | /** |
| 51 | * @brief Add/Delete a SPD |
| 52 | */ |
| 53 | extern int ipsec_add_del_spd (vlib_main_t * vm, u32 spd_id, int is_add); |
| 54 | |
| 55 | /** |
| 56 | * @brief Bind/attach a SPD to an interface |
| 57 | */ |
| 58 | extern int ipsec_set_interface_spd (vlib_main_t * vm, |
| 59 | u32 sw_if_index, u32 spd_id, int is_add); |
| 60 | |
Neale Ranns | a09c1ff | 2019-02-04 01:10:30 -0800 | [diff] [blame] | 61 | extern u8 *format_ipsec_spd (u8 * s, va_list * args); |
| 62 | |
Neale Ranns | 999c8ee | 2019-02-01 03:31:24 -0800 | [diff] [blame] | 63 | #endif /* __IPSEC_SPD_H__ */ |
| 64 | |
| 65 | /* |
| 66 | * fd.io coding-style-patch-verification: ON |
| 67 | * |
| 68 | * Local Variables: |
| 69 | * eval: (c-set-style "gnu") |
| 70 | * End: |
| 71 | */ |