]>
Commit | Line | Data |
---|---|---|
fd26970f UD |
1 | /* Copyright (C) 1997 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 Library General Public License as | |
6 | published by the Free Software Foundation; either version 2 of the | |
7 | 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 | Library General Public License for more details. | |
13 | ||
14 | You should have received a copy of the GNU Library General Public | |
15 | License along with the GNU C Library; see the file COPYING.LIB. If not, | |
16 | write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
17 | Boston, MA 02111-1307, USA. */ | |
18 | ||
19 | /* Based on the 4.4BSD and Linux version of this file. */ | |
20 | ||
21 | #ifndef _NET_ROUTE_H | |
22 | ||
23 | #define _NET_ROUTE_H 1 | |
24 | #include <features.h> | |
25 | ||
26 | #include <sys/socket.h> | |
27 | #include <sys/types.h> | |
28 | ||
29 | ||
30 | /* This structure gets passed by the SIOCADDRT and SIOCDELRT calls. */ | |
31 | struct rtentry | |
32 | { | |
33 | unsigned long int rt_pad1; | |
34 | struct sockaddr rt_dst; /* Target address. */ | |
35 | struct sockaddr rt_gateway; /* Gateway addr (RTF_GATEWAY). */ | |
36 | struct sockaddr rt_genmask; /* Target network mask (IP). */ | |
37 | unsigned short int rt_flags; | |
38 | short int rt_pad2; | |
39 | unsigned long int rt_pad3; | |
40 | unsigned char rt_tos; | |
41 | unsigned char rt_class; | |
42 | short int rt_pad4; | |
43 | short int rt_metric; /* +1 for binary compatibility! */ | |
44 | char *rt_dev; /* Forcing the device at add. */ | |
45 | unsigned long int rt_mtu; /* Per route MTU/Window. */ | |
46 | unsigned long int rt_window; /* Window clamping. */ | |
47 | unsigned short int rt_irtt; /* Initial RTT. */ | |
48 | }; | |
49 | /* Compatibility hack. */ | |
50 | #define rt_mss rt_mtu | |
51 | ||
52 | ||
53 | #define RTF_UP 0x0001 /* Route usable. */ | |
54 | #define RTF_GATEWAY 0x0002 /* Destination is a gateway. */ | |
55 | ||
56 | #define RTF_HOST 0x0004 /* Host entry (net otherwise). */ | |
57 | #define RTF_REINSTATE 0x0008 /* Reinstate route after timeout. */ | |
58 | #define RTF_DYNAMIC 0x0010 /* Created dyn. (by redirect). */ | |
59 | #define RTF_MODIFIED 0x0020 /* Modified dyn. (by redirect). */ | |
60 | #define RTF_MTU 0x0040 /* Specific MTU for this route. */ | |
61 | #define RTF_MSS RTF_MTU /* Compatibility. */ | |
62 | #define RTF_WINDOW 0x0080 /* Per route window clamping. */ | |
63 | #define RTF_IRTT 0x0100 /* Initial round trip time. */ | |
64 | #define RTF_REJECT 0x0200 /* Reject route. */ | |
65 | #define RTF_STATIC 0x0400 /* Manually injected route. */ | |
66 | #define RTF_XRESOLVE 0x0800 /* External resolver. */ | |
67 | #define RTF_NOFORWARD 0x1000 /* Forwarding inhibited. */ | |
68 | #define RTF_THROW 0x2000 /* Go to next class. */ | |
69 | #define RTF_NOPMTUDISC 0x4000 /* Do not send packets with DF. */ | |
70 | ||
71 | /* Bad idea. IPv6 should not use broken IPv4 interface. */ | |
72 | ||
73 | #define RTF_ADDRCONF 0x0800 /* Announced on link prefix. */ | |
74 | #define RTF_INVALID 0x1000 | |
75 | #define RTF_DCACHE 0x2000 | |
76 | #define RTF_DEFAULT 0x4000 /* Route is a default route. */ | |
77 | #define RTF_NEXTHOP 0x8000 /* Non gateway route with nexthop. */ | |
78 | ||
79 | ||
80 | #define RTF_MAGIC 0x10000 /* Route added/deleted authomatically, | |
81 | when interface changes its state. */ | |
82 | ||
83 | #define RTCF_VALVE 0x00200000 | |
84 | #define RTCF_MASQ 0x00400000 | |
85 | #define RTCF_NAT 0x00800000 | |
86 | #define RTCF_DOREDIRECT 0x01000000 | |
87 | #define RTCF_LOG 0x02000000 | |
88 | #define RTCF_DIRECTSRC 0x04000000 | |
89 | ||
90 | #define RTF_LOCAL 0x80000000 | |
91 | #define RTF_INTERFACE 0x40000000 | |
92 | #define RTF_MULTICAST 0x20000000 | |
93 | #define RTF_BROADCAST 0x10000000 | |
94 | #define RTF_NAT 0x08000000 | |
95 | ||
96 | #define RTF_ADDRCLASSMASK 0xF8000000 | |
97 | #define RT_ADDRCLASS(flags) ((__u_int32_t) flags >> 23) | |
98 | ||
99 | #define RT_TOS(tos) ((tos) & IPTOS_TOS_MASK) | |
100 | ||
101 | #define RT_LOCALADDR(flags) ((flags & RTF_ADDRCLASSMASK) \ | |
102 | == (RTF_LOCAL|RTF_INTERFACE)) | |
103 | ||
104 | #define RT_CLASS_UNSPEC 0 | |
105 | #define RT_CLASS_DEFAULT 253 | |
106 | ||
107 | #define RT_CLASS_MAIN 254 | |
108 | #define RT_CLASS_LOCAL 255 | |
109 | #define RT_CLASS_MAX 255 | |
110 | ||
111 | ||
112 | #define RTMSG_ACK NLMSG_ACK | |
113 | #define RTMSG_OVERRUN NLMSG_OVERRUN | |
114 | ||
115 | #define RTMSG_NEWDEVICE 0x11 | |
116 | #define RTMSG_DELDEVICE 0x12 | |
117 | #define RTMSG_NEWROUTE 0x21 | |
118 | #define RTMSG_DELROUTE 0x22 | |
119 | #define RTMSG_NEWRULE 0x31 | |
120 | #define RTMSG_DELRULE 0x32 | |
121 | #define RTMSG_CONTROL 0x40 | |
122 | ||
123 | #define RTMSG_AR_FAILED 0x51 /* Address Resolution failed. */ | |
124 | ||
125 | #endif /* net/route.h */ |