OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-2.0/] [packages/] [net/] [tcpip/] [v2_0/] [include/] [netinet/] [tcp_timer.h] - Blame information for rev 174

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 27 unneback
//==========================================================================
2
//
3
//      include/netinet_tcp_timer.h
4
//
5
//      
6
//
7
//==========================================================================
8
//####BSDCOPYRIGHTBEGIN####
9
//
10
// -------------------------------------------
11
//
12
// Portions of this software may have been derived from OpenBSD or other sources,
13
// and are covered by the appropriate copyright disclaimers included herein.
14
//
15
// -------------------------------------------
16
//
17
//####BSDCOPYRIGHTEND####
18
//==========================================================================
19
//#####DESCRIPTIONBEGIN####
20
//
21
// Author(s):    gthomas
22
// Contributors: gthomas
23
// Date:         2000-01-10
24
// Purpose:      
25
// Description:  
26
//              
27
//
28
//####DESCRIPTIONEND####
29
//
30
//==========================================================================
31
 
32
 
33
/*      $OpenBSD: tcp_timer.h,v 1.3 1997/02/24 14:06:46 niklas Exp $    */
34
/*      $NetBSD: tcp_timer.h,v 1.6 1995/03/26 20:32:37 jtc Exp $        */
35
 
36
/*
37
 * Copyright (c) 1982, 1986, 1993
38
 *      The Regents of the University of California.  All rights reserved.
39
 *
40
 * Redistribution and use in source and binary forms, with or without
41
 * modification, are permitted provided that the following conditions
42
 * are met:
43
 * 1. Redistributions of source code must retain the above copyright
44
 *    notice, this list of conditions and the following disclaimer.
45
 * 2. Redistributions in binary form must reproduce the above copyright
46
 *    notice, this list of conditions and the following disclaimer in the
47
 *    documentation and/or other materials provided with the distribution.
48
 * 3. All advertising materials mentioning features or use of this software
49
 *    must display the following acknowledgement:
50
 *      This product includes software developed by the University of
51
 *      California, Berkeley and its contributors.
52
 * 4. Neither the name of the University nor the names of its contributors
53
 *    may be used to endorse or promote products derived from this software
54
 *    without specific prior written permission.
55
 *
56
 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
57
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
58
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
59
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
60
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
61
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
62
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
63
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
64
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
65
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
66
 * SUCH DAMAGE.
67
 *
68
 *      @(#)tcp_timer.h 8.1 (Berkeley) 6/10/93
69
 */
70
 
71
#ifndef _NETINET_TCP_TIMER_H_
72
#define _NETINET_TCP_TIMER_H_
73
 
74
/*
75
 * Definitions of the TCP timers.  These timers are counted
76
 * down PR_SLOWHZ times a second.
77
 */
78
#define TCPT_NTIMERS    4
79
 
80
#define TCPT_REXMT      0                /* retransmit */
81
#define TCPT_PERSIST    1               /* retransmit persistance */
82
#define TCPT_KEEP       2               /* keep alive */
83
#define TCPT_2MSL       3               /* 2*msl quiet time timer */
84
 
85
/*
86
 * The TCPT_REXMT timer is used to force retransmissions.
87
 * The TCP has the TCPT_REXMT timer set whenever segments
88
 * have been sent for which ACKs are expected but not yet
89
 * received.  If an ACK is received which advances tp->snd_una,
90
 * then the retransmit timer is cleared (if there are no more
91
 * outstanding segments) or reset to the base value (if there
92
 * are more ACKs expected).  Whenever the retransmit timer goes off,
93
 * we retransmit one unacknowledged segment, and do a backoff
94
 * on the retransmit timer.
95
 *
96
 * The TCPT_PERSIST timer is used to keep window size information
97
 * flowing even if the window goes shut.  If all previous transmissions
98
 * have been acknowledged (so that there are no retransmissions in progress),
99
 * and the window is too small to bother sending anything, then we start
100
 * the TCPT_PERSIST timer.  When it expires, if the window is nonzero,
101
 * we go to transmit state.  Otherwise, at intervals send a single byte
102
 * into the peer's window to force him to update our window information.
103
 * We do this at most as often as TCPT_PERSMIN time intervals,
104
 * but no more frequently than the current estimate of round-trip
105
 * packet time.  The TCPT_PERSIST timer is cleared whenever we receive
106
 * a window update from the peer.
107
 *
108
 * The TCPT_KEEP timer is used to keep connections alive.  If an
109
 * connection is idle (no segments received) for TCPTV_KEEP_INIT amount of time,
110
 * but not yet established, then we drop the connection.  Once the connection
111
 * is established, if the connection is idle for TCPTV_KEEP_IDLE time
112
 * (and keepalives have been enabled on the socket), we begin to probe
113
 * the connection.  We force the peer to send us a segment by sending:
114
 *      <SEQ=SND.UNA-1><ACK=RCV.NXT><CTL=ACK>
115
 * This segment is (deliberately) outside the window, and should elicit
116
 * an ack segment in response from the peer.  If, despite the TCPT_KEEP
117
 * initiated segments we cannot elicit a response from a peer in TCPT_MAXIDLE
118
 * amount of time probing, then we drop the connection.
119
 */
120
 
121
/*
122
 * Time constants.
123
 */
124
#define TCPTV_MSL       ( 30*PR_SLOWHZ)         /* max seg lifetime (hah!) */
125
#define TCPTV_SRTTBASE  0                        /* base roundtrip time;
126
                                                   if 0, no idea yet */
127
#define TCPTV_SRTTDFLT  (  3*PR_SLOWHZ)         /* assumed RTT if no info */
128
 
129
#define TCPTV_PERSMIN   (  5*PR_SLOWHZ)         /* retransmit persistance */
130
#define TCPTV_PERSMAX   ( 60*PR_SLOWHZ)         /* maximum persist interval */
131
 
132
#define TCPTV_KEEP_INIT ( 75*PR_SLOWHZ)         /* initial connect keep alive */
133
#define TCPTV_KEEP_IDLE (120*60*PR_SLOWHZ)      /* dflt time before probing */
134
#define TCPTV_KEEPINTVL ( 75*PR_SLOWHZ)         /* default probe interval */
135
#define TCPTV_KEEPCNT   8                       /* max probes before drop */
136
 
137
#define TCPTV_MIN       (  1*PR_SLOWHZ)         /* minimum allowable value */
138
#define TCPTV_REXMTMAX  ( 64*PR_SLOWHZ)         /* max allowable REXMT value */
139
 
140
#define TCP_LINGERTIME  120                     /* linger at most 2 minutes */
141
 
142
#define TCP_MAXRXTSHIFT 12                      /* maximum retransmits */
143
 
144
#ifdef  TCPTIMERS
145
char *tcptimers[] =
146
    { "REXMT", "PERSIST", "KEEP", "2MSL" };
147
#endif
148
 
149
/*
150
 * Force a time value to be in a certain range.
151
 */
152
#define TCPT_RANGESET(tv, value, tvmin, tvmax) { \
153
        (tv) = (value); \
154
        if ((tv) < (tvmin)) \
155
                (tv) = (tvmin); \
156
        else if ((tv) > (tvmax)) \
157
                (tv) = (tvmax); \
158
}
159
 
160
#ifdef _KERNEL
161
extern int tcptv_keep_init;
162
extern int tcp_keepidle;                /* time before keepalive probes begin */
163
extern int tcp_keepintvl;               /* time between keepalive probes */
164
extern int tcp_maxidle;                 /* time to drop after starting probes */
165
extern int tcp_ttl;                     /* time to live for TCP segs */
166
extern int tcp_backoff[];
167
#endif
168
 
169
#endif  // _NETINET_TCP_TIMER_H_

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.