libnl  1.1.4
neighbour.h
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-2006 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 /* neighbour object allocation/freeage */
26 extern struct rtnl_neigh * rtnl_neigh_alloc(void);
27 extern void rtnl_neigh_put(struct rtnl_neigh *);
28 
29 /* neighbour cache management */
30 extern struct nl_cache * rtnl_neigh_alloc_cache(struct nl_handle *);
31 extern struct rtnl_neigh * rtnl_neigh_get(struct nl_cache *, int,
32  struct nl_addr *);
33 
34 /* Neigbour state translations */
35 extern char * rtnl_neigh_state2str(int, char *, size_t);
36 extern int rtnl_neigh_str2state(const char *);
37 
38 /* Neighbour flags translations */
39 extern char * rtnl_neigh_flags2str(int, char *, size_t);
40 extern int rtnl_neigh_str2flag(const char *);
41 
42 /* Neighbour Addition */
43 extern int rtnl_neigh_add(struct nl_handle *,
44  struct rtnl_neigh *, int);
45 extern struct nl_msg * rtnl_neigh_build_add_request(struct rtnl_neigh *, int);
46 
47 /* Neighbour Modification */
48 extern int rtnl_neigh_change(struct nl_handle *,
49  struct rtnl_neigh *, int);
50 extern struct nl_msg * rtnl_neigh_build_change_request(struct rtnl_neigh *, int);
51 
52 /* Neighbour Deletion */
53 extern int rtnl_neigh_delete(struct nl_handle *,
54  struct rtnl_neigh *, int);
55 extern struct nl_msg * rtnl_neigh_build_delete_request(struct rtnl_neigh *, int);
56 
57 /* Access functions */
58 extern void rtnl_neigh_set_state(struct rtnl_neigh *, int);
59 extern int rtnl_neigh_get_state(struct rtnl_neigh *);
60 extern void rtnl_neigh_unset_state(struct rtnl_neigh *,
61  int);
62 
63 extern void rtnl_neigh_set_flags(struct rtnl_neigh *,
64  unsigned int);
65 extern void rtnl_neigh_unset_flags(struct rtnl_neigh *,
66  unsigned int);
67 extern unsigned int rtnl_neigh_get_flags(struct rtnl_neigh *);
68 
69 extern void rtnl_neigh_set_ifindex(struct rtnl_neigh *,
70  int);
71 extern int rtnl_neigh_get_ifindex(struct rtnl_neigh *);
72 
73 extern void rtnl_neigh_set_lladdr(struct rtnl_neigh *,
74  struct nl_addr *);
75 extern struct nl_addr * rtnl_neigh_get_lladdr(struct rtnl_neigh *);
76 
77 extern int rtnl_neigh_set_dst(struct rtnl_neigh *,
78  struct nl_addr *);
79 extern struct nl_addr * rtnl_neigh_get_dst(struct rtnl_neigh *);
80 
81 extern void rtnl_neigh_set_type(struct rtnl_neigh *, int);
82 extern int rtnl_neigh_get_type(struct rtnl_neigh *);
83 
84 extern void rtnl_neigh_set_family(struct rtnl_neigh *, int);
85 extern int rtnl_neigh_get_family(struct rtnl_neigh *);
86 
87 #ifdef __cplusplus
88 }
89 #endif
90 
91 #endif
int rtnl_neigh_add(struct nl_handle *, struct rtnl_neigh *, int)
Add a new neighbour.
Definition: neigh.c:656
struct nl_cache * rtnl_neigh_alloc_cache(struct nl_handle *)
Build a neighbour cache including all neighbours currently configured in the kernel.
Definition: neigh.c:534
int rtnl_neigh_delete(struct nl_handle *, struct rtnl_neigh *, int)
Delete a neighbour.
Definition: neigh.c:711
struct nl_msg * rtnl_neigh_build_add_request(struct rtnl_neigh *, int)
Build netlink request message to add a new neighbour.
Definition: neigh.c:633
struct nl_msg * rtnl_neigh_build_delete_request(struct rtnl_neigh *, int)
Build a netlink request message to delete a neighbour.
Definition: neigh.c:693
struct rtnl_neigh * rtnl_neigh_get(struct nl_cache *, int, struct nl_addr *)
Look up a neighbour by interface index and destination address.
Definition: neigh.c:559
int rtnl_neigh_change(struct nl_handle *, struct rtnl_neigh *, int)
Change neighbour attributes.
Definition: neigh.c:770
struct nl_msg * rtnl_neigh_build_change_request(struct rtnl_neigh *, int)
Build a netlink request message to change neighbour attributes.
Definition: neigh.c:750