FD.io VPP  v20.01-48-g3e0dafb74
Vector Packet Processing
nhrp.h
Go to the documentation of this file.
1 /*
2  * nhrp.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 __NHRP_H__
19 #define __NHRP_H__
20 
21 #include <vnet/ip/ip.h>
22 
23 /**
24  * An NHRP entry represents the mapping between a peer on an interface in the overlay
25  * and a next-hop address in the underlay.
26  * i.e. there's a multipoint tunnel providing the overlay (henace a peer on
27  * that tunnel) which is reachable via 'tunnel destination' address in the
28  * underlay.
29  */
30 typedef struct nhrp_entry_t_ nhrp_entry_t;
31 
32 /** accessors for the opaque struct */
33 extern u32 nhrp_entry_get_sw_if_index (const nhrp_entry_t * ne);
34 extern u32 nhrp_entry_get_fib_index (const nhrp_entry_t * ne);
35 extern const ip46_address_t *nhrp_entry_get_peer (const nhrp_entry_t * ne);
36 extern const fib_prefix_t *nhrp_entry_get_nh (const nhrp_entry_t * ne);
37 extern u8 *format_nhrp_entry (u8 * s, va_list * args);
38 
39 /**
40  * Create a new NHRP entry
41  */
42 extern int nhrp_entry_add (u32 sw_if_index,
43  const ip46_address_t * peer,
44  u32 nh_table_id, const ip46_address_t * nh);
45 
46 extern int nhrp_entry_del (u32 sw_if_index, const ip46_address_t * peer);
47 
49  const ip46_address_t * peer);
50 extern nhrp_entry_t *nhrp_entry_get (index_t nei);
51 
52 extern void nhrp_entry_adj_stack (const nhrp_entry_t * ne, adj_index_t ai);
53 
54 typedef walk_rc_t (*nhrp_walk_cb_t) (index_t nei, void *ctx);
55 
56 extern void nhrp_walk (nhrp_walk_cb_t fn, void *ctx);
57 extern void nhrp_walk_itf (u32 sw_if_index, nhrp_walk_cb_t fn, void *ctx);
58 
59 /**
60  * Notifications for the creation and deletion of NHRP entries
61  */
62 typedef void (*nhrp_entry_added_t) (const nhrp_entry_t * ne);
63 typedef void (*nhrp_entry_deleted_t) (const nhrp_entry_t * ne);
64 
65 typedef struct nhrp_vft_t_
66 {
69 } nhrp_vft_t;
70 
71 extern void nhrp_register (const nhrp_vft_t * vft);
72 
73 #endif
74 
75 /*
76  * fd.io coding-style-patch-verification: ON
77  *
78  * Local Variables:
79  * eval: (c-set-style "gnu")
80  * End:
81  */
void(* nhrp_entry_added_t)(const nhrp_entry_t *ne)
Notifications for the creation and deletion of NHRP entries.
Definition: nhrp.h:62
const fib_prefix_t * nhrp_entry_get_nh(const nhrp_entry_t *ne)
Definition: nhrp.c:68
Definition: nhrp.c:29
vl_api_fib_path_nh_t nh
Definition: fib_types.api:126
void nhrp_entry_adj_stack(const nhrp_entry_t *ne, adj_index_t ai)
Definition: nhrp.c:74
const ip46_address_t * nhrp_entry_get_peer(const nhrp_entry_t *ne)
Definition: nhrp.c:62
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:41
void nhrp_walk(nhrp_walk_cb_t fn, void *ctx)
Definition: nhrp.c:220
unsigned char u8
Definition: types.h:56
enum walk_rc_t_ walk_rc_t
Walk return code.
vl_api_interface_index_t sw_if_index
Definition: gre.api:59
Aggregate type for a prefix.
Definition: fib_types.h:203
unsigned int u32
Definition: types.h:88
vl_api_address_t peer
Definition: nhrp.api:28
long ctx[MAX_CONNS]
Definition: main.c:144
nhrp_entry_t * nhrp_entry_find(u32 sw_if_index, const ip46_address_t *peer)
Definition: nhrp.c:102
void nhrp_register(const nhrp_vft_t *vft)
Definition: nhrp.c:247
void(* nhrp_entry_deleted_t)(const nhrp_entry_t *ne)
Definition: nhrp.h:63
walk_rc_t(* nhrp_walk_cb_t)(index_t nei, void *ctx)
Definition: nhrp.h:54
struct nhrp_vft_t_ nhrp_vft_t
u32 adj_index_t
An index for adjacencies.
Definition: adj_types.h:30
u8 * format_nhrp_entry(u8 *s, va_list *args)
Definition: nhrp.c:199
int nhrp_entry_add(u32 sw_if_index, const ip46_address_t *peer, u32 nh_table_id, const ip46_address_t *nh)
Create a new NHRP entry.
Definition: nhrp.c:119
u32 nhrp_entry_get_fib_index(const nhrp_entry_t *ne)
Definition: nhrp.c:56
nhrp_entry_added_t nv_added
Definition: nhrp.h:67
nhrp_entry_t * nhrp_entry_get(index_t nei)
Definition: nhrp.c:96
nhrp_entry_deleted_t nv_deleted
Definition: nhrp.h:68
void nhrp_walk_itf(u32 sw_if_index, nhrp_walk_cb_t fn, void *ctx)
Definition: nhrp.c:233
u32 nhrp_entry_get_sw_if_index(const nhrp_entry_t *ne)
accessors for the opaque struct
Definition: nhrp.c:50
u32 nh_table_id
Definition: nhrp.api:30
int nhrp_entry_del(u32 sw_if_index, const ip46_address_t *peer)
Definition: nhrp.c:173