libnl: /data/src/libnl3/include/netlink/addr.h Source File

libnl 3.7.0

addr.h
1 /* SPDX-License-Identifier: LGPL-2.1-only */
2 /*
3 * Copyright (c) 2003-2013 Thomas Graf <tgraf@suug.ch>
4 */
5
6 #ifndef NETLINK_ADDR_H_
7 #define NETLINK_ADDR_H_
8
9 #include <netlink/netlink.h>
10
11 #ifdef __cplusplus
12 extern "C" {
13 #endif
14
15 struct nlattr;
16
17 struct nl_addr;
18
19 /* Creation */
20 extern struct nl_addr * nl_addr_alloc(size_t);
21 extern struct nl_addr * nl_addr_alloc_attr(const struct nlattr *, int);
22 extern struct nl_addr * nl_addr_build(int, const void *, size_t);
23 extern int nl_addr_parse(const char *, int, struct nl_addr **);
24 extern struct nl_addr * nl_addr_clone(const struct nl_addr *);
25
26 /* Usage Management */
27 extern struct nl_addr * nl_addr_get(struct nl_addr *);
28 extern void nl_addr_put(struct nl_addr *);
29 extern int nl_addr_shared(const struct nl_addr *);
30
31 extern int nl_addr_cmp(const struct nl_addr *,
32 const struct nl_addr *);
33 extern int nl_addr_cmp_prefix(const struct nl_addr *,
34 const struct nl_addr *);
35 extern int nl_addr_iszero(const struct nl_addr *);
36 extern int nl_addr_valid(const char *, int);
37 extern int nl_addr_guess_family(const struct nl_addr *);
38 extern int nl_addr_fill_sockaddr(const struct nl_addr *,
39 struct sockaddr *, socklen_t *);
40 extern int nl_addr_info(const struct nl_addr *,
41 struct addrinfo **);
42 extern int nl_addr_resolve(const struct nl_addr *, char *, size_t);
43
44 /* Access Functions */
45 extern void nl_addr_set_family(struct nl_addr *, int);
46 extern int nl_addr_get_family(const struct nl_addr *);
47 extern int nl_addr_set_binary_addr(struct nl_addr *, const void *,
48 size_t);
49 extern void * nl_addr_get_binary_addr(const struct nl_addr *);
50 extern unsigned int nl_addr_get_len(const struct nl_addr *);
51 extern void nl_addr_set_prefixlen(struct nl_addr *, int);
52 extern unsigned int nl_addr_get_prefixlen(const struct nl_addr *);
53
54 /* Address Family Translations */
55 extern char * nl_af2str(int, char *, size_t);
56 extern int nl_str2af(const char *);
57
58 /* Translations to Strings */
59 extern char * nl_addr2str(const struct nl_addr *, char *, size_t);
60
61 #ifdef __cplusplus
62 }
63 #endif
64
65 #endif
nl_addr_get_binary_addr
void * nl_addr_get_binary_addr(const struct nl_addr *)
Get binary address of abstract address object.
Definition: addr.c:935
nl_addr_info
int nl_addr_info(const struct nl_addr *, struct addrinfo **)
Call getaddrinfo() for an abstract address object.
Definition: addr.c:798
nl_addr_iszero
int nl_addr_iszero(const struct nl_addr *)
Returns true if the address consists of all zeros.
Definition: addr.c:644
nl_addr2str
char * nl_addr2str(const struct nl_addr *, char *, size_t)
Convert abstract address object to character string.
Definition: addr.c:993
nl_addr_fill_sockaddr
int nl_addr_fill_sockaddr(const struct nl_addr *, struct sockaddr *, socklen_t *)
Fill out sockaddr structure with values from abstract address object.
Definition: addr.c:730
nl_addr_set_prefixlen
void nl_addr_set_prefixlen(struct nl_addr *, int)
Set the prefix length of an abstract address.
Definition: addr.c:959
nl_addr_alloc_attr
struct nl_addr * nl_addr_alloc_attr(const struct nlattr *, int)
Allocate abstract address based on Netlink attribute.
Definition: addr.c:256
nl_addr_resolve
int nl_addr_resolve(const struct nl_addr *, char *, size_t)
Resolve abstract address object to a name using getnameinfo().
Definition: addr.c:842
nl_addr_cmp
int nl_addr_cmp(const struct nl_addr *, const struct nl_addr *)
Compare abstract addresses.
Definition: addr.c:579
nl_addr_parse
int nl_addr_parse(const char *, int, struct nl_addr **)
Allocate abstract address based on character string.
Definition: addr.c:292
nl_addr_set_binary_addr
int nl_addr_set_binary_addr(struct nl_addr *, const void *, size_t)
Set binary address of abstract address object.
Definition: addr.c:912
nl_addr_build
struct nl_addr * nl_addr_build(int, const void *, size_t)
Allocate abstract address based on a binary address.
Definition: addr.c:211
nl_addr_get_family
int nl_addr_get_family(const struct nl_addr *)
Return address family.
Definition: addr.c:887
nl_addr_alloc
struct nl_addr * nl_addr_alloc(size_t)
Allocate empty abstract address.
Definition: addr.c:180
nl_addr_cmp_prefix
int nl_addr_cmp_prefix(const struct nl_addr *, const struct nl_addr *)
Compare the prefix of two abstract addresses.
Definition: addr.c:618
nl_addr_valid
int nl_addr_valid(const char *, int)
Check if address string is parseable for a specific address family.
Definition: addr.c:663
nl_addr_clone
struct nl_addr * nl_addr_clone(const struct nl_addr *)
Clone existing abstract address object.
Definition: addr.c:487
nl_addr_get
struct nl_addr * nl_addr_get(struct nl_addr *)
Increase the reference counter of an abstract address.
Definition: addr.c:517
nl_addr_get_prefixlen
unsigned int nl_addr_get_prefixlen(const struct nl_addr *)
Return prefix length of abstract address object.
Definition: addr.c:970
nl_addr_get_len
unsigned int nl_addr_get_len(const struct nl_addr *)
Get length of binary address of abstract address object.
Definition: addr.c:947
nl_addr_put
void nl_addr_put(struct nl_addr *)
Decrease the reference counter of an abstract address.
Definition: addr.c:533
nl_addr_set_family
void nl_addr_set_family(struct nl_addr *, int)
Set address family.
Definition: addr.c:874
nl_addr_shared
int nl_addr_shared(const struct nl_addr *)
Check whether an abstract address is shared.
Definition: addr.c:550
nl_addr_guess_family
int nl_addr_guess_family(const struct nl_addr *)
Guess address family of abstract address based on address size.
Definition: addr.c:703