| 1 | /* |
|---|
| 2 | * Copyright (c) 1982, 1986 Regents of the University of California. |
|---|
| 3 | * All rights reserved. |
|---|
| 4 | * |
|---|
| 5 | * Redistribution and use in source and binary forms are permitted |
|---|
| 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. |
|---|
| 16 | * |
|---|
| 17 | * @(#)tcp.h 7.5 (Berkeley) 6/29/88 |
|---|
| 18 | */ |
|---|
| 19 | |
|---|
| 20 | #ifndef _NETINET_IP_TCP_H |
|---|
| 21 | #define _NETINET_IP_TCP_H |
|---|
| 22 | |
|---|
| 23 | #include <endian.h> |
|---|
| 24 | #include <linux/socket.h> |
|---|
| 25 | #include <sys/types.h> |
|---|
| 26 | |
|---|
| 27 | typedef u_int32_t tcp_seq; |
|---|
| 28 | /* |
|---|
| 29 | * TCP header. |
|---|
| 30 | * Per RFC 793, September, 1981. |
|---|
| 31 | */ |
|---|
| 32 | struct tcphdr { |
|---|
| 33 | u_short th_sport; /* source port */ |
|---|
| 34 | u_short th_dport; /* destination port */ |
|---|
| 35 | tcp_seq th_seq; /* sequence number */ |
|---|
| 36 | tcp_seq th_ack; /* acknowledgement number */ |
|---|
| 37 | #if __BYTE_ORDER == __LITTLE_ENDIAN |
|---|
| 38 | u_char th_x2:4, /* (unused) */ |
|---|
| 39 | th_off:4; /* data offset */ |
|---|
| 40 | #endif |
|---|
| 41 | #if __BYTE_ORDER == __BIG_ENDIAN |
|---|
| 42 | u_char th_off:4, /* data offset */ |
|---|
| 43 | th_x2:4; /* (unused) */ |
|---|
| 44 | #endif |
|---|
| 45 | u_char th_flags; |
|---|
| 46 | #define TH_FIN 0x01 |
|---|
| 47 | #define TH_SYN 0x02 |
|---|
| 48 | #define TH_RST 0x04 |
|---|
| 49 | #define TH_PUSH 0x08 |
|---|
| 50 | #define TH_ACK 0x10 |
|---|
| 51 | #define TH_URG 0x20 |
|---|
| 52 | u_short th_win; /* window */ |
|---|
| 53 | u_short th_sum; /* checksum */ |
|---|
| 54 | u_short th_urp; /* urgent pointer */ |
|---|
| 55 | }; |
|---|
| 56 | |
|---|
| 57 | #define TCPOPT_EOL 0 |
|---|
| 58 | #define TCPOPT_NOP 1 |
|---|
| 59 | #define TCPOPT_MAXSEG 2 |
|---|
| 60 | |
|---|
| 61 | /* |
|---|
| 62 | * Default maximum segment size for TCP. |
|---|
| 63 | * With an IP MSS of 576, this is 536, |
|---|
| 64 | * but 512 is probably more convenient. |
|---|
| 65 | */ |
|---|
| 66 | #ifdef lint |
|---|
| 67 | #define TCP_MSS 536 |
|---|
| 68 | #else |
|---|
| 69 | #define TCP_MSS MIN(512, IP_MSS - sizeof (struct tcpiphdr)) |
|---|
| 70 | #endif |
|---|
| 71 | |
|---|
| 72 | #endif /* _NETINET_TCP_H */ |
|---|