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:
7 * http://www.apache.org/licenses/LICENSE-2.0
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.
16 * @brief bier_fmask_db : The BIER fmask Database
19 #ifndef __BIER_FMASK_DB_H__
20 #define __BIER_FMASK_DB_H__
22 #include <vnet/ip/ip.h>
24 #include <vnet/fib/fib_types.h>
27 * BIER header encapulsation types
29 typedef enum bier_hdr_type_t_ {
31 * BIER Header in MPLS networks
36 * BIER header in non-MPLS networks
39 } __attribute__((packed)) bier_hdr_type_t;
44 typedef enum bier_nh_type_t_ {
46 * BIER Header in MPLS networks
51 * BIER header in non-MPLS networks
54 } __attribute__((packed)) bier_nh_type_t;
57 * A key/ID for a BIER forwarding Mas (FMask).
58 * This is a simplified version of a fib_route_path_t.
60 typedef struct bier_fmask_id_t_ {
63 * next-hop of the peer
65 ip46_address_t bfmi_nh;
68 * ID of the next-hop object, e.g. a UDP-encap
73 * The BIER table this fmask is in
78 * Type of BIER header this fmask supports
80 bier_hdr_type_t bfmi_hdr_type;
85 bier_nh_type_t bfmi_nh_type;
86 } __attribute__((packed)) bier_fmask_id_t;
89 bier_fmask_db_find_or_create_and_lock(index_t bti,
90 const fib_route_path_t *rpath);
91 extern index_t bier_fmask_db_find (index_t bti,
92 const fib_route_path_t *rpath);
94 extern void bier_fmask_db_remove (const bier_fmask_id_t *fmid);
97 * Walk all the BIER fmasks
99 typedef walk_rc_t (*bier_fmask_walk_fn_t) (index_t bfmi, void *ctx);
101 extern void bier_fmask_db_walk(bier_fmask_walk_fn_t fn, void *ctx);