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 TCP protocol.
7 *
8 * Version: @(#)tcp.h 1.0.2 04/28/93
9 *
10 * Author: 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_TCP_H
18 #define _LINUX_TCP_H
19
20
21 #define HEADER_SIZE 128 /* maximum header size */
22
23
24 struct tcphdr {
25 __u16 source;
26 __u16 dest;
27 __u32 seq;
28 __u32 ack_seq;
29 #if defined(LITTLE_ENDIAN_BITFIELD)
30 __u16 res1:4,
31 doff:4,
32 fin:1,
33 syn:1,
34 rst:1,
35 psh:1,
36 ack:1,
37 urg:1,
38 res2:2;
39 #elif defined(BIG_ENDIAN_BITFIELD)
40 __u16 doff:4,
41 res1:4,
42 res2:2,
43 urg:1,
44 ack:1,
45 psh:1,
46 rst:1,
47 syn:1,
48 fin:1;
49 #else
50 #error "Adjust your <asm/byteorder.h> defines"
51 #endif
52 __u16 window;
53 __u16 check;
54 __u16 urg_ptr;
55 };
56
57
58 enum {
59 TCP_ESTABLISHED = 1,
60 TCP_SYN_SENT,
61 TCP_SYN_RECV,
62 TCP_FIN_WAIT1,
63 TCP_FIN_WAIT2,
64 TCP_TIME_WAIT,
65 TCP_CLOSE,
66 TCP_CLOSE_WAIT,
67 TCP_LAST_ACK,
68 TCP_LISTEN,
69 TCP_CLOSING /* now a valid state */
70 };
71
72 #endif /* _LINUX_TCP_H */