Warning: This file is not a C or C++ file. It does not have highlighting.
1 | /* Copyright (C) 1997-2024 Free Software Foundation, Inc.. |
---|---|
2 | This file is part of the GNU C Library. |
3 | |
4 | The GNU C 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; either |
7 | version 2.1 of the License, or (at your option) any later version. |
8 | |
9 | The GNU C Library is distributed in the hope that it will be useful, |
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
12 | Lesser General Public License for more details. |
13 | |
14 | You should have received a copy of the GNU Lesser General Public |
15 | License along with the GNU C Library; if not, see |
16 | <https://www.gnu.org/licenses/>. */ |
17 | |
18 | /* Based on the 4.4BSD and Linux version of this file. */ |
19 | |
20 | #ifndef _NET_ROUTE_H |
21 | |
22 | #define _NET_ROUTE_H 1 |
23 | #include <features.h> |
24 | |
25 | #include <sys/socket.h> |
26 | #include <sys/types.h> |
27 | #include <netinet/in.h> |
28 | #include <net/if.h> |
29 | |
30 | |
31 | typedef struct ifrtreq |
32 | { |
33 | char ifname[IF_NAMESIZE]; |
34 | in_addr_t rt_dest; |
35 | in_addr_t rt_mask; |
36 | in_addr_t rt_gateway; |
37 | int rt_flags; |
38 | int rt_metric; |
39 | int rt_mtu; |
40 | int rt_window; |
41 | int rt_irtt; |
42 | int rt_tos; |
43 | int rt_class; |
44 | } ifrtreq_t; |
45 | #define _IOT_ifrtreq _IOT (_IOTS(char), IF_NAMESIZE, _IOTS(int), 10, 0, 0) |
46 | |
47 | |
48 | #define RTF_UP 0x0001 /* Route usable. */ |
49 | #define RTF_GATEWAY 0x0002 /* Destination is a gateway. */ |
50 | |
51 | #define RTF_HOST 0x0004 /* Host entry (net otherwise). */ |
52 | #define RTF_REINSTATE 0x0008 /* Reinstate route after timeout. */ |
53 | #define RTF_DYNAMIC 0x0010 /* Created dyn. (by redirect). */ |
54 | #define RTF_MODIFIED 0x0020 /* Modified dyn. (by redirect). */ |
55 | #define RTF_MTU 0x0040 /* Specific MTU for this route. */ |
56 | #define RTF_MSS RTF_MTU /* Compatibility. */ |
57 | #define RTF_WINDOW 0x0080 /* Per route window clamping. */ |
58 | #define RTF_IRTT 0x0100 /* Initial round trip time. */ |
59 | #define RTF_REJECT 0x0200 /* Reject route. */ |
60 | #define RTF_STATIC 0x0400 /* Manually injected route. */ |
61 | #define RTF_XRESOLVE 0x0800 /* External resolver. */ |
62 | #define RTF_NOFORWARD 0x1000 /* Forwarding inhibited. */ |
63 | #define RTF_THROW 0x2000 /* Go to next class. */ |
64 | #define RTF_NOPMTUDISC 0x4000 /* Do not send packets with DF. */ |
65 | |
66 | /* for IPv6 */ |
67 | #define RTF_DEFAULT 0x00010000 /* default - learned via ND */ |
68 | #define RTF_ALLONLINK 0x00020000 /* fallback, no routers on link */ |
69 | #define RTF_ADDRCONF 0x00040000 /* addrconf route - RA */ |
70 | |
71 | #define RTF_LINKRT 0x00100000 /* link specific - device match */ |
72 | #define RTF_NONEXTHOP 0x00200000 /* route with no nexthop */ |
73 | |
74 | #define RTF_CACHE 0x01000000 /* cache entry */ |
75 | #define RTF_FLOW 0x02000000 /* flow significant route */ |
76 | #define RTF_POLICY 0x04000000 /* policy route */ |
77 | |
78 | #define RTCF_VALVE 0x00200000 |
79 | #define RTCF_MASQ 0x00400000 |
80 | #define RTCF_NAT 0x00800000 |
81 | #define RTCF_DOREDIRECT 0x01000000 |
82 | #define RTCF_LOG 0x02000000 |
83 | #define RTCF_DIRECTSRC 0x04000000 |
84 | |
85 | #define RTF_LOCAL 0x80000000 |
86 | #define RTF_INTERFACE 0x40000000 |
87 | #define RTF_MULTICAST 0x20000000 |
88 | #define RTF_BROADCAST 0x10000000 |
89 | #define RTF_NAT 0x08000000 |
90 | |
91 | #define RTF_ADDRCLASSMASK 0xF8000000 |
92 | #define RT_ADDRCLASS(flags) ((uint32_t) flags >> 23) |
93 | |
94 | #define RT_TOS(tos) ((tos) & IPTOS_TOS_MASK) |
95 | |
96 | #define RT_LOCALADDR(flags) ((flags & RTF_ADDRCLASSMASK) \ |
97 | == (RTF_LOCAL|RTF_INTERFACE)) |
98 | |
99 | #define RT_CLASS_UNSPEC 0 |
100 | #define RT_CLASS_DEFAULT 253 |
101 | |
102 | #define RT_CLASS_MAIN 254 |
103 | #define RT_CLASS_LOCAL 255 |
104 | #define RT_CLASS_MAX 255 |
105 | |
106 | |
107 | #define RTMSG_ACK NLMSG_ACK |
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 /* Address Resolution failed. */ |
119 | |
120 | #endif /* net/route.h */ |
121 |
Warning: This file is not a C or C++ file. It does not have highlighting.