The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 1 | /**************************************************************************** |
| 2 | **************************************************************************** |
| 3 | *** |
| 4 | *** This header was automatically generated from a Linux kernel header |
| 5 | *** of the same name, to make information necessary for userspace to |
| 6 | *** call into the kernel available to libc. It contains only constants, |
| 7 | *** structures, and macros generated from the original header, and thus, |
| 8 | *** contains no copyrightable information. |
| 9 | *** |
| 10 | **************************************************************************** |
| 11 | ****************************************************************************/ |
| 12 | #ifndef _LINUX_IP_H |
| 13 | #define _LINUX_IP_H |
| 14 | #include <linux/types.h> |
| 15 | #include <asm/byteorder.h> |
Ben Cheng | 4b29af0 | 2012-03-07 16:14:53 -0800 | [diff] [blame] | 16 | |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 17 | #define IPTOS_TOS_MASK 0x1E |
| 18 | #define IPTOS_TOS(tos) ((tos)&IPTOS_TOS_MASK) |
| 19 | #define IPTOS_LOWDELAY 0x10 |
| 20 | #define IPTOS_THROUGHPUT 0x08 |
| 21 | #define IPTOS_RELIABILITY 0x04 |
| 22 | #define IPTOS_MINCOST 0x02 |
Ben Cheng | 4b29af0 | 2012-03-07 16:14:53 -0800 | [diff] [blame] | 23 | |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 24 | #define IPTOS_PREC_MASK 0xE0 |
| 25 | #define IPTOS_PREC(tos) ((tos)&IPTOS_PREC_MASK) |
| 26 | #define IPTOS_PREC_NETCONTROL 0xe0 |
| 27 | #define IPTOS_PREC_INTERNETCONTROL 0xc0 |
| 28 | #define IPTOS_PREC_CRITIC_ECP 0xa0 |
| 29 | #define IPTOS_PREC_FLASHOVERRIDE 0x80 |
| 30 | #define IPTOS_PREC_FLASH 0x60 |
| 31 | #define IPTOS_PREC_IMMEDIATE 0x40 |
| 32 | #define IPTOS_PREC_PRIORITY 0x20 |
| 33 | #define IPTOS_PREC_ROUTINE 0x00 |
Ben Cheng | 4b29af0 | 2012-03-07 16:14:53 -0800 | [diff] [blame] | 34 | |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 35 | #define IPOPT_COPY 0x80 |
| 36 | #define IPOPT_CLASS_MASK 0x60 |
| 37 | #define IPOPT_NUMBER_MASK 0x1f |
Ben Cheng | 4b29af0 | 2012-03-07 16:14:53 -0800 | [diff] [blame] | 38 | |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 39 | #define IPOPT_COPIED(o) ((o)&IPOPT_COPY) |
| 40 | #define IPOPT_CLASS(o) ((o)&IPOPT_CLASS_MASK) |
| 41 | #define IPOPT_NUMBER(o) ((o)&IPOPT_NUMBER_MASK) |
Ben Cheng | 4b29af0 | 2012-03-07 16:14:53 -0800 | [diff] [blame] | 42 | |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 43 | #define IPOPT_CONTROL 0x00 |
| 44 | #define IPOPT_RESERVED1 0x20 |
| 45 | #define IPOPT_MEASUREMENT 0x40 |
| 46 | #define IPOPT_RESERVED2 0x60 |
Ben Cheng | 4b29af0 | 2012-03-07 16:14:53 -0800 | [diff] [blame] | 47 | |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 48 | #define IPOPT_END (0 |IPOPT_CONTROL) |
| 49 | #define IPOPT_NOOP (1 |IPOPT_CONTROL) |
| 50 | #define IPOPT_SEC (2 |IPOPT_CONTROL|IPOPT_COPY) |
| 51 | #define IPOPT_LSRR (3 |IPOPT_CONTROL|IPOPT_COPY) |
| 52 | #define IPOPT_TIMESTAMP (4 |IPOPT_MEASUREMENT) |
| 53 | #define IPOPT_RR (7 |IPOPT_CONTROL) |
| 54 | #define IPOPT_SID (8 |IPOPT_CONTROL|IPOPT_COPY) |
| 55 | #define IPOPT_SSRR (9 |IPOPT_CONTROL|IPOPT_COPY) |
| 56 | #define IPOPT_RA (20|IPOPT_CONTROL|IPOPT_COPY) |
Ben Cheng | 4b29af0 | 2012-03-07 16:14:53 -0800 | [diff] [blame] | 57 | |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 58 | #define IPVERSION 4 |
| 59 | #define MAXTTL 255 |
| 60 | #define IPDEFTTL 64 |
Ben Cheng | 4b29af0 | 2012-03-07 16:14:53 -0800 | [diff] [blame] | 61 | |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 62 | #define IPOPT_OPTVAL 0 |
| 63 | #define IPOPT_OLEN 1 |
| 64 | #define IPOPT_OFFSET 2 |
| 65 | #define IPOPT_MINOFF 4 |
| 66 | #define MAX_IPOPTLEN 40 |
| 67 | #define IPOPT_NOP IPOPT_NOOP |
| 68 | #define IPOPT_EOL IPOPT_END |
| 69 | #define IPOPT_TS IPOPT_TIMESTAMP |
Ben Cheng | 4b29af0 | 2012-03-07 16:14:53 -0800 | [diff] [blame] | 70 | |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 71 | #define IPOPT_TS_TSONLY 0 |
| 72 | #define IPOPT_TS_TSANDADDR 1 |
| 73 | #define IPOPT_TS_PRESPEC 3 |
Ben Cheng | 4b29af0 | 2012-03-07 16:14:53 -0800 | [diff] [blame] | 74 | |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 75 | struct iphdr { |
| 76 | #ifdef __LITTLE_ENDIAN_BITFIELD |
| 77 | __u8 ihl:4, |
| 78 | version:4; |
| 79 | #elif defined (__BIG_ENDIAN_BITFIELD) |
| 80 | __u8 version:4, |
| 81 | ihl:4; |
| 82 | #else |
| 83 | #error "Please fix <asm/byteorder.h>" |
| 84 | #endif |
| 85 | __u8 tos; |
| 86 | __be16 tot_len; |
| 87 | __be16 id; |
| 88 | __be16 frag_off; |
| 89 | __u8 ttl; |
| 90 | __u8 protocol; |
| 91 | __u16 check; |
| 92 | __be32 saddr; |
| 93 | __be32 daddr; |
Ben Cheng | 4b29af0 | 2012-03-07 16:14:53 -0800 | [diff] [blame] | 94 | |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 95 | }; |
Ben Cheng | 4b29af0 | 2012-03-07 16:14:53 -0800 | [diff] [blame] | 96 | |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 97 | struct ip_auth_hdr { |
| 98 | __u8 nexthdr; |
| 99 | __u8 hdrlen; |
| 100 | __u16 reserved; |
| 101 | __u32 spi; |
| 102 | __u32 seq_no; |
| 103 | __u8 auth_data[0]; |
| 104 | }; |
Ben Cheng | 4b29af0 | 2012-03-07 16:14:53 -0800 | [diff] [blame] | 105 | |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 106 | struct ip_esp_hdr { |
| 107 | __u32 spi; |
| 108 | __u32 seq_no; |
| 109 | __u8 enc_data[0]; |
| 110 | }; |
Ben Cheng | 4b29af0 | 2012-03-07 16:14:53 -0800 | [diff] [blame] | 111 | |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 112 | struct ip_comp_hdr { |
| 113 | __u8 nexthdr; |
| 114 | __u8 flags; |
| 115 | __u16 cpi; |
| 116 | }; |
Ben Cheng | 4b29af0 | 2012-03-07 16:14:53 -0800 | [diff] [blame] | 117 | |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 118 | #endif |