123187Smckusick /* 229147Smckusick * Copyright (c) 1982, 1986 Regents of the University of California. 332787Sbostic * All rights reserved. 423187Smckusick * 532787Sbostic * Redistribution and use in source and binary forms are permitted 634854Sbostic * provided that the above copyright notice and this paragraph are 734854Sbostic * duplicated in all such forms and that any documentation, 834854Sbostic * advertising materials, and other materials related to such 934854Sbostic * distribution and use acknowledge that the software was developed 1034854Sbostic * by the University of California, Berkeley. The name of the 1134854Sbostic * University may not be used to endorse or promote products derived 1234854Sbostic * from this software without specific prior written permission. 1334854Sbostic * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR 1434854Sbostic * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED 1534854Sbostic * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. 1632787Sbostic * 17*44373Skarels * @(#)tcp.h 7.6 (Berkeley) 06/28/90 1823187Smckusick */ 194573Swnj 205085Swnj typedef u_long tcp_seq; 214573Swnj /* 224899Swnj * TCP header. 234924Swnj * Per RFC 793, September, 1981. 244573Swnj */ 254899Swnj struct tcphdr { 264899Swnj u_short th_sport; /* source port */ 274899Swnj u_short th_dport; /* destination port */ 285085Swnj tcp_seq th_seq; /* sequence number */ 295085Swnj tcp_seq th_ack; /* acknowledgement number */ 30*44373Skarels #if BYTE_ORDER == LITTLE_ENDIAN 319992Ssam u_char th_x2:4, /* (unused) */ 324899Swnj th_off:4; /* data offset */ 339992Ssam #endif 34*44373Skarels #if BYTE_ORDER == BIG_ENDIAN 3529923Skarels u_char th_off:4, /* data offset */ 3629923Skarels th_x2:4; /* (unused) */ 3729923Skarels #endif 384575Swnj u_char th_flags; 395065Swnj #define TH_FIN 0x01 405065Swnj #define TH_SYN 0x02 415065Swnj #define TH_RST 0x04 425065Swnj #define TH_PUSH 0x08 435065Swnj #define TH_ACK 0x10 445065Swnj #define TH_URG 0x20 454899Swnj u_short th_win; /* window */ 464899Swnj u_short th_sum; /* checksum */ 474899Swnj u_short th_urp; /* urgent pointer */ 484499Swnj }; 495440Swnj 505440Swnj #define TCPOPT_EOL 0 515440Swnj #define TCPOPT_NOP 1 525440Swnj #define TCPOPT_MAXSEG 2 5317316Skarels 5417316Skarels /* 5526259Skarels * Default maximum segment size for TCP. 5626259Skarels * With an IP MSS of 576, this is 536, 5726259Skarels * but 512 is probably more convenient. 58*44373Skarels * This should be defined as MIN(512, IP_MSS - sizeof (struct tcpiphdr)). 5917316Skarels */ 60*44373Skarels #define TCP_MSS 512 6125895Skarels 62*44373Skarels #define TCP_MAXWIN 65535 /* largest value for window */ 63*44373Skarels 6425895Skarels /* 6525895Skarels * User-settable options (used with setsockopt). 6625895Skarels */ 6725895Skarels #define TCP_NODELAY 0x01 /* don't delay send to coalesce packets */ 6825895Skarels #define TCP_MAXSEG 0x02 /* set maximum segment size */ 69