FD.io VPP  v21.06-3-gbb25fbf28
Vector Packet Processing
teib.h
Go to the documentation of this file.
1 /*
2  * teib.h: next-hop resolution
3  *
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:
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
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.
16  */
17 
18 #ifndef __TEIB_H__
19 #define __TEIB_H__
20 
21 #include <vnet/ip/ip.h>
22 
23 /**
24  * Tunnel Endpoint Information Base.
25  *
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
30  * underlay.
31  *
32  * Such overlay to underlay mappings might be providied by a protocol like NHRP
33  */
34 typedef struct teib_entry_t_ teib_entry_t;
35 
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 ip_address_t *teib_entry_get_peer (const teib_entry_t * ne);
40 extern const fib_prefix_t *teib_entry_get_nh (const teib_entry_t * ne);
41 extern u8 *format_teib_entry (u8 * s, va_list * args);
42 
43 /**
44  * Create a new TEIB entry
45  */
46 extern int teib_entry_add (u32 sw_if_index,
47  const ip_address_t * peer,
48  u32 nh_table_id, const ip_address_t * nh);
49 
50 extern int teib_entry_del (u32 sw_if_index, const ip_address_t * peer);
51 
53  const ip_address_t * peer);
55  fib_protocol_t fproto,
56  const ip46_address_t * peer);
57 extern teib_entry_t *teib_entry_get (index_t nei);
58 
59 extern void teib_entry_adj_stack (const teib_entry_t * ne, adj_index_t ai);
60 
61 typedef walk_rc_t (*teib_walk_cb_t) (index_t nei, void *ctx);
62 
63 extern void teib_walk (teib_walk_cb_t fn, void *ctx);
64 extern void teib_walk_itf (u32 sw_if_index, teib_walk_cb_t fn, void *ctx);
65 
66 /**
67  * Notifications for the creation and deletion of TEIB entries
68  */
69 typedef void (*teib_entry_added_t) (const teib_entry_t * ne);
70 typedef void (*teib_entry_deleted_t) (const teib_entry_t * ne);
71 
72 typedef struct teib_vft_t_
73 {
76 } teib_vft_t;
77 
78 extern void teib_register (const teib_vft_t * vft);
79 
80 #endif
81 
82 /*
83  * fd.io coding-style-patch-verification: ON
84  *
85  * Local Variables:
86  * eval: (c-set-style "gnu")
87  * End:
88  */
ip_address
Definition: ip_types.h:79
teib_entry_add
int teib_entry_add(u32 sw_if_index, const ip_address_t *peer, u32 nh_table_id, const ip_address_t *nh)
Create a new TEIB entry.
Definition: teib.c:200
teib_entry_get_fib_index
u32 teib_entry_get_fib_index(const teib_entry_t *ne)
Definition: teib.c:84
teib_entry_deleted_t
void(* teib_entry_deleted_t)(const teib_entry_t *ne)
Definition: teib.h:70
teib_entry_find
teib_entry_t * teib_entry_find(u32 sw_if_index, const ip_address_t *peer)
Definition: teib.c:114
teib_entry_t_
Definition: teib.c:33
teib_entry_get_sw_if_index
u32 teib_entry_get_sw_if_index(const teib_entry_t *ne)
accessors for the opaque struct
Definition: teib.c:72
format_teib_entry
u8 * format_teib_entry(u8 *s, va_list *args)
Definition: teib.c:294
teib_entry_get_peer
const ip_address_t * teib_entry_get_peer(const teib_entry_t *ne)
Definition: teib.c:90
teib_entry_get
teib_entry_t * teib_entry_get(index_t nei)
Definition: teib.c:108
index_t
u32 index_t
A Data-Path Object is an object that represents actions that are applied to packets are they are swit...
Definition: dpo.h:43
peer
vl_api_address_t peer
Definition: teib.api:28
teib_vft_t
struct teib_vft_t_ teib_vft_t
teib_vft_t_
Definition: teib.h:72
nh
vl_api_fib_path_nh_t nh
Definition: fib_types.api:126
fib_protocol_t
enum fib_protocol_t_ fib_protocol_t
Protocol Type.
teib_entry_find_46
teib_entry_t * teib_entry_find_46(u32 sw_if_index, fib_protocol_t fproto, const ip46_address_t *peer)
Definition: teib.c:131
teib_walk_cb_t
walk_rc_t(* teib_walk_cb_t)(index_t nei, void *ctx)
Definition: teib.h:61
teib_walk_itf
void teib_walk_itf(u32 sw_if_index, teib_walk_cb_t fn, void *ctx)
Definition: teib.c:328
teib_entry_get_nh
const fib_prefix_t * teib_entry_get_nh(const teib_entry_t *ne)
Definition: teib.c:96
teib_walk
void teib_walk(teib_walk_cb_t fn, void *ctx)
Definition: teib.c:315
ip.h
teib_register
void teib_register(const teib_vft_t *vft)
Definition: teib.c:408
u32
unsigned int u32
Definition: types.h:88
teib_vft_t_::nv_added
teib_entry_added_t nv_added
Definition: teib.h:74
ctx
long ctx[MAX_CONNS]
Definition: main.c:144
adj_index_t
u32 adj_index_t
An index for adjacencies.
Definition: adj_types.h:30
u8
unsigned char u8
Definition: types.h:56
teib_vft_t_::nv_deleted
teib_entry_deleted_t nv_deleted
Definition: teib.h:75
nh_table_id
u32 nh_table_id
Definition: teib.api:30
teib_entry_added_t
void(* teib_entry_added_t)(const teib_entry_t *ne)
Notifications for the creation and deletion of TEIB entries.
Definition: teib.h:69
sw_if_index
vl_api_interface_index_t sw_if_index
Definition: wireguard.api:34
teib_entry_adj_stack
void teib_entry_adj_stack(const teib_entry_t *ne, adj_index_t ai)
Definition: teib.c:102
teib_entry_del
int teib_entry_del(u32 sw_if_index, const ip_address_t *peer)
Definition: teib.c:258
walk_rc_t
enum walk_rc_t_ walk_rc_t
Walk return code.
fib_prefix_t_
Aggregate type for a prefix.
Definition: fib_types.h:202