Neale Ranns | d792d9c | 2017-10-21 10:53:20 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2016 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 | * @brief bier_fmask_db : The BIER fmask Database |
| 17 | */ |
| 18 | |
| 19 | #ifndef __BIER_FMASK_DB_H__ |
| 20 | #define __BIER_FMASK_DB_H__ |
| 21 | |
| 22 | #include <vnet/ip/ip.h> |
| 23 | |
Neale Ranns | 9128637 | 2017-12-05 13:24:04 -0800 | [diff] [blame] | 24 | #include <vnet/fib/fib_types.h> |
Neale Ranns | d792d9c | 2017-10-21 10:53:20 -0700 | [diff] [blame] | 25 | |
| 26 | /** |
Neale Ranns | 9128637 | 2017-12-05 13:24:04 -0800 | [diff] [blame] | 27 | * BIER header encapulsation types |
Neale Ranns | d792d9c | 2017-10-21 10:53:20 -0700 | [diff] [blame] | 28 | */ |
Neale Ranns | d792d9c | 2017-10-21 10:53:20 -0700 | [diff] [blame] | 29 | typedef enum bier_hdr_type_t_ { |
Neale Ranns | 9128637 | 2017-12-05 13:24:04 -0800 | [diff] [blame] | 30 | /** |
| 31 | * BIER Header in MPLS networks |
| 32 | */ |
Neale Ranns | d792d9c | 2017-10-21 10:53:20 -0700 | [diff] [blame] | 33 | BIER_HDR_O_MPLS, |
Neale Ranns | 9128637 | 2017-12-05 13:24:04 -0800 | [diff] [blame] | 34 | |
| 35 | /** |
| 36 | * BIER header in non-MPLS networks |
| 37 | */ |
| 38 | BIER_HDR_O_OTHER, |
Neale Ranns | d792d9c | 2017-10-21 10:53:20 -0700 | [diff] [blame] | 39 | } bier_hdr_type_t; |
| 40 | |
Neale Ranns | 9128637 | 2017-12-05 13:24:04 -0800 | [diff] [blame] | 41 | /** |
| 42 | * A key/ID for a BIER forwarding Mas (FMask). |
| 43 | * This is a simplified version of a fib_route_path_t. |
| 44 | */ |
Neale Ranns | d792d9c | 2017-10-21 10:53:20 -0700 | [diff] [blame] | 45 | typedef struct bier_fmask_id_t_ { |
| 46 | /** |
| 47 | * Type of BIER header this fmask supports |
| 48 | */ |
| 49 | bier_hdr_type_t bfmi_hdr_type; |
| 50 | |
| 51 | /** |
Neale Ranns | 9128637 | 2017-12-05 13:24:04 -0800 | [diff] [blame] | 52 | * The BIER table this fmask is in |
Neale Ranns | d792d9c | 2017-10-21 10:53:20 -0700 | [diff] [blame] | 53 | */ |
Neale Ranns | 9128637 | 2017-12-05 13:24:04 -0800 | [diff] [blame] | 54 | index_t bfmi_bti; |
Neale Ranns | d792d9c | 2017-10-21 10:53:20 -0700 | [diff] [blame] | 55 | |
Neale Ranns | 9128637 | 2017-12-05 13:24:04 -0800 | [diff] [blame] | 56 | union { |
| 57 | /** |
| 58 | * next-hop of the peer |
| 59 | */ |
| 60 | ip46_address_t bfmi_nh; |
| 61 | |
| 62 | /** |
| 63 | * ID of the next-hop object, e.g. a UDP-encap |
| 64 | */ |
| 65 | u32 bfmi_id; |
| 66 | }; |
| 67 | |
| 68 | /** |
| 69 | * Software interface index |
| 70 | */ |
| 71 | u32 bfmi_sw_if_index; |
| 72 | } __attribute__((packed)) bier_fmask_id_t; |
| 73 | |
| 74 | extern index_t |
Neale Ranns | d792d9c | 2017-10-21 10:53:20 -0700 | [diff] [blame] | 75 | bier_fmask_db_find_or_create_and_lock(index_t bti, |
Neale Ranns | d792d9c | 2017-10-21 10:53:20 -0700 | [diff] [blame] | 76 | const fib_route_path_t *rpath); |
Neale Ranns | 9128637 | 2017-12-05 13:24:04 -0800 | [diff] [blame] | 77 | extern index_t bier_fmask_db_find (index_t bti, |
| 78 | const fib_route_path_t *rpath); |
Neale Ranns | d792d9c | 2017-10-21 10:53:20 -0700 | [diff] [blame] | 79 | |
Neale Ranns | 9128637 | 2017-12-05 13:24:04 -0800 | [diff] [blame] | 80 | extern void bier_fmask_db_remove (const bier_fmask_id_t *fmid); |
Neale Ranns | d792d9c | 2017-10-21 10:53:20 -0700 | [diff] [blame] | 81 | |
Neale Ranns | d792d9c | 2017-10-21 10:53:20 -0700 | [diff] [blame] | 82 | |
| 83 | #endif |