Debian Codegraph @

include/netlink/route/rtnl.h

raw
1 /* SPDX-License-Identifier: LGPL-2.1-only */
2 /*
3 * Copyright (c) 2003-2008 Thomas Graf <[email protected]>
4 */
5
6 #ifndef NETLINK_RTNL_H_
7 #define NETLINK_RTNL_H_
8
9 #include <netlink/netlink.h>
10
11 #ifdef __cplusplus
12 extern "C" {
13 #endif
14
15 /**
16 * @name Realms
17 * @{
18 */
19
20 /**
21 * Mask specying the size of each realm part
22 * @ingroup rtnl
23 */
24 #define RTNL_REALM_MASK (0xFFFF)
25
26 /**
27 * Extract FROM realm from a realms field
28 */
29 #define RTNL_REALM_FROM(realm) ((realm) >> 16)
30
31 /**
32 * Extract TO realm from a realms field
33 */
34 #define RTNL_REALM_TO(realm) ((realm) & RTNL_REALM_MASK)
35
36 /**
37 * Build a realms field
38 */
39 #define RTNL_MAKE_REALM(from, to) \
40 ((RTNL_REALM_TO(from) << 16) & RTNL_REALM_TO(to))
41
42 /** @} */
43
44
45 /* General */
46 extern int nl_rtgen_request(struct nl_sock *, int, int, int);
47
48 /* Routing Type Translations */
49 extern char * nl_rtntype2str(int, char *, size_t);
50 extern int nl_str2rtntype(const char *);
51
52 /* Scope Translations */
53 extern char * rtnl_scope2str(int, char *, size_t);
54 extern int rtnl_str2scope(const char *);
55
56 /* Realms Translations */
57 extern char * rtnl_realms2str(uint32_t, char *, size_t);
58
59 #ifdef __cplusplus
60 }
61 #endif
62
63 #endif