OLD | NEW |
1 #ifndef _NET_ROUTE_H | 1 #ifndef _NET_ROUTE_H |
2 #define _NET_ROUTE_H | 2 #define _NET_ROUTE_H |
3 | 3 |
4 #ifdef __cplusplus | 4 #ifdef __cplusplus |
5 extern "C" { | 5 extern "C" { |
6 #endif | 6 #endif |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 #include <sys/socket.h> | 9 #include <sys/socket.h> |
10 #include <sys/types.h> | 10 #include <sys/types.h> |
11 #include <netinet/in.h> | 11 #include <netinet/in.h> |
12 | 12 |
13 | |
14 struct rtentry { | 13 struct rtentry { |
15 » unsigned long int rt_pad1; | 14 unsigned long int rt_pad1; |
16 » struct sockaddr rt_dst; | 15 struct sockaddr rt_dst; |
17 » struct sockaddr rt_gateway; | 16 struct sockaddr rt_gateway; |
18 » struct sockaddr rt_genmask; | 17 struct sockaddr rt_genmask; |
19 » unsigned short int rt_flags; | 18 unsigned short int rt_flags; |
20 » short int rt_pad2; | 19 short int rt_pad2; |
21 » unsigned long int rt_pad3; | 20 unsigned long int rt_pad3; |
22 » unsigned char rt_tos; | 21 unsigned char rt_tos; |
23 » unsigned char rt_class; | 22 unsigned char rt_class; |
24 » short int rt_pad4[sizeof(long)/2-1]; | 23 short int rt_pad4[sizeof(long) / 2 - 1]; |
25 » short int rt_metric; | 24 short int rt_metric; |
26 » char *rt_dev; | 25 char* rt_dev; |
27 » unsigned long int rt_mtu; | 26 unsigned long int rt_mtu; |
28 » unsigned long int rt_window; | 27 unsigned long int rt_window; |
29 » unsigned short int rt_irtt; | 28 unsigned short int rt_irtt; |
30 }; | 29 }; |
31 | 30 |
32 #define rt_mss» rt_mtu | 31 #define rt_mss rt_mtu |
33 | |
34 | 32 |
35 struct in6_rtmsg { | 33 struct in6_rtmsg { |
36 » struct in6_addr rtmsg_dst; | 34 struct in6_addr rtmsg_dst; |
37 » struct in6_addr rtmsg_src; | 35 struct in6_addr rtmsg_src; |
38 » struct in6_addr rtmsg_gateway; | 36 struct in6_addr rtmsg_gateway; |
39 » uint32_t rtmsg_type; | 37 uint32_t rtmsg_type; |
40 » uint16_t rtmsg_dst_len; | 38 uint16_t rtmsg_dst_len; |
41 » uint16_t rtmsg_src_len; | 39 uint16_t rtmsg_src_len; |
42 » uint32_t rtmsg_metric; | 40 uint32_t rtmsg_metric; |
43 » unsigned long int rtmsg_info; | 41 unsigned long int rtmsg_info; |
44 » uint32_t rtmsg_flags; | 42 uint32_t rtmsg_flags; |
45 » int rtmsg_ifindex; | 43 int rtmsg_ifindex; |
46 }; | 44 }; |
47 | 45 |
| 46 #define RTF_UP 0x0001 |
| 47 #define RTF_GATEWAY 0x0002 |
48 | 48 |
49 #define»RTF_UP» » 0x0001 | 49 #define RTF_HOST 0x0004 |
50 #define»RTF_GATEWAY» 0x0002 | 50 #define RTF_REINSTATE 0x0008 |
| 51 #define RTF_DYNAMIC 0x0010 |
| 52 #define RTF_MODIFIED 0x0020 |
| 53 #define RTF_MTU 0x0040 |
| 54 #define RTF_MSS RTF_MTU |
| 55 #define RTF_WINDOW 0x0080 |
| 56 #define RTF_IRTT 0x0100 |
| 57 #define RTF_REJECT 0x0200 |
| 58 #define RTF_STATIC 0x0400 |
| 59 #define RTF_XRESOLVE 0x0800 |
| 60 #define RTF_NOFORWARD 0x1000 |
| 61 #define RTF_THROW 0x2000 |
| 62 #define RTF_NOPMTUDISC 0x4000 |
51 | 63 |
52 #define»RTF_HOST» 0x0004 | 64 #define RTF_DEFAULT 0x00010000 |
53 #define RTF_REINSTATE» 0x0008 | 65 #define RTF_ALLONLINK 0x00020000 |
54 #define»RTF_DYNAMIC» 0x0010 | 66 #define RTF_ADDRCONF 0x00040000 |
55 #define»RTF_MODIFIED» 0x0020 | |
56 #define RTF_MTU»» 0x0040 | |
57 #define RTF_MSS»» RTF_MTU | |
58 #define RTF_WINDOW» 0x0080 | |
59 #define RTF_IRTT» 0x0100 | |
60 #define RTF_REJECT» 0x0200 | |
61 #define»RTF_STATIC» 0x0400 | |
62 #define»RTF_XRESOLVE» 0x0800 | |
63 #define RTF_NOFORWARD 0x1000 | |
64 #define RTF_THROW» 0x2000 | |
65 #define RTF_NOPMTUDISC 0x4000 | |
66 | 67 |
67 #define RTF_DEFAULT» 0x00010000 | 68 #define RTF_LINKRT 0x00100000 |
68 #define RTF_ALLONLINK» 0x00020000 | 69 #define RTF_NONEXTHOP 0x00200000 |
69 #define RTF_ADDRCONF» 0x00040000 | |
70 | 70 |
71 #define RTF_LINKRT» 0x00100000 | 71 #define RTF_CACHE 0x01000000 |
72 #define RTF_NONEXTHOP» 0x00200000 | 72 #define RTF_FLOW 0x02000000 |
| 73 #define RTF_POLICY 0x04000000 |
73 | 74 |
74 #define RTF_CACHE» 0x01000000 | 75 #define RTCF_VALVE 0x00200000 |
75 #define RTF_FLOW» 0x02000000 | 76 #define RTCF_MASQ 0x00400000 |
76 #define RTF_POLICY» 0x04000000 | 77 #define RTCF_NAT 0x00800000 |
| 78 #define RTCF_DOREDIRECT 0x01000000 |
| 79 #define RTCF_LOG 0x02000000 |
| 80 #define RTCF_DIRECTSRC 0x04000000 |
77 | 81 |
78 #define RTCF_VALVE» 0x00200000 | 82 #define RTF_LOCAL 0x80000000 |
79 #define RTCF_MASQ» 0x00400000 | 83 #define RTF_INTERFACE 0x40000000 |
80 #define RTCF_NAT» 0x00800000 | 84 #define RTF_MULTICAST 0x20000000 |
81 #define RTCF_DOREDIRECT 0x01000000 | 85 #define RTF_BROADCAST 0x10000000 |
82 #define RTCF_LOG» 0x02000000 | 86 #define RTF_NAT 0x08000000 |
83 #define RTCF_DIRECTSRC» 0x04000000 | |
84 | 87 |
85 #define RTF_LOCAL» 0x80000000 | 88 #define RTF_ADDRCLASSMASK 0xF8000000 |
86 #define RTF_INTERFACE» 0x40000000 | 89 #define RT_ADDRCLASS(flags) ((uint32_t)flags >> 23) |
87 #define RTF_MULTICAST» 0x20000000 | |
88 #define RTF_BROADCAST» 0x10000000 | |
89 #define RTF_NAT»» 0x08000000 | |
90 | 90 |
91 #define RTF_ADDRCLASSMASK» 0xF8000000 | 91 #define RT_TOS(tos) ((tos)&IPTOS_TOS_MASK) |
92 #define RT_ADDRCLASS(flags)» ((uint32_t) flags >> 23) | |
93 | 92 |
94 #define RT_TOS(tos)» » ((tos) & IPTOS_TOS_MASK) | 93 #define RT_LOCALADDR(flags) \ |
| 94 ((flags & RTF_ADDRCLASSMASK) == (RTF_LOCAL | RTF_INTERFACE)) |
95 | 95 |
96 #define RT_LOCALADDR(flags)» ((flags & RTF_ADDRCLASSMASK) \ | 96 #define RT_CLASS_UNSPEC 0 |
97 » » » » == (RTF_LOCAL|RTF_INTERFACE)) | 97 #define RT_CLASS_DEFAULT 253 |
98 | 98 |
99 #define RT_CLASS_UNSPEC»» 0 | 99 #define RT_CLASS_MAIN 254 |
100 #define RT_CLASS_DEFAULT» 253 | 100 #define RT_CLASS_LOCAL 255 |
| 101 #define RT_CLASS_MAX 255 |
101 | 102 |
102 #define RT_CLASS_MAIN» » 254 | 103 #define RTMSG_ACK NLMSG_ACK |
103 #define RT_CLASS_LOCAL» » 255 | 104 #define RTMSG_OVERRUN NLMSG_OVERRUN |
104 #define RT_CLASS_MAX» » 255 | |
105 | 105 |
| 106 #define RTMSG_NEWDEVICE 0x11 |
| 107 #define RTMSG_DELDEVICE 0x12 |
| 108 #define RTMSG_NEWROUTE 0x21 |
| 109 #define RTMSG_DELROUTE 0x22 |
| 110 #define RTMSG_NEWRULE 0x31 |
| 111 #define RTMSG_DELRULE 0x32 |
| 112 #define RTMSG_CONTROL 0x40 |
106 | 113 |
107 #define RTMSG_ACK» » NLMSG_ACK | 114 #define RTMSG_AR_FAILED 0x51 |
108 #define RTMSG_OVERRUN» » NLMSG_OVERRUN | |
109 | |
110 #define RTMSG_NEWDEVICE»» 0x11 | |
111 #define RTMSG_DELDEVICE»» 0x12 | |
112 #define RTMSG_NEWROUTE» » 0x21 | |
113 #define RTMSG_DELROUTE» » 0x22 | |
114 #define RTMSG_NEWRULE» » 0x31 | |
115 #define RTMSG_DELRULE» » 0x32 | |
116 #define RTMSG_CONTROL» » 0x40 | |
117 | |
118 #define RTMSG_AR_FAILED»» 0x51 | |
119 | 115 |
120 #ifdef __cplusplus | 116 #ifdef __cplusplus |
121 } | 117 } |
122 #endif | 118 #endif |
123 | 119 |
124 #endif | 120 #endif |
OLD | NEW |