root/net/inet/tcp.h

/* [previous][next][first][last][top][bottom][index][help] */

INCLUDED FROM


DEFINITIONS

This source file includes following definitions.
  1. before
  2. after
  3. between
  4. tcp_connected

   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 #define MAX_SYN_SIZE    44 + MAX_HEADER
  24 #define MAX_FIN_SIZE    40 + MAX_HEADER
  25 #define MAX_ACK_SIZE    40 + MAX_HEADER
  26 #define MAX_RESET_SIZE  40 + MAX_HEADER
  27 #define MAX_WINDOW      8192
  28 #define MIN_WINDOW      2048
  29 #define MAX_ACK_BACKLOG 2
  30 #define MIN_WRITE_SPACE 2048
  31 #define TCP_WINDOW_DIFF 2048
  32 
  33 /* urg_data states */
  34 #define URG_VALID       0x0100
  35 #define URG_NOTYET      0x0200
  36 #define URG_READ        0x0400
  37 
  38 #define TCP_RETR1       7       /*
  39                                  * This is howmany retries it does before it
  40                                  * tries to figure out if the gateway is
  41                                  * down.
  42                                  */
  43 
  44 #define TCP_RETR2       15      /*
  45                                  * This should take at least
  46                                  * 90 minutes to time out.
  47                                  */
  48 
  49 #define TCP_TIMEOUT_LEN (15*60*HZ) /* should be about 15 mins           */
  50 #define TCP_TIMEWAIT_LEN (60*HZ) /* how long to wait to sucessfully 
  51                                   * close the socket, about 60 seconds  */
  52 #define TCP_ACK_TIME    3000    /* time to delay before sending an ACK  */
  53 #define TCP_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 #define TCP_CONNECT_TIME 2000   /* time to retransmit first SYN         */
  58 #define TCP_SYN_RETRIES 5       /* number of times to retry openning 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 #define TCP_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 #define TCPOPT_NOP              1
  73 #define TCPOPT_EOL              0
  74 #define TCPOPT_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 static inline int before(unsigned long seq1, unsigned long seq2)
     /* [previous][next][first][last][top][bottom][index][help] */
  81 {
  82         return (long)(seq1-seq2) < 0;
  83 }
  84 
  85 static inline int after(unsigned long seq1, unsigned long seq2)
     /* [previous][next][first][last][top][bottom][index][help] */
  86 {
  87         return (long)(seq1-seq2) > 0;
  88 }
  89 
  90 
  91 /* is s2<=s1<=s3 ? */
  92 static inline int between(unsigned long seq1, unsigned long seq2, unsigned long seq3)
     /* [previous][next][first][last][top][bottom][index][help] */
  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 static inline const int
 105 tcp_connected(const int state)
     /* [previous][next][first][last][top][bottom][index][help] */
 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 extern struct proto tcp_prot;
 114 
 115 
 116 extern void     tcp_err(int err, unsigned char *header, unsigned long daddr,
 117                         unsigned long saddr, struct inet_protocol *protocol);
 118 extern void     tcp_shutdown (struct sock *sk, int how);
 119 extern int      tcp_rcv(struct sk_buff *skb, struct device *dev,
 120                         struct options *opt, unsigned long daddr,
 121                         unsigned short len, unsigned long saddr, int redo,
 122                         struct inet_protocol *protocol);
 123 
 124 extern int      tcp_ioctl(struct sock *sk, int cmd, unsigned long arg);
 125 
 126 extern void tcp_send_probe0(struct sock *sk);
 127 extern void tcp_enqueue_partial(struct sk_buff *, struct sock *);
 128 extern struct sk_buff * tcp_dequeue_partial(struct sock *);
 129 
 130 
 131 #endif  /* _TCP_H */

/* [previous][next][first][last][top][bottom][index][help] */