1 /* 2 * netlink/route/neighbour.h Neighbours 3 * 4 * This library is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU Lesser General Public 6 * License as published by the Free Software Foundation version 2.1 7 * of the License. 8 * 9 * Copyright (c) 2003-2008 Thomas Graf <tgraf@suug.ch> 10 */ 11 12 #ifndef NETLINK_NEIGHBOUR_H_ 13 #define NETLINK_NEIGHBOUR_H_ 14 15 #include <netlink/netlink.h> 16 #include <netlink/cache.h> 17 #include <netlink/addr.h> 18 19 #ifdef __cplusplus 20 extern "C" { 21 #endif 22 23 struct rtnl_neigh; 24 25 extern struct rtnl_neigh *rtnl_neigh_alloc(void); 26 extern void rtnl_neigh_put(struct rtnl_neigh *); 27 28 extern int rtnl_neigh_alloc_cache(struct nl_sock *, struct nl_cache **); 29 extern int rtnl_neigh_alloc_cache_flags(struct nl_sock *, 30 struct nl_cache **, 31 unsigned int); 32 extern struct rtnl_neigh *rtnl_neigh_get(struct nl_cache *, int, 33 struct nl_addr *); 34 extern struct rtnl_neigh *rtnl_neigh_get_by_vlan(struct nl_cache *, int, 35 struct nl_addr *, int); 36 37 extern int rtnl_neigh_parse(struct nlmsghdr *, struct rtnl_neigh **); 38 39 extern char * rtnl_neigh_state2str(int, char *, size_t); 40 extern int rtnl_neigh_str2state(const char *); 41 42 extern char * rtnl_neigh_flags2str(int, char *, size_t); 43 extern int rtnl_neigh_str2flag(const char *); 44 45 extern int rtnl_neigh_add(struct nl_sock *, struct rtnl_neigh *, int); 46 extern int rtnl_neigh_build_add_request(struct rtnl_neigh *, int, 47 struct nl_msg **); 48 49 extern int rtnl_neigh_delete(struct nl_sock *, struct rtnl_neigh *, int); 50 extern int rtnl_neigh_build_delete_request(struct rtnl_neigh *, int, 51 struct nl_msg **); 52 53 extern void rtnl_neigh_set_state(struct rtnl_neigh *, int); 54 extern int rtnl_neigh_get_state(struct rtnl_neigh *); 55 extern void rtnl_neigh_unset_state(struct rtnl_neigh *, 56 int); 57 58 extern void rtnl_neigh_set_flags(struct rtnl_neigh *, 59 unsigned int); 60 extern void rtnl_neigh_unset_flags(struct rtnl_neigh *, 61 unsigned int); 62 extern unsigned int rtnl_neigh_get_flags(struct rtnl_neigh *); 63 64 extern void rtnl_neigh_set_ifindex(struct rtnl_neigh *, 65 int); 66 extern int rtnl_neigh_get_ifindex(struct rtnl_neigh *); 67 68 extern void rtnl_neigh_set_lladdr(struct rtnl_neigh *, 69 struct nl_addr *); 70 extern struct nl_addr * rtnl_neigh_get_lladdr(struct rtnl_neigh *); 71 72 extern int rtnl_neigh_set_dst(struct rtnl_neigh *, 73 struct nl_addr *); 74 extern struct nl_addr * rtnl_neigh_get_dst(struct rtnl_neigh *); 75 76 extern void rtnl_neigh_set_type(struct rtnl_neigh *, int); 77 extern int rtnl_neigh_get_type(struct rtnl_neigh *); 78 79 extern void rtnl_neigh_set_family(struct rtnl_neigh *, int); 80 extern int rtnl_neigh_get_family(struct rtnl_neigh *); 81 82 extern void rtnl_neigh_set_vlan(struct rtnl_neigh *, int); 83 extern int rtnl_neigh_get_vlan(struct rtnl_neigh *); 84 85 extern void rtnl_neigh_set_master(struct rtnl_neigh *, int); 86 extern int rtnl_neigh_get_master(struct rtnl_neigh *); 87 88 #ifdef __cplusplus 89 } 90 #endif 91 92 #endif 93