1 /* 2 * Copyright (c) 1982, 1986 Regents of the University of California. 3 * All rights reserved. The Berkeley software License Agreement 4 * specifies the terms and conditions for redistribution. 5 * 6 * @(#)tcp.h 7.2 (Berkeley) 10/28/86 7 */ 8 9 typedef u_long tcp_seq; 10 /* 11 * TCP header. 12 * Per RFC 793, September, 1981. 13 */ 14 struct tcphdr { 15 u_short th_sport; /* source port */ 16 u_short th_dport; /* destination port */ 17 tcp_seq th_seq; /* sequence number */ 18 tcp_seq th_ack; /* acknowledgement number */ 19 #if ENDIAN == LITTLE 20 u_char th_x2:4, /* (unused) */ 21 th_off:4; /* data offset */ 22 #endif 23 #if ENDIAN == BIG 24 u_char th_off:4, /* data offset */ 25 th_x2:4; /* (unused) */ 26 #endif 27 u_char th_flags; 28 #define TH_FIN 0x01 29 #define TH_SYN 0x02 30 #define TH_RST 0x04 31 #define TH_PUSH 0x08 32 #define TH_ACK 0x10 33 #define TH_URG 0x20 34 u_short th_win; /* window */ 35 u_short th_sum; /* checksum */ 36 u_short th_urp; /* urgent pointer */ 37 }; 38 39 #define TCPOPT_EOL 0 40 #define TCPOPT_NOP 1 41 #define TCPOPT_MAXSEG 2 42 43 /* 44 * Default maximum segment size for TCP. 45 * With an IP MSS of 576, this is 536, 46 * but 512 is probably more convenient. 47 */ 48 #ifdef lint 49 #define TCP_MSS 536 50 #else 51 #define TCP_MSS MIN(512, IP_MSS - sizeof (struct tcpiphdr)) 52 #endif 53 54 /* 55 * User-settable options (used with setsockopt). 56 */ 57 #define TCP_NODELAY 0x01 /* don't delay send to coalesce packets */ 58 #define TCP_MAXSEG 0x02 /* set maximum segment size */ 59