1 /* 2 * Copyright (c) 1982, 1986, 1988 Regents of the University of California. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms are permitted 6 * provided that the above copyright notice and this paragraph are 7 * duplicated in all such forms and that any documentation, 8 * advertising materials, and other materials related to such 9 * distribution and use acknowledge that the software was developed 10 * by the University of California, Berkeley. The name of the 11 * University may not be used to endorse or promote products derived 12 * from this software without specific prior written permission. 13 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR 14 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED 15 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. 16 * 17 * @(#)spp_timer.h 7.2 (Berkeley) 06/29/88 18 */ 19 20 /* 21 * Definitions of the SPP timers. These timers are counted 22 * down PR_SLOWHZ times a second. 23 */ 24 #define SPPT_NTIMERS 4 25 26 #define SPPT_REXMT 0 /* retransmit */ 27 #define SPPT_PERSIST 1 /* retransmit persistance */ 28 #define SPPT_KEEP 2 /* keep alive */ 29 #define SPPT_2MSL 3 /* 2*msl quiet time timer */ 30 31 /* 32 * The SPPT_REXMT timer is used to force retransmissions. 33 * The SPP has the SPPT_REXMT timer set whenever segments 34 * have been sent for which ACKs are expected but not yet 35 * received. If an ACK is received which advances tp->snd_una, 36 * then the retransmit timer is cleared (if there are no more 37 * outstanding segments) or reset to the base value (if there 38 * are more ACKs expected). Whenever the retransmit timer goes off, 39 * we retransmit one unacknowledged segment, and do a backoff 40 * on the retransmit timer. 41 * 42 * The SPPT_PERSIST timer is used to keep window size information 43 * flowing even if the window goes shut. If all previous transmissions 44 * have been acknowledged (so that there are no retransmissions in progress), 45 * and the window is too small to bother sending anything, then we start 46 * the SPPT_PERSIST timer. When it expires, if the window is nonzero, 47 * we go to transmit state. Otherwise, at intervals send a single byte 48 * into the peer's window to force him to update our window information. 49 * We do this at most as often as SPPT_PERSMIN time intervals, 50 * but no more frequently than the current estimate of round-trip 51 * packet time. The SPPT_PERSIST timer is cleared whenever we receive 52 * a window update from the peer. 53 * 54 * The SPPT_KEEP timer is used to keep connections alive. If an 55 * connection is idle (no segments received) for SPPTV_KEEP amount of time, 56 * but not yet established, then we drop the connection. If the connection 57 * is established, then we force the peer to send us a segment by sending: 58 * <SEQ=SND.UNA-1><ACK=RCV.NXT><CTL=ACK> 59 * This segment is (deliberately) outside the window, and should elicit 60 * an ack segment in response from the peer. If, despite the SPPT_KEEP 61 * initiated segments we cannot elicit a response from a peer in SPPT_MAXIDLE 62 * amount of time, then we drop the connection. 63 */ 64 65 #define SPP_TTL 30 /* default time to live for SPP segs */ 66 /* 67 * Time constants. 68 */ 69 #define SPPTV_MSL ( 15*PR_SLOWHZ) /* max seg lifetime */ 70 #define SPPTV_SRTTBASE 0 /* base roundtrip time; 71 if 0, no idea yet */ 72 #define SPPTV_SRTTDFLT ( 3*PR_SLOWHZ) /* assumed RTT if no info */ 73 74 #define SPPTV_PERSMIN ( 5*PR_SLOWHZ) /* retransmit persistance */ 75 #define SPPTV_PERSMAX ( 60*PR_SLOWHZ) /* maximum persist interval */ 76 77 #define SPPTV_KEEP ( 75*PR_SLOWHZ) /* keep alive - 75 secs */ 78 #define SPPTV_MAXIDLE ( 8*SPPTV_KEEP) /* maximum allowable idle 79 time before drop conn */ 80 81 #define SPPTV_MIN ( 1*PR_SLOWHZ) /* minimum allowable value */ 82 #define SPPTV_REXMTMAX ( 64*PR_SLOWHZ) /* max allowable REXMT value */ 83 84 #define SPP_LINGERTIME 120 /* linger at most 2 minutes */ 85 86 #define SPP_MAXRXTSHIFT 12 /* maximum retransmits */ 87 88 #ifdef SPPTIMERS 89 char *spptimers[] = 90 { "REXMT", "PERSIST", "KEEP", "2MSL" }; 91 #endif 92 93 /* 94 * Force a time value to be in a certain range. 95 */ 96 #define SPPT_RANGESET(tv, value, tvmin, tvmax) { \ 97 (tv) = (value); \ 98 if ((tv) < (tvmin)) \ 99 (tv) = (tvmin); \ 100 else if ((tv) > (tvmax)) \ 101 (tv) = (tvmax); \ 102 } 103 104 #ifdef KERNEL 105 extern int spp_backoff[]; 106 #endif 107