libnl 3.7.0
addr.h
1/* SPDX-License-Identifier: LGPL-2.1-only */
2/*
3 * Copyright (c) 2003-2011 Thomas Graf <tgraf@suug.ch>
4 * Copyright (c) 2003-2006 Baruch Even <baruch@ev-en.org>
5 * Copyright (c) 2003-2006 Mediatrix Telecom, inc. <ericb@mediatrix.com>
6 */
7
8#ifndef NETADDR_ADDR_H_
9#define NETADDR_ADDR_H_
10
11#include <netlink/netlink.h>
12#include <netlink/cache.h>
13#include <netlink/addr.h>
14#include <netlink/route/link.h>
15
16#ifdef __cplusplus
17extern "C" {
18#endif
19
20struct rtnl_addr;
21
22/* General */
23extern struct rtnl_addr *rtnl_addr_alloc(void);
24extern void rtnl_addr_put(struct rtnl_addr *);
25
26extern int rtnl_addr_alloc_cache(struct nl_sock *, struct nl_cache **);
27extern struct rtnl_addr *
28 rtnl_addr_get(struct nl_cache *, int, struct nl_addr *);
29
30extern int rtnl_addr_build_add_request(struct rtnl_addr *, int,
31 struct nl_msg **);
32extern int rtnl_addr_add(struct nl_sock *, struct rtnl_addr *, int);
33
34extern int rtnl_addr_build_delete_request(struct rtnl_addr *, int,
35 struct nl_msg **);
36extern int rtnl_addr_delete(struct nl_sock *,
37 struct rtnl_addr *, int);
38
39extern char * rtnl_addr_flags2str(int, char *, size_t);
40extern int rtnl_addr_str2flags(const char *);
41
42extern int rtnl_addr_set_label(struct rtnl_addr *, const char *);
43extern char * rtnl_addr_get_label(struct rtnl_addr *);
44
45extern void rtnl_addr_set_ifindex(struct rtnl_addr *, int);
46extern int rtnl_addr_get_ifindex(struct rtnl_addr *);
47
48extern void rtnl_addr_set_link(struct rtnl_addr *, struct rtnl_link *);
49extern struct rtnl_link *
50 rtnl_addr_get_link(struct rtnl_addr *);
51
52extern void rtnl_addr_set_family(struct rtnl_addr *, int);
53extern int rtnl_addr_get_family(struct rtnl_addr *);
54
55extern void rtnl_addr_set_prefixlen(struct rtnl_addr *, int);
56extern int rtnl_addr_get_prefixlen(struct rtnl_addr *);
57
58extern void rtnl_addr_set_scope(struct rtnl_addr *, int);
59extern int rtnl_addr_get_scope(struct rtnl_addr *);
60
61extern void rtnl_addr_set_flags(struct rtnl_addr *, unsigned int);
62extern void rtnl_addr_unset_flags(struct rtnl_addr *, unsigned int);
63extern unsigned int rtnl_addr_get_flags(struct rtnl_addr *);
64
65extern int rtnl_addr_set_local(struct rtnl_addr *,
66 struct nl_addr *);
67extern struct nl_addr *rtnl_addr_get_local(struct rtnl_addr *);
68
69extern int rtnl_addr_set_peer(struct rtnl_addr *, struct nl_addr *);
70extern struct nl_addr *rtnl_addr_get_peer(struct rtnl_addr *);
71
72extern int rtnl_addr_set_broadcast(struct rtnl_addr *, struct nl_addr *);
73extern struct nl_addr *rtnl_addr_get_broadcast(struct rtnl_addr *);
74
75extern int rtnl_addr_set_multicast(struct rtnl_addr *, struct nl_addr *);
76extern struct nl_addr *rtnl_addr_get_multicast(struct rtnl_addr *);
77
78extern int rtnl_addr_set_anycast(struct rtnl_addr *, struct nl_addr *);
79extern struct nl_addr *rtnl_addr_get_anycast(struct rtnl_addr *);
80
81extern uint32_t rtnl_addr_get_valid_lifetime(struct rtnl_addr *);
82extern void rtnl_addr_set_valid_lifetime(struct rtnl_addr *, uint32_t);
83extern uint32_t rtnl_addr_get_preferred_lifetime(struct rtnl_addr *);
84extern void rtnl_addr_set_preferred_lifetime(struct rtnl_addr *, uint32_t);
85extern uint32_t rtnl_addr_get_create_time(struct rtnl_addr *);
86extern uint32_t rtnl_addr_get_last_update_time(struct rtnl_addr *);
87
88#ifdef __cplusplus
89}
90#endif
91
92#endif
int rtnl_addr_build_delete_request(struct rtnl_addr *, int, struct nl_msg **)
Build a netlink request message to request deletion of an address.
Definition: addr.c:795
int rtnl_addr_delete(struct nl_sock *, struct rtnl_addr *, int)
Request deletion of an address.
Definition: addr.c:820
struct rtnl_addr * rtnl_addr_get(struct nl_cache *, int, struct nl_addr *)
Search address in cache.
Definition: addr.c:596
int rtnl_addr_add(struct nl_sock *, struct rtnl_addr *, int)
Request addition of new address.
Definition: addr.c:748
int rtnl_addr_build_add_request(struct rtnl_addr *, int, struct nl_msg **)
Build netlink request message to request addition of new address.
Definition: addr.c:722
void rtnl_addr_set_prefixlen(struct rtnl_addr *, int)
Set the prefix length / netmask.
Definition: addr.c:923