libnl  1.1.4
rtnl.h
1 /*
2  * netlink/route/rtnl.h Routing Netlink
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-2006 Thomas Graf <tgraf@suug.ch>
10  */
11 
12 #ifndef NETLINK_RTNL_H_
13 #define NETLINK_RTNL_H_
14 
15 #include <netlink/netlink.h>
16 
17 #ifdef __cplusplus
18 extern "C" {
19 #endif
20 
21 /**
22  * @name Realms
23  * @{
24  */
25 
26 typedef uint32_t realm_t;
27 
28 /**
29  * Mask specying the size of each realm part
30  * @ingroup rtnl
31  */
32 #define RTNL_REALM_MASK (0xFFFF)
33 
34 /**
35  * Extract FROM realm from a realms field
36  */
37 #define RTNL_REALM_FROM(realm) ((realm) >> 16)
38 
39 /**
40  * Extract TO realm from a realms field
41  */
42 #define RTNL_REALM_TO(realm) ((realm) & RTNL_REALM_MASK)
43 
44 /**
45  * Build a realms field
46  */
47 #define RTNL_MAKE_REALM(from, to) \
48  ((RTNL_REALM_TO(from) << 16) & RTNL_REALM_TO(to))
49 
50 /** @} */
51 
52 
53 /* General */
54 extern int nl_rtgen_request(struct nl_handle *, int, int, int);
55 
56 /* Routing Type Translations */
57 extern char * nl_rtntype2str(int, char *, size_t);
58 extern int nl_str2rtntype(const char *);
59 
60 /* Scope Translations */
61 extern char * rtnl_scope2str(int, char *, size_t);
62 extern int rtnl_str2scope(const char *);
63 
64 /* Realms Translations */
65 extern char * rtnl_realms2str(uint32_t, char *, size_t);
66 
67 #ifdef __cplusplus
68 }
69 #endif
70 
71 #endif