2 * teib.h: next-hop resolution
4 * Copyright (c) 2016 Cisco and/or its affiliates.
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at:
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
21 #include <vnet/ip/ip.h>
24 * Tunnel Endpoint Information Base.
26 * A TEIB entry represents the mapping between a peer on an interface in the overlay
27 * and a next-hop address in the underlay.
28 * i.e. there's a multipoint tunnel providing the overlay (henace a peer on
29 * that tunnel) which is reachable via 'tunnel destination' address in the
32 * Such overlay to underlay mappings might be providied by a protocol like NHRP
34 typedef struct teib_entry_t_ teib_entry_t;
36 /** accessors for the opaque struct */
37 extern u32 teib_entry_get_sw_if_index (const teib_entry_t * ne);
38 extern u32 teib_entry_get_fib_index (const teib_entry_t * ne);
39 extern const ip46_address_t *teib_entry_get_peer (const teib_entry_t * ne);
40 extern fib_protocol_t teib_entry_get_proto (const teib_entry_t * ne);
41 extern const fib_prefix_t *teib_entry_get_nh (const teib_entry_t * ne);
42 extern u8 *format_teib_entry (u8 * s, va_list * args);
45 * Create a new TEIB entry
47 extern int teib_entry_add (u32 sw_if_index,
48 fib_protocol_t fproto,
49 const ip46_address_t * peer,
50 u32 nh_table_id, const ip46_address_t * nh);
52 extern int teib_entry_del (u32 sw_if_index,
53 fib_protocol_t fproto,
54 const ip46_address_t * peer);
56 extern teib_entry_t *teib_entry_find (u32 sw_if_index,
57 fib_protocol_t fproto,
58 const ip46_address_t * peer);
59 extern teib_entry_t *teib_entry_get (index_t nei);
61 extern void teib_entry_adj_stack (const teib_entry_t * ne, adj_index_t ai);
63 typedef walk_rc_t (*teib_walk_cb_t) (index_t nei, void *ctx);
65 extern void teib_walk (teib_walk_cb_t fn, void *ctx);
66 extern void teib_walk_itf (u32 sw_if_index, teib_walk_cb_t fn, void *ctx);
69 * Notifications for the creation and deletion of TEIB entries
71 typedef void (*teib_entry_added_t) (const teib_entry_t * ne);
72 typedef void (*teib_entry_deleted_t) (const teib_entry_t * ne);
74 typedef struct teib_vft_t_
76 teib_entry_added_t nv_added;
77 teib_entry_deleted_t nv_deleted;
80 extern void teib_register (const teib_vft_t * vft);
85 * fd.io coding-style-patch-verification: ON
88 * eval: (c-set-style "gnu")