xref: /freebsd/contrib/ofed/libibverbs/neigh.h (revision b0d29bc47dba79f6f38e67eabadfb4b32ffd9390)
1 /* Licensed under the OpenIB.org BSD license (FreeBSD Variant) - See COPYING.md
2  */
3 
4 #ifndef _NEIGH_H_
5 #define _NEIGH_H_
6 
7 #include <stddef.h>
8 #include <stdint.h>
9 #include "config.h"
10 #ifdef HAVE_LIBNL1
11 #include <netlink/object.h>
12 #include "nl1_compat.h"
13 #else
14 #include <netlink/object-api.h>
15 #endif
16 
17 struct get_neigh_handler {
18 #ifdef HAVE_LIBNL1
19 	struct nl_handle *sock;
20 #else
21 	struct nl_sock *sock;
22 #endif
23 	struct nl_cache *link_cache;
24 	struct nl_cache	*neigh_cache;
25 	struct nl_cache *route_cache;
26 	int32_t oif;
27 	int vid;
28 	struct rtnl_neigh *filter_neigh;
29 	struct nl_addr *found_ll_addr;
30 	struct nl_addr *dst;
31 	struct nl_addr *src;
32 	uint64_t timeout;
33 };
34 
35 int process_get_neigh(struct get_neigh_handler *neigh_handler);
36 void neigh_free_resources(struct get_neigh_handler *neigh_handler);
37 void neigh_set_vlan_id(struct get_neigh_handler *neigh_handler, uint16_t vid);
38 uint16_t neigh_get_vlan_id_from_dev(struct get_neigh_handler *neigh_handler);
39 int neigh_init_resources(struct get_neigh_handler *neigh_handler, int timeout);
40 
41 int neigh_set_src(struct get_neigh_handler *neigh_handler,
42 		  int family, void *buf, size_t size);
43 void neigh_set_oif(struct get_neigh_handler *neigh_handler, int oif);
44 int neigh_set_dst(struct get_neigh_handler *neigh_handler,
45 		  int family, void *buf, size_t size);
46 int neigh_get_oif_from_src(struct get_neigh_handler *neigh_handler);
47 int neigh_get_ll(struct get_neigh_handler *neigh_handler, void *addr_buf,
48 		 int addr_size);
49 
50 #endif
51