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 KB |
5 | * Redistribution and use in source and binary forms are permitted |
6 | * provided that this notice is preserved and that due credit is given | |
7 | * to the University of California at Berkeley. The name of the University | |
8 | * may not be used to endorse or promote products derived from this | |
9 | * software without specific prior written permission. This software | |
10 | * is provided ``as is'' without express or implied warranty. | |
11 | * | |
9d866d2f | 12 | * @(#)tcp.h 7.4.1.1 (Berkeley) %G% |
8ae0e4b4 | 13 | */ |
9d866d2f MK |
14 | #ifndef BYTE_ORDER |
15 | /* | |
16 | * Definitions for byte order, | |
17 | * according to byte significance from low address to high. | |
18 | */ | |
19 | #define LITTLE_ENDIAN 1234 /* least-significant byte first (vax) */ | |
20 | #define BIG_ENDIAN 4321 /* most-significant byte first (IBM, net) */ | |
21 | #define PDP_ENDIAN 3412 /* LSB first in word, MSW first in long (pdp) */ | |
22 | ||
23 | #ifdef vax | |
24 | #define BYTE_ORDER LITTLE_ENDIAN | |
25 | #else | |
26 | #define BYTE_ORDER BIG_ENDIAN /* mc68000, tahoe, most others */ | |
27 | #endif | |
28 | #endif BYTE_ORDER | |
6e8b2eca | 29 | |
8a13b737 | 30 | typedef u_long tcp_seq; |
6e8b2eca | 31 | /* |
eb44bfb2 | 32 | * TCP header. |
2b4b57cd | 33 | * Per RFC 793, September, 1981. |
6e8b2eca | 34 | */ |
eb44bfb2 BJ |
35 | struct tcphdr { |
36 | u_short th_sport; /* source port */ | |
37 | u_short th_dport; /* destination port */ | |
8a13b737 BJ |
38 | tcp_seq th_seq; /* sequence number */ |
39 | tcp_seq th_ack; /* acknowledgement number */ | |
9d866d2f | 40 | #if BYTE_ORDER == LITTLE_ENDIAN |
498aff44 | 41 | u_char th_x2:4, /* (unused) */ |
eb44bfb2 | 42 | th_off:4; /* data offset */ |
f112c673 | 43 | #endif |
9d866d2f | 44 | #if BYTE_ORDER == BIG_ENDIAN |
f112c673 MK |
45 | u_char th_off:4, /* data offset */ |
46 | th_x2:4; /* (unused) */ | |
498aff44 | 47 | #endif |
a3d78bbd | 48 | u_char th_flags; |
2ff61f9d BJ |
49 | #define TH_FIN 0x01 |
50 | #define TH_SYN 0x02 | |
51 | #define TH_RST 0x04 | |
52 | #define TH_PUSH 0x08 | |
53 | #define TH_ACK 0x10 | |
54 | #define TH_URG 0x20 | |
eb44bfb2 BJ |
55 | u_short th_win; /* window */ |
56 | u_short th_sum; /* checksum */ | |
57 | u_short th_urp; /* urgent pointer */ | |
121f5f3a | 58 | }; |
8b5a83bb BJ |
59 | |
60 | #define TCPOPT_EOL 0 | |
61 | #define TCPOPT_NOP 1 | |
62 | #define TCPOPT_MAXSEG 2 | |
0d115dcc MK |
63 | |
64 | /* | |
f8a0cae6 MK |
65 | * Default maximum segment size for TCP. |
66 | * With an IP MSS of 576, this is 536, | |
67 | * but 512 is probably more convenient. | |
0d115dcc | 68 | */ |
f8a0cae6 MK |
69 | #ifdef lint |
70 | #define TCP_MSS 536 | |
71 | #else | |
9d866d2f MK |
72 | #ifndef IP_MSS |
73 | #define IP_MSS 576 | |
74 | #endif | |
0d115dcc | 75 | #define TCP_MSS MIN(512, IP_MSS - sizeof (struct tcpiphdr)) |
f8a0cae6 | 76 | #endif |
946f1634 MK |
77 | |
78 | /* | |
79 | * User-settable options (used with setsockopt). | |
80 | */ | |
81 | #define TCP_NODELAY 0x01 /* don't delay send to coalesce packets */ | |
82 | #define TCP_MAXSEG 0x02 /* set maximum segment size */ |