Commit | Line | Data |
---|---|---|
8ae0e4b4 | 1 | /* |
0880b18e | 2 | * Copyright (c) 1982, 1986 Regents of the University of California. |
2b6b6284 | 3 | * All rights reserved. |
8ae0e4b4 | 4 | * |
2b6b6284 | 5 | * Redistribution and use in source and binary forms are permitted |
616d42db KB |
6 | * provided that the above copyright notice and this paragraph are |
7 | * duplicated in all such forms and that any documentation, | |
8 | * advertising materials, and other materials related to such | |
9 | * distribution and use acknowledge that the software was developed | |
10 | * by the University of California, Berkeley. The name of the | |
11 | * University may not be used to endorse or promote products derived | |
12 | * from this software without specific prior written permission. | |
13 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR | |
14 | * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED | |
15 | * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. | |
2b6b6284 | 16 | * |
d254820e | 17 | * @(#)tcp.h 7.4.1.2 (Berkeley) %G% |
8ae0e4b4 | 18 | */ |
9d866d2f MK |
19 | #ifndef BYTE_ORDER |
20 | /* | |
21 | * Definitions for byte order, | |
22 | * according to byte significance from low address to high. | |
23 | */ | |
24 | #define LITTLE_ENDIAN 1234 /* least-significant byte first (vax) */ | |
25 | #define BIG_ENDIAN 4321 /* most-significant byte first (IBM, net) */ | |
26 | #define PDP_ENDIAN 3412 /* LSB first in word, MSW first in long (pdp) */ | |
27 | ||
28 | #ifdef vax | |
29 | #define BYTE_ORDER LITTLE_ENDIAN | |
30 | #else | |
31 | #define BYTE_ORDER BIG_ENDIAN /* mc68000, tahoe, most others */ | |
32 | #endif | |
33 | #endif BYTE_ORDER | |
6e8b2eca | 34 | |
8a13b737 | 35 | typedef u_long tcp_seq; |
6e8b2eca | 36 | /* |
eb44bfb2 | 37 | * TCP header. |
2b4b57cd | 38 | * Per RFC 793, September, 1981. |
6e8b2eca | 39 | */ |
eb44bfb2 BJ |
40 | struct tcphdr { |
41 | u_short th_sport; /* source port */ | |
42 | u_short th_dport; /* destination port */ | |
8a13b737 BJ |
43 | tcp_seq th_seq; /* sequence number */ |
44 | tcp_seq th_ack; /* acknowledgement number */ | |
9d866d2f | 45 | #if BYTE_ORDER == LITTLE_ENDIAN |
498aff44 | 46 | u_char th_x2:4, /* (unused) */ |
eb44bfb2 | 47 | th_off:4; /* data offset */ |
f112c673 | 48 | #endif |
9d866d2f | 49 | #if BYTE_ORDER == BIG_ENDIAN |
f112c673 MK |
50 | u_char th_off:4, /* data offset */ |
51 | th_x2:4; /* (unused) */ | |
498aff44 | 52 | #endif |
a3d78bbd | 53 | u_char th_flags; |
2ff61f9d BJ |
54 | #define TH_FIN 0x01 |
55 | #define TH_SYN 0x02 | |
56 | #define TH_RST 0x04 | |
57 | #define TH_PUSH 0x08 | |
58 | #define TH_ACK 0x10 | |
59 | #define TH_URG 0x20 | |
eb44bfb2 BJ |
60 | u_short th_win; /* window */ |
61 | u_short th_sum; /* checksum */ | |
62 | u_short th_urp; /* urgent pointer */ | |
121f5f3a | 63 | }; |
8b5a83bb BJ |
64 | |
65 | #define TCPOPT_EOL 0 | |
66 | #define TCPOPT_NOP 1 | |
67 | #define TCPOPT_MAXSEG 2 | |
0d115dcc MK |
68 | |
69 | /* | |
f8a0cae6 MK |
70 | * Default maximum segment size for TCP. |
71 | * With an IP MSS of 576, this is 536, | |
72 | * but 512 is probably more convenient. | |
0d115dcc | 73 | */ |
f8a0cae6 MK |
74 | #ifdef lint |
75 | #define TCP_MSS 536 | |
76 | #else | |
9d866d2f MK |
77 | #ifndef IP_MSS |
78 | #define IP_MSS 576 | |
79 | #endif | |
0d115dcc | 80 | #define TCP_MSS MIN(512, IP_MSS - sizeof (struct tcpiphdr)) |
f8a0cae6 | 81 | #endif |
946f1634 MK |
82 | |
83 | /* | |
84 | * User-settable options (used with setsockopt). | |
85 | */ | |
86 | #define TCP_NODELAY 0x01 /* don't delay send to coalesce packets */ | |
87 | #define TCP_MAXSEG 0x02 /* set maximum segment size */ |