1 /* 2 * INET An implementation of the TCP/IP protocol suite for the LINUX 3 * operating system. INET is implemented using the BSD Socket 4 * interface as the means of communication with the user level. 5 * 6 * Definitions for the TCP module. 7 * 8 * Version: @(#)tcp.h 1.0.5 05/23/93 9 * 10 * Authors: Ross Biro, <bir7@leland.Stanford.Edu> 11 * Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG> 12 * 13 * This program is free software; you can redistribute it and/or 14 * modify it under the terms of the GNU General Public License 15 * as published by the Free Software Foundation; either version 16 * 2 of the License, or (at your option) any later version. 17 */ 18 #ifndef_TCP_H 19 #define_TCP_H 20
21 #include <linux/tcp.h>
22
23 #defineMAX_SYN_SIZE 44 + sizeof (structsk_buff) + MAX_HEADER 24 #defineMAX_FIN_SIZE 40 + sizeof (structsk_buff) + MAX_HEADER 25 #defineMAX_ACK_SIZE 40 + sizeof (structsk_buff) + MAX_HEADER 26 #defineMAX_RESET_SIZE 40 + sizeof (structsk_buff) + MAX_HEADER 27 #defineMAX_WINDOW 4096
28 #defineMIN_WINDOW 2048
29 #define MAX_ACK_BACKLOG 2
30 #defineMIN_WRITE_SPACE 2048
31 #defineTCP_WINDOW_DIFF 2048
32
33 #defineTCP_RETR1 7 /* 34 * This is howmany retries it does before it 35 * tries to figure out if the gateway is 36 * down. 37 */ 38
39 #defineTCP_RETR2 15 /* 40 * This should take at least 41 * 90 minutes to time out. 42 */ 43
44 #defineTCP_TIMEOUT_LEN (5*60*HZ)/* should be about 5 mins */ 45 #defineTCP_TIMEWAIT_LEN (60*HZ) /* how long to wait to sucessfully 46 * close the socket, about 60 seconds */ 47 #defineTCP_ACK_TIME 3000 /* time to delay before sending an ACK */ 48 #defineTCP_DONE_TIME 250 /* maximum time to wait before actually 49 * destroying a socket */ 50 #defineTCP_WRITE_TIME 3000 /* initial time to wait for an ACK, 51 * after last transmit */ 52 #defineTCP_CONNECT_TIME 2000 /* time to retransmit first SYN */ 53 #defineTCP_SYN_RETRIES 5 /* number of times to retry openning a 54 * connection */ 55 #define TCP_PROBEWAIT_LEN 100 /* time to wait between probes when 56 * I've got something to write and 57 * there is no window */ 58
59 #defineTCP_NO_CHECK 0 /* turn to one if you want the default 60 * to be no checksum */ 61
62 #defineTCP_WRITE_QUEUE_MAGIC 0xa5f23477
63
64 /* 65 * TCP option 66 */ 67
68 #defineTCPOPT_NOP 1
69 #defineTCPOPT_EOL 0
70 #defineTCPOPT_MSS 2
71
72 /* 73 * The next routines deal with comparing 32 bit unsigned ints 74 * and worry about wraparound (automatic with unsigned arithmetic). 75 */ 76 staticinlineintbefore(unsignedlongseq1, unsignedlongseq2)
/* */ 77 { 78 /* this inequality is strict. */ 79 if (seq1 == seq2)
80 return 0;
81 seq2 -= seq1;
82 return (seq2 < 65536);
83 } 84
85 staticinlineintafter(unsignedlongseq1, unsignedlongseq2)
/* */ 86 { 87 returnbefore(seq2, seq1);
88 } 89
90
91 /* is s2<=s1<=s3 ? */ 92 staticinlineintbetween(unsignedlongseq1, unsignedlongseq2, unsignedlongseq3)
/* */ 93 { 94 return (after(seq1+1, seq2) && before(seq1, seq3+1));
95 } 96
97
98 /* 99 * List all states of a TCP socket that can be viewed as a "connected" 100 * state. This now includes TCP_SYN_RECV, although I am not yet fully 101 * convinced that this is the solution for the 'getpeername(2)' 102 * problem. Thanks to Stephen A. Wood <saw@cebaf.gov> -FvK 103 */ 104 staticinlineconstint 105 tcp_connected(constintstate)
/* */ 106 { 107 return(state == TCP_ESTABLISHED || state == TCP_CLOSE_WAIT ||
108 state == TCP_FIN_WAIT1 || state == TCP_FIN_WAIT2 ||
109 state == TCP_SYN_RECV);
110 } 111
112
113 externstructprototcp_prot;
114
115
116 externvoidprint_th(structtcphdr *);
117 externvoidtcp_err(interr, unsignedchar *header, unsignedlongdaddr,
118 unsignedlongsaddr, structinet_protocol *protocol);
119 externvoidtcp_shutdown (structsock *sk, inthow);
120 externinttcp_rcv(structsk_buff *skb, structdevice *dev,
121 structoptions *opt, unsignedlongdaddr,
122 unsignedshortlen, unsignedlongsaddr, intredo,
123 structinet_protocol *protocol);
124
125 externinttcp_ioctl(structsock *sk, intcmd, unsignedlongarg);
126
127
128 #endif/* _TCP_H */