Merge master.kernel.org:/pub/scm/linux/kernel/git/davem/sparc-2.6
[linux-2.6/mini2440.git] / include / linux / ip.h
blob4b55cf1df732e2f8752a8f517c6a06063ace18ff
1 /*
2 * INET An implementation of the TCP/IP protocol suite for the LINUX
3 * operating system. INET is implemented using the BSD Socket
4 * interface as the means of communication with the user level.
6 * Definitions for the IP protocol.
8 * Version: @(#)ip.h 1.0.2 04/28/93
10 * Authors: Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version
15 * 2 of the License, or (at your option) any later version.
17 #ifndef _LINUX_IP_H
18 #define _LINUX_IP_H
19 #include <linux/types.h>
20 #include <asm/byteorder.h>
22 #define IPTOS_TOS_MASK 0x1E
23 #define IPTOS_TOS(tos) ((tos)&IPTOS_TOS_MASK)
24 #define IPTOS_LOWDELAY 0x10
25 #define IPTOS_THROUGHPUT 0x08
26 #define IPTOS_RELIABILITY 0x04
27 #define IPTOS_MINCOST 0x02
29 #define IPTOS_PREC_MASK 0xE0
30 #define IPTOS_PREC(tos) ((tos)&IPTOS_PREC_MASK)
31 #define IPTOS_PREC_NETCONTROL 0xe0
32 #define IPTOS_PREC_INTERNETCONTROL 0xc0
33 #define IPTOS_PREC_CRITIC_ECP 0xa0
34 #define IPTOS_PREC_FLASHOVERRIDE 0x80
35 #define IPTOS_PREC_FLASH 0x60
36 #define IPTOS_PREC_IMMEDIATE 0x40
37 #define IPTOS_PREC_PRIORITY 0x20
38 #define IPTOS_PREC_ROUTINE 0x00
41 /* IP options */
42 #define IPOPT_COPY 0x80
43 #define IPOPT_CLASS_MASK 0x60
44 #define IPOPT_NUMBER_MASK 0x1f
46 #define IPOPT_COPIED(o) ((o)&IPOPT_COPY)
47 #define IPOPT_CLASS(o) ((o)&IPOPT_CLASS_MASK)
48 #define IPOPT_NUMBER(o) ((o)&IPOPT_NUMBER_MASK)
50 #define IPOPT_CONTROL 0x00
51 #define IPOPT_RESERVED1 0x20
52 #define IPOPT_MEASUREMENT 0x40
53 #define IPOPT_RESERVED2 0x60
55 #define IPOPT_END (0 |IPOPT_CONTROL)
56 #define IPOPT_NOOP (1 |IPOPT_CONTROL)
57 #define IPOPT_SEC (2 |IPOPT_CONTROL|IPOPT_COPY)
58 #define IPOPT_LSRR (3 |IPOPT_CONTROL|IPOPT_COPY)
59 #define IPOPT_TIMESTAMP (4 |IPOPT_MEASUREMENT)
60 #define IPOPT_RR (7 |IPOPT_CONTROL)
61 #define IPOPT_SID (8 |IPOPT_CONTROL|IPOPT_COPY)
62 #define IPOPT_SSRR (9 |IPOPT_CONTROL|IPOPT_COPY)
63 #define IPOPT_RA (20|IPOPT_CONTROL|IPOPT_COPY)
65 #define IPVERSION 4
66 #define MAXTTL 255
67 #define IPDEFTTL 64
69 #define IPOPT_OPTVAL 0
70 #define IPOPT_OLEN 1
71 #define IPOPT_OFFSET 2
72 #define IPOPT_MINOFF 4
73 #define MAX_IPOPTLEN 40
74 #define IPOPT_NOP IPOPT_NOOP
75 #define IPOPT_EOL IPOPT_END
76 #define IPOPT_TS IPOPT_TIMESTAMP
78 #define IPOPT_TS_TSONLY 0 /* timestamps only */
79 #define IPOPT_TS_TSANDADDR 1 /* timestamps and addresses */
80 #define IPOPT_TS_PRESPEC 3 /* specified modules only */
82 struct iphdr {
83 #if defined(__LITTLE_ENDIAN_BITFIELD)
84 __u8 ihl:4,
85 version:4;
86 #elif defined (__BIG_ENDIAN_BITFIELD)
87 __u8 version:4,
88 ihl:4;
89 #else
90 #error "Please fix <asm/byteorder.h>"
91 #endif
92 __u8 tos;
93 __be16 tot_len;
94 __be16 id;
95 __be16 frag_off;
96 __u8 ttl;
97 __u8 protocol;
98 __u16 check;
99 __be32 saddr;
100 __be32 daddr;
101 /*The options start here. */
104 struct ip_auth_hdr {
105 __u8 nexthdr;
106 __u8 hdrlen; /* This one is measured in 32 bit units! */
107 __u16 reserved;
108 __u32 spi;
109 __u32 seq_no; /* Sequence number */
110 __u8 auth_data[0]; /* Variable len but >=4. Mind the 64 bit alignment! */
113 struct ip_esp_hdr {
114 __u32 spi;
115 __u32 seq_no; /* Sequence number */
116 __u8 enc_data[0]; /* Variable len but >=8. Mind the 64 bit alignment! */
119 struct ip_comp_hdr {
120 __u8 nexthdr;
121 __u8 flags;
122 __u16 cpi;
125 #endif /* _LINUX_IP_H */