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-2008 Thomas Graf <tgraf (at) suug.ch> 10 * Copyright (c) 2003-2006 Baruch Even <baruch (at) ev-en.org>, 11 * Mediatrix Telecom, inc. <ericb (at) 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 21 #ifdef __cplusplus 22 extern "C" { 23 #endif 24 25 struct rtnl_addr; 26 27 /* General */ 28 extern struct rtnl_addr *rtnl_addr_alloc(void); 29 extern void rtnl_addr_put(struct rtnl_addr *); 30 31 extern int rtnl_addr_alloc_cache(struct nl_sock *, struct nl_cache **); 32 33 extern int rtnl_addr_build_add_request(struct rtnl_addr *, int, 34 struct nl_msg **); 35 extern int rtnl_addr_add(struct nl_sock *, struct rtnl_addr *, int); 36 37 extern int rtnl_addr_build_delete_request(struct rtnl_addr *, int, 38 struct nl_msg **); 39 extern int rtnl_addr_delete(struct nl_sock *, 40 struct rtnl_addr *, int); 41 42 extern char * rtnl_addr_flags2str(int, char *, size_t); 43 extern int rtnl_addr_str2flags(const char *); 44 45 extern int rtnl_addr_set_label(struct rtnl_addr *, const char *); 46 extern char * rtnl_addr_get_label(struct rtnl_addr *); 47 48 extern void rtnl_addr_set_ifindex(struct rtnl_addr *, int); 49 extern int rtnl_addr_get_ifindex(struct rtnl_addr *); 50 51 extern void rtnl_addr_set_family(struct rtnl_addr *, int); 52 extern int rtnl_addr_get_family(struct rtnl_addr *); 53 54 extern void rtnl_addr_set_prefixlen(struct rtnl_addr *, int); 55 extern int rtnl_addr_get_prefixlen(struct rtnl_addr *); 56 57 extern void rtnl_addr_set_scope(struct rtnl_addr *, int); 58 extern int rtnl_addr_get_scope(struct rtnl_addr *); 59 60 extern void rtnl_addr_set_flags(struct rtnl_addr *, unsigned int); 61 extern void rtnl_addr_unset_flags(struct rtnl_addr *, unsigned int); 62 extern unsigned int rtnl_addr_get_flags(struct rtnl_addr *); 63 64 extern int rtnl_addr_set_local(struct rtnl_addr *, 65 struct nl_addr *); 66 extern struct nl_addr *rtnl_addr_get_local(struct rtnl_addr *); 67 68 extern int rtnl_addr_set_peer(struct rtnl_addr *, struct nl_addr *); 69 extern struct nl_addr *rtnl_addr_get_peer(struct rtnl_addr *); 70 71 extern int rtnl_addr_set_broadcast(struct rtnl_addr *, struct nl_addr *); 72 extern struct nl_addr *rtnl_addr_get_broadcast(struct rtnl_addr *); 73 74 extern int rtnl_addr_set_multicast(struct rtnl_addr *, struct nl_addr *); 75 extern struct nl_addr *rtnl_addr_get_multicast(struct rtnl_addr *); 76 77 extern int rtnl_addr_set_anycast(struct rtnl_addr *, struct nl_addr *); 78 extern struct nl_addr *rtnl_addr_get_anycast(struct rtnl_addr *); 79 80 extern uint32_t rtnl_addr_get_valid_lifetime(struct rtnl_addr *); 81 extern void rtnl_addr_set_valid_lifetime(struct rtnl_addr *, uint32_t); 82 extern uint32_t rtnl_addr_get_preferred_lifetime(struct rtnl_addr *); 83 extern void rtnl_addr_set_preferred_lifetime(struct rtnl_addr *, uint32_t); 84 extern uint32_t rtnl_addr_get_create_time(struct rtnl_addr *); 85 extern uint32_t rtnl_addr_get_last_update_time(struct rtnl_addr *); 86 87 #ifdef __cplusplus 88 } 89 #endif 90 91 #endif 92