FD.io VPP  v20.05.1-6-gf53edbc3b
Vector Packet Processing
ip_neighbor.h
Go to the documentation of this file.
1 /*
2  * ip_neighboor.h: ip neighbor generic services
3  *
4  * Copyright (c) 2018 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 __INCLUDE_IP_NEIGHBOR_H__
19 #define __INCLUDE_IP_NEIGHBOR_H__
20 
22 
23 #include <vnet/adj/adj.h>
24 
26 
27 
28 /*****
29  * APIs external modules can invoke on the neighbor subsystem
30  */
31 
33 extern int ip_neighbor_add (const ip46_address_t * ip,
35  const mac_address_t * mac,
38 extern int ip_neighbor_del (const ip46_address_t * ip,
40 
41 extern int ip_neighbor_config (ip46_type_t type, u32 limit, u32 age,
42  bool recycle);
43 
45 
46 typedef walk_rc_t (*ip_neighbor_walk_cb_t) (index_t ipni, void *ctx);
47 extern void ip_neighbor_walk (ip46_type_t type,
49  ip_neighbor_walk_cb_t fn, void *ctx);
50 
51 extern const ip46_address_t *ip_neighbor_get_ip (const ip_neighbor_t * ipn);
52 extern const mac_address_t *ip_neighbor_get_mac (const ip_neighbor_t * ipn);
53 extern const u32 ip_neighbor_get_sw_if_index (const ip_neighbor_t * ipn);
54 
55 extern void ip_neighbor_learn (const ip_neighbor_learn_t * l);
56 
57 extern void ip_neighbor_update (vnet_main_t * vnm, adj_index_t ai);
58 
59 extern void ip_neighbor_advertise (vlib_main_t * vm,
60  ip46_type_t tyoe,
61  const ip46_address_t * addr,
63 extern void ip_neighbor_probe (const ip_adjacency_t * adj);
64 extern void ip_neighbor_probe_dst (const ip_adjacency_t * adj,
65  const ip46_address_t * ip);
66 
67 extern void ip_neighbor_mark (ip46_type_t type);
68 extern void ip_neighbor_sweep (ip46_type_t type);
69 
70 /**
71  * From the watcher to the API to publish a new neighbor
72  */
73 extern void ip_neighbor_handle_event (const ip_neighbor_event_t * ipne);
74 
75 /**
76  * The set of function that vnet requires from the IP neighbour module.
77  * Note that an implementation of these functions will not exist
78  * if the ip-neighbour plugin is not loaded. so check the error codes!
79  */
80 extern int ip4_neighbor_proxy_add (u32 fib_index,
81  const ip4_address_t * start,
82  const ip4_address_t * end);
83 extern int ip4_neighbor_proxy_delete (u32 fib_index,
84  const ip4_address_t * start,
85  const ip4_address_t * end);
89  const ip6_address_t * addr);
91  const ip6_address_t * addr);
92 
93 /**
94  * neighbor protocol implementation registration functions
95  * this are provided by ARP and IP-ND
96  */
97 typedef int (*ip4_neighbor_proxy_addr_t) (u32 fib_index,
98  const ip4_address_t * start,
99  const ip4_address_t * end);
102  const ip6_address_t * addr);
103 
104 /**
105  * Virtual function Table for neighbor protocol implementations to register
106  */
107 typedef struct ip_neighbor_vft_t_
108 {
116 
118  const ip_neighbor_vft_t * vft);
119 
120 
121 #endif /* __INCLUDE_IP_NEIGHBOR_H__ */
122 
123 /*
124  * fd.io coding-style-patch-verification: ON
125  *
126  * Local Variables:
127  * eval: (c-set-style "gnu")
128  * End:
129  */
void ip_neighbor_probe(const ip_adjacency_t *adj)
Definition: ip_neighbor.c:1015
vl_api_mac_address_t mac
Definition: l2.api:502
void ip_neighbor_scan_enable_disable(ip_neighbor_scan_arg_t *arg)
ip_neighbor_t * ip_neighbor_get(index_t ipni)
Definition: ip_neighbor.c:88
void ip_neighbor_learn(const ip_neighbor_learn_t *l)
Definition: ip_neighbor.c:688
IP unicast adjacency.
Definition: adj.h:227
int(* ip4_neighbor_proxy_cfg_t)(u32 sw_if_index)
Definition: ip_neighbor.h:100
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 ip_neighbor_mark(ip46_type_t type)
Definition: ip_neighbor.c:1237
void ip_neighbor_register(ip46_type_t type, const ip_neighbor_vft_t *vft)
Definition: ip_neighbor.c:988
vhost_vring_addr_t addr
Definition: vhost_user.h:254
ip4_neighbor_proxy_addr_t inv_proxy4_del
Definition: ip_neighbor.h:112
const mac_address_t * ip_neighbor_get_mac(const ip_neighbor_t *ipn)
Definition: ip_neighbor.c:121
enum walk_rc_t_ walk_rc_t
Walk return code.
int(* ip6_neighbor_proxy_cfg_t)(u32 sw_if_index, const ip6_address_t *addr)
Definition: ip_neighbor.h:101
int ip6_neighbor_proxy_add(u32 sw_if_index, const ip6_address_t *addr)
Definition: ip_neighbor.c:1121
vl_api_interface_index_t sw_if_index
Definition: gre.api:53
int ip4_neighbor_proxy_disable(u32 sw_if_index)
Definition: ip_neighbor.c:1111
A representation of an IP neighbour/peer.
ip6_neighbor_proxy_cfg_t inv_proxy6_del
Definition: ip_neighbor.h:114
int ip4_neighbor_proxy_enable(u32 sw_if_index)
Definition: ip_neighbor.c:1101
unsigned int u32
Definition: types.h:88
ip6_neighbor_proxy_cfg_t inv_proxy6_add
Definition: ip_neighbor.h:113
walk_rc_t(* ip_neighbor_walk_cb_t)(index_t ipni, void *ctx)
Definition: ip_neighbor.h:46
vl_api_fib_path_type_t type
Definition: fib_types.api:123
long ctx[MAX_CONNS]
Definition: main.c:144
int ip_neighbor_del(const ip46_address_t *ip, ip46_type_t type, u32 sw_if_index)
Definition: ip_neighbor.c:552
void ip_neighbor_handle_event(const ip_neighbor_event_t *ipne)
From the watcher to the API to publish a new neighbor.
void ip_neighbor_advertise(vlib_main_t *vm, ip46_type_t tyoe, const ip46_address_t *addr, u32 sw_if_index)
Definition: ip_neighbor.c:1021
vlib_main_t * vm
Definition: in2out_ed.c:1599
struct ip_neighbor_vft_t_ ip_neighbor_vft_t
Virtual function Table for neighbor protocol implementations to register.
void ip_neighbor_sweep(ip46_type_t type)
Definition: ip_neighbor.c:1264
u32 flags
Definition: vhost_user.h:248
void ip_neighbor_walk(ip46_type_t type, u32 sw_if_index, ip_neighbor_walk_cb_t fn, void *ctx)
Definition: ip_neighbor.c:1034
ip4_neighbor_proxy_cfg_t inv_proxy4_disable
Definition: ip_neighbor.h:110
Virtual function Table for neighbor protocol implementations to register.
Definition: ip_neighbor.h:107
u32 adj_index_t
An index for adjacencies.
Definition: adj_types.h:30
u32 stats_index
Definition: ip.api:143
int ip6_neighbor_proxy_del(u32 sw_if_index, const ip6_address_t *addr)
Definition: ip_neighbor.c:1131
int ip4_neighbor_proxy_add(u32 fib_index, const ip4_address_t *start, const ip4_address_t *end)
The set of function that vnet requires from the IP neighbour module.
Definition: ip_neighbor.c:1074
int ip4_neighbor_proxy_delete(u32 fib_index, const ip4_address_t *start, const ip4_address_t *end)
Definition: ip_neighbor.c:1088
void ip_neighbor_update(vnet_main_t *vnm, adj_index_t ai)
Definition: ip_neighbor.c:614
const u32 ip_neighbor_get_sw_if_index(const ip_neighbor_t *ipn)
Definition: ip_neighbor.c:127
vl_api_address_t ip
Definition: l2.api:501
int(* ip4_neighbor_proxy_addr_t)(u32 fib_index, const ip4_address_t *start, const ip4_address_t *end)
neighbor protocol implementation registration functions this are provided by ARP and IP-ND ...
Definition: ip_neighbor.h:97
void ip_neighbor_probe_dst(const ip_adjacency_t *adj, const ip46_address_t *ip)
Definition: ip_neighbor.c:994
void ip_neighbor_del_all(ip46_type_t type, u32 sw_if_index)
Definition: ip_neighbor.c:595
const ip46_address_t * ip_neighbor_get_ip(const ip_neighbor_t *ipn)
Definition: ip_neighbor.c:115
f64 end
end of the time range
Definition: mactime.api:44
int ip_neighbor_add(const ip46_address_t *ip, ip46_type_t type, const mac_address_t *mac, u32 sw_if_index, ip_neighbor_flags_t flags, u32 *stats_index)
Definition: ip_neighbor.c:453
ip4_neighbor_proxy_cfg_t inv_proxy4_enable
Definition: ip_neighbor.h:109
enum ip_neighbor_flags_t_ ip_neighbor_flags_t
int ip_neighbor_config(ip46_type_t type, u32 limit, u32 age, bool recycle)
Definition: ip_neighbor.c:1675
ip4_neighbor_proxy_addr_t inv_proxy4_add
Definition: ip_neighbor.h:111
ip46_type_t
Definition: ip46_address.h:22