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 + MAX_HEADER 24 #defineMAX_FIN_SIZE 40 + MAX_HEADER 25 #defineMAX_ACK_SIZE 40 + MAX_HEADER 26 #defineMAX_RESET_SIZE 40 + MAX_HEADER 27 #defineMAX_WINDOW 16384
28 #defineMIN_WINDOW 2048
29 #define MAX_ACK_BACKLOG 2
30 #defineMIN_WRITE_SPACE 2048
31 #defineTCP_WINDOW_DIFF 2048
32
33 /* urg_data states */ 34 #defineURG_VALID 0x0100
35 #defineURG_NOTYET 0x0200
36 #defineURG_READ 0x0400
37
38 #defineTCP_RETR1 7 /* 39 * This is how many retries it does before it 40 * tries to figure out if the gateway is 41 * down. 42 */ 43
44 #defineTCP_RETR2 15 /* 45 * This should take at least 46 * 90 minutes to time out. 47 */ 48
49 #defineTCP_TIMEOUT_LEN (15*60*HZ) /* should be about 15 mins */ 50 #defineTCP_TIMEWAIT_LEN (60*HZ) /* how long to wait to successfully 51 * close the socket, about 60 seconds */ 52 #defineTCP_ACK_TIME (3*HZ) /* time to delay before sending an ACK */ 53 #defineTCP_DONE_TIME 250 /* maximum time to wait before actually 54 * destroying a socket */ 55 #define TCP_WRITE_TIME 3000 /* initial time to wait for an ACK, 56 * after last transmit */ 57 #defineTCP_TIMEOUT_INIT (3*HZ) /* RFC 1122 initial timeout value */ 58 #defineTCP_SYN_RETRIES 5 /* number of times to retry opening a 59 * connection */ 60 #define TCP_PROBEWAIT_LEN 100 /* time to wait between probes when 61 * I've got something to write and 62 * there is no window */ 63
64 #defineTCP_NO_CHECK 0 /* turn to one if you want the default 65 * to be no checksum */ 66
67
68 /* 69 * TCP option 70 */ 71
72 #defineTCPOPT_NOP 1
73 #defineTCPOPT_EOL 0
74 #defineTCPOPT_MSS 2
75
76 /* 77 * The next routines deal with comparing 32 bit unsigned ints 78 * and worry about wraparound (automatic with unsigned arithmetic). 79 */ 80
81 extern__inlineintbefore(unsignedlongseq1, unsignedlongseq2)
/* */ 82 { 83 return (long)(seq1-seq2) < 0;
84 } 85
86 extern__inlineintafter(unsignedlongseq1, unsignedlongseq2)
/* */ 87 { 88 return (long)(seq1-seq2) > 0;
89 } 90
91
92 /* is s2<=s1<=s3 ? */ 93 extern__inlineint between(unsignedlongseq1, unsignedlongseq2, unsignedlongseq3)
/* */ 94 { 95 return (after(seq1+1, seq2) && before(seq1, seq3+1));
96 } 97
98
99 /* 100 * List all states of a TCP socket that can be viewed as a "connected" 101 * state. This now includes TCP_SYN_RECV, although I am not yet fully 102 * convinced that this is the solution for the 'getpeername(2)' 103 * problem. Thanks to Stephen A. Wood <saw@cebaf.gov> -FvK 104 */ 105 extern__inlineconstint 106 tcp_connected(constintstate)
/* */ 107 { 108 return(state == TCP_ESTABLISHED || state == TCP_CLOSE_WAIT ||
109 state == TCP_FIN_WAIT1 || state == TCP_FIN_WAIT2 ||
110 state == TCP_SYN_RECV);
111 } 112
113
114 externstructprototcp_prot;
115
116
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 externinttcp_select_window(structsock *sk);
128 externvoidtcp_send_check(structtcphdr *th, unsignedlongsaddr,
129 unsignedlongdaddr, intlen, structsock *sk);
130 externvoidtcp_send_probe0(structsock *sk);
131 externvoidtcp_enqueue_partial(structsk_buff *, structsock *);
132 externstructsk_buff * tcp_dequeue_partial(structsock *);
133
134
135 #endif/* _TCP_H */