• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * netlink/route/addr.c		rtnetlink addr layer
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-2011 Thomas Graf <tgraf@suug.ch>
10  * Copyright (c) 2003-2006 Baruch Even <baruch@ev-en.org>,
11  *                         Mediatrix Telecom, inc. <ericb@mediatrix.com>
12  */
13 
14 #ifndef NETADDR_ADDR_H_
15 #define NETADDR_ADDR_H_
16 
17 #include <netlink/netlink.h>
18 #include <netlink/cache.h>
19 #include <netlink/addr.h>
20 #include <netlink/route/link.h>
21 
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25 
26 struct rtnl_addr;
27 
28 /* General */
29 extern struct rtnl_addr *rtnl_addr_alloc(void);
30 extern void	rtnl_addr_put(struct rtnl_addr *);
31 
32 extern int	rtnl_addr_alloc_cache(struct nl_sock *, struct nl_cache **);
33 extern struct rtnl_addr *
34 		rtnl_addr_get(struct nl_cache *, int, struct nl_addr *);
35 
36 extern int	rtnl_addr_build_add_request(struct rtnl_addr *, int,
37 					    struct nl_msg **);
38 extern int	rtnl_addr_add(struct nl_sock *, struct rtnl_addr *, int);
39 
40 extern int	rtnl_addr_build_delete_request(struct rtnl_addr *, int,
41 					       struct nl_msg **);
42 extern int	rtnl_addr_delete(struct nl_sock *,
43 				 struct rtnl_addr *, int);
44 
45 extern char *	rtnl_addr_flags2str(int, char *, size_t);
46 extern int	rtnl_addr_str2flags(const char *);
47 
48 extern int	rtnl_addr_set_label(struct rtnl_addr *, const char *);
49 extern char *	rtnl_addr_get_label(struct rtnl_addr *);
50 
51 extern void	rtnl_addr_set_ifindex(struct rtnl_addr *, int);
52 extern int	rtnl_addr_get_ifindex(struct rtnl_addr *);
53 
54 extern void	rtnl_addr_set_link(struct rtnl_addr *, struct rtnl_link *);
55 extern struct rtnl_link *
56 		rtnl_addr_get_link(struct rtnl_addr *);
57 
58 extern void	rtnl_addr_set_family(struct rtnl_addr *, int);
59 extern int	rtnl_addr_get_family(struct rtnl_addr *);
60 
61 extern void	rtnl_addr_set_prefixlen(struct rtnl_addr *, int);
62 extern int	rtnl_addr_get_prefixlen(struct rtnl_addr *);
63 
64 extern void	rtnl_addr_set_scope(struct rtnl_addr *, int);
65 extern int	rtnl_addr_get_scope(struct rtnl_addr *);
66 
67 extern void	rtnl_addr_set_flags(struct rtnl_addr *, unsigned int);
68 extern void	rtnl_addr_unset_flags(struct rtnl_addr *, unsigned int);
69 extern unsigned int rtnl_addr_get_flags(struct rtnl_addr *);
70 
71 extern int	rtnl_addr_set_local(struct rtnl_addr *,
72 					    struct nl_addr *);
73 extern struct nl_addr *rtnl_addr_get_local(struct rtnl_addr *);
74 
75 extern int	rtnl_addr_set_peer(struct rtnl_addr *, struct nl_addr *);
76 extern struct nl_addr *rtnl_addr_get_peer(struct rtnl_addr *);
77 
78 extern int	rtnl_addr_set_broadcast(struct rtnl_addr *, struct nl_addr *);
79 extern struct nl_addr *rtnl_addr_get_broadcast(struct rtnl_addr *);
80 
81 extern int	rtnl_addr_set_multicast(struct rtnl_addr *, struct nl_addr *);
82 extern struct nl_addr *rtnl_addr_get_multicast(struct rtnl_addr *);
83 
84 extern int	rtnl_addr_set_anycast(struct rtnl_addr *, struct nl_addr *);
85 extern struct nl_addr *rtnl_addr_get_anycast(struct rtnl_addr *);
86 
87 extern uint32_t rtnl_addr_get_valid_lifetime(struct rtnl_addr *);
88 extern void	rtnl_addr_set_valid_lifetime(struct rtnl_addr *, uint32_t);
89 extern uint32_t rtnl_addr_get_preferred_lifetime(struct rtnl_addr *);
90 extern void	rtnl_addr_set_preferred_lifetime(struct rtnl_addr *, uint32_t);
91 extern uint32_t rtnl_addr_get_create_time(struct rtnl_addr *);
92 extern uint32_t rtnl_addr_get_last_update_time(struct rtnl_addr *);
93 
94 #ifdef __cplusplus
95 }
96 #endif
97 
98 #endif
99