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.
5 *
6 * Definitions for the IP protocol.
7 *
8 * Version: @(#)ip.h 1.0.2 04/28/93
9 *
10 * Authors: Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
11 *
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.
16 */
17 #ifndef _LINUX_IP_H
18 #define _LINUX_IP_H
19 #include <asm/byteorder.h>
20
21 #define IPOPT_END 0
22 #define IPOPT_NOOP 1
23 #define IPOPT_SEC 130
24 #define IPOPT_LSRR 131
25 #define IPOPT_SSRR 137
26 #define IPOPT_RR 7
27 #define IPOPT_SID 136
28 #define IPOPT_TIMESTAMP 68
29
30
31 #define MAXTTL 255
32
33 struct timestamp {
34 __u8 len;
35 __u8 ptr;
36 #if defined(__LITTLE_ENDIAN_BITFIELD)
37 __u8 flags:4,
38 overflow:4;
39 #elif defined(__BIG_ENDIAN_BITFIELD)
40 __u8 overflow:4,
41 flags:4;
42 #else
43 #error "Please fix <asm/byteorder.h>"
44 #endif
45 __u32 data[9];
46 };
47
48
49 #define MAX_ROUTE 16
50
51 struct route {
52 char route_size;
53 char pointer;
54 unsigned long route[MAX_ROUTE];
55 };
56
57 #define IPOPT_OPTVAL 0
58 #define IPOPT_OLEN 1
59 #define IPOPT_OFFSET 2
60 #define IPOPT_MINOFF 4
61 #define MAX_IPOPTLEN 40
62 #define IPOPT_NOP IPOPT_NOOP
63 #define IPOPT_EOL IPOPT_END
64 #define IPOPT_TS IPOPT_TIMESTAMP
65
66 #define IPOPT_TS_TSONLY 0 /* timestamps only */
67 #define IPOPT_TS_TSANDADDR 1 /* timestamps and addresses */
68 #define IPOPT_TS_PRESPEC 2 /* specified modules only */
69
70 struct options {
71 __u32 faddr; /* Saved first hop address */
72 unsigned char optlen;
73 unsigned char srr;
74 unsigned char rr;
75 unsigned char ts;
76 unsigned char is_setbyuser:1, /* Set by setsockopt? */
77 is_data:1, /* Options in __data, rather than skb */
78 is_strictroute:1, /* Strict source route */
79 srr_is_hit:1, /* Packet destination addr was our one */
80 is_changed:1, /* IP checksum more not valid */
81 rr_needaddr:1, /* Need to record addr of outgoing dev */
82 ts_needtime:1, /* Need to record timestamp */
83 ts_needaddr:1; /* Need to record addr of outgoing dev */
84 unsigned char __pad1;
85 unsigned char __pad2;
86 unsigned char __pad3;
87 unsigned char __data[0];
88 };
89
90 struct iphdr {
91 #if defined(__LITTLE_ENDIAN_BITFIELD)
92 __u8 ihl:4,
93 version:4;
94 #elif defined (__BIG_ENDIAN_BITFIELD)
95 __u8 version:4,
96 ihl:4;
97 #else
98 #error "Please fix <asm/byteorder.h>"
99 #endif
100 __u8 tos;
101 __u16 tot_len;
102 __u16 id;
103 __u16 frag_off;
104 __u8 ttl;
105 __u8 protocol;
106 __u16 check;
107 __u32 saddr;
108 __u32 daddr;
109 /*The options start here. */
110 };
111
112
113 #endif /* _LINUX_IP_H */