00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
#ifndef _LINUX_IP_H
00018
#define _LINUX_IP_H
00019
#include <asm/byteorder.h>
00020
00021
00022
00023 #define IPTOS_TOS_MASK 0x1E
00024 #define IPTOS_TOS(tos) ((tos)&IPTOS_TOS_MASK)
00025 #define IPTOS_LOWDELAY 0x10
00026 #define IPTOS_THROUGHPUT 0x08
00027 #define IPTOS_RELIABILITY 0x04
00028 #define IPTOS_MINCOST 0x02
00029
00030 #define IPTOS_PREC_MASK 0xE0
00031 #define IPTOS_PREC(tos) ((tos)&IPTOS_PREC_MASK)
00032 #define IPTOS_PREC_NETCONTROL 0xe0
00033 #define IPTOS_PREC_INTERNETCONTROL 0xc0
00034 #define IPTOS_PREC_CRITIC_ECP 0xa0
00035 #define IPTOS_PREC_FLASHOVERRIDE 0x80
00036 #define IPTOS_PREC_FLASH 0x60
00037 #define IPTOS_PREC_IMMEDIATE 0x40
00038 #define IPTOS_PREC_PRIORITY 0x20
00039 #define IPTOS_PREC_ROUTINE 0x00
00040
00041
00042
00043 #define IPOPT_COPY 0x80
00044 #define IPOPT_CLASS_MASK 0x60
00045 #define IPOPT_NUMBER_MASK 0x1f
00046
00047 #define IPOPT_COPIED(o) ((o)&IPOPT_COPY)
00048 #define IPOPT_CLASS(o) ((o)&IPOPT_CLASS_MASK)
00049 #define IPOPT_NUMBER(o) ((o)&IPOPT_NUMBER_MASK)
00050
00051 #define IPOPT_CONTROL 0x00
00052 #define IPOPT_RESERVED1 0x20
00053 #define IPOPT_MEASUREMENT 0x40
00054 #define IPOPT_RESERVED2 0x60
00055
00056 #define IPOPT_END (0 |IPOPT_CONTROL)
00057 #define IPOPT_NOOP (1 |IPOPT_CONTROL)
00058 #define IPOPT_SEC (2 |IPOPT_CONTROL|IPOPT_COPY)
00059 #define IPOPT_LSRR (3 |IPOPT_CONTROL|IPOPT_COPY)
00060 #define IPOPT_TIMESTAMP (4 |IPOPT_MEASUREMENT)
00061 #define IPOPT_RR (7 |IPOPT_CONTROL)
00062 #define IPOPT_SID (8 |IPOPT_CONTROL|IPOPT_COPY)
00063 #define IPOPT_SSRR (9 |IPOPT_CONTROL|IPOPT_COPY)
00064 #define IPOPT_RA (20|IPOPT_CONTROL|IPOPT_COPY)
00065
00066 #define IPVERSION 4
00067 #define MAXTTL 255
00068 #define IPDEFTTL 64
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078 #define IPOPT_OPTVAL 0
00079 #define IPOPT_OLEN 1
00080 #define IPOPT_OFFSET 2
00081 #define IPOPT_MINOFF 4
00082 #define MAX_IPOPTLEN 40
00083 #define IPOPT_NOP IPOPT_NOOP
00084 #define IPOPT_EOL IPOPT_END
00085 #define IPOPT_TS IPOPT_TIMESTAMP
00086
00087 #define IPOPT_TS_TSONLY 0
00088 #define IPOPT_TS_TSANDADDR 1
00089 #define IPOPT_TS_PRESPEC 3
00090
00091
#ifdef __KERNEL__
00092
00093 struct ip_options {
00094 __u32
faddr;
00095 unsigned char optlen;
00096 unsigned char srr;
00097 unsigned char rr;
00098 unsigned char ts;
00099 unsigned char is_setbyuser:1,
00100
is_data:1,
00101
is_strictroute:1,
00102
srr_is_hit:1,
00103
is_changed:1,
00104
rr_needaddr:1,
00105
ts_needtime:1,
00106
ts_needaddr:1;
00107 unsigned char router_alert;
00108 unsigned char __pad1;
00109 unsigned char __pad2;
00110 unsigned char __data[0];
00111 };
00112
00113 #define optlength(opt) (sizeof(struct ip_options) + opt->optlen)
00114
#endif
00115
00116 struct iphdr {
00117
#if defined(__LITTLE_ENDIAN_BITFIELD)
00118
__u8 ihl:4,
00119 version:4;
00120
#elif defined (__BIG_ENDIAN_BITFIELD)
00121
__u8 version:4,
00122 ihl:4;
00123
#else
00124
#error "Please fix <asm/byteorder.h>"
00125
#endif
00126 __u8
tos;
00127 __u16
tot_len;
00128 __u16
id;
00129 __u16
frag_off;
00130 __u8
ttl;
00131 __u8
protocol;
00132 __u16
check;
00133 __u32
saddr;
00134 __u32
daddr;
00135
00136 };
00137
00138
#endif