|
|
1.1 root 1: /*
2: * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
3: *
4: * @APPLE_LICENSE_HEADER_START@
5: *
6: * Portions Copyright (c) 1999 Apple Computer, Inc. All Rights
7: * Reserved. This file contains Original Code and/or Modifications of
8: * Original Code as defined in and that are subject to the Apple Public
9: * Source License Version 1.1 (the "License"). You may not use this file
10: * except in compliance with the License. Please obtain a copy of the
11: * License at http://www.apple.com/publicsource and read it before using
12: * this file.
13: *
14: * The Original Code and all software distributed under the License are
15: * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
16: * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
17: * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
18: * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
19: * License for the specific language governing rights and limitations
20: * under the License.
21: *
22: * @APPLE_LICENSE_HEADER_END@
23: */
24:
25: /*
26: * Copyright (c) 1984, 1985, 1986, 1987, 1993
27: * The Regents of the University of California. All rights reserved.
28: *
29: * Redistribution and use in source and binary forms, with or without
30: * modification, are permitted provided that the following conditions
31: * are met:
32: * 1. Redistributions of source code must retain the above copyright
33: * notice, this list of conditions and the following disclaimer.
34: * 2. Redistributions in binary form must reproduce the above copyright
35: * notice, this list of conditions and the following disclaimer in the
36: * documentation and/or other materials provided with the distribution.
37: * 3. All advertising materials mentioning features or use of this software
38: * must display the following acknowledgement:
39: * This product includes software developed by the University of
40: * California, Berkeley and its contributors.
41: * 4. Neither the name of the University nor the names of its contributors
42: * may be used to endorse or promote products derived from this software
43: * without specific prior written permission.
44: *
45: * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
46: * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
47: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
48: * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
49: * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
50: * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
51: * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
52: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
53: * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
54: * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
55: * SUCH DAMAGE.
56: *
57: * @(#)spp_var.h 8.1 (Berkeley) 6/10/93
58: */
59:
60: /*
61: * Sp control block, one per connection
62: */
63: struct sppcb {
64: struct spidp_q s_q; /* queue for out-of-order receipt */
65: struct nspcb *s_nspcb; /* backpointer to internet pcb */
66: u_char s_state;
67: u_char s_flags;
68: #define SF_ACKNOW 0x01 /* Ack peer immediately */
69: #define SF_DELACK 0x02 /* Ack, but try to delay it */
70: #define SF_HI 0x04 /* Show headers on input */
71: #define SF_HO 0x08 /* Show headers on output */
72: #define SF_PI 0x10 /* Packet (datagram) interface */
73: #define SF_WIN 0x20 /* Window info changed */
74: #define SF_RXT 0x40 /* Rxt info changed */
75: #define SF_RVD 0x80 /* Calling from read usrreq routine */
76: u_short s_mtu; /* Max packet size for this stream */
77: /* use sequence fields in headers to store sequence numbers for this
78: connection */
79: struct idp *s_idp;
80: struct sphdr s_shdr; /* prototype header to transmit */
81: #define s_cc s_shdr.sp_cc /* connection control (for EM bit) */
82: #define s_dt s_shdr.sp_dt /* datastream type */
83: #define s_sid s_shdr.sp_sid /* source connection identifier */
84: #define s_did s_shdr.sp_did /* destination connection identifier */
85: #define s_seq s_shdr.sp_seq /* sequence number */
86: #define s_ack s_shdr.sp_ack /* acknowledge number */
87: #define s_alo s_shdr.sp_alo /* allocation number */
88: #define s_dport s_idp->idp_dna.x_port /* where we are sending */
89: struct sphdr s_rhdr; /* last received header (in effect!)*/
90: u_short s_rack; /* their acknowledge number */
91: u_short s_ralo; /* their allocation number */
92: u_short s_smax; /* highest packet # we have sent */
93: u_short s_snxt; /* which packet to send next */
94:
95: /* congestion control */
96: #define CUNIT 1024 /* scaling for ... */
97: int s_cwnd; /* Congestion-controlled window */
98: /* in packets * CUNIT */
99: short s_swnd; /* == tcp snd_wnd, in packets */
100: short s_smxw; /* == tcp max_sndwnd */
101: /* difference of two spp_seq's can be
102: no bigger than a short */
103: u_short s_swl1; /* == tcp snd_wl1 */
104: u_short s_swl2; /* == tcp snd_wl2 */
105: int s_cwmx; /* max allowable cwnd */
106: int s_ssthresh; /* s_cwnd size threshhold for
107: * slow start exponential-to-
108: * linear switch */
109: /* transmit timing stuff
110: * srtt and rttvar are stored as fixed point, for convenience in smoothing.
111: * srtt has 3 bits to the right of the binary point, rttvar has 2.
112: */
113: short s_idle; /* time idle */
114: short s_timer[SPPT_NTIMERS]; /* timers */
115: short s_rxtshift; /* log(2) of rexmt exp. backoff */
116: short s_rxtcur; /* current retransmit value */
117: u_short s_rtseq; /* packet being timed */
118: short s_rtt; /* timer for round trips */
119: short s_srtt; /* averaged timer */
120: short s_rttvar; /* variance in round trip time */
121: char s_force; /* which timer expired */
122: char s_dupacks; /* counter to intuit xmt loss */
123:
124: /* out of band data */
125: char s_oobflags;
126: #define SF_SOOB 0x08 /* sending out of band data */
127: #define SF_IOOB 0x10 /* receiving out of band data */
128: char s_iobc; /* input characters */
129: /* debug stuff */
130: u_short s_want; /* Last candidate for sending */
131: char s_outx; /* exit taken from spp_output */
132: char s_inx; /* exit taken from spp_input */
133: u_short s_flags2; /* more flags for testing */
134: #define SF_NEWCALL 0x100 /* for new_recvmsg */
135: #define SO_NEWCALL 10 /* for new_recvmsg */
136: };
137:
138: #define nstosppcb(np) ((struct sppcb *)(np)->nsp_pcb)
139: #define sotosppcb(so) (nstosppcb(sotonspcb(so)))
140:
141: struct sppstat {
142: long spps_connattempt; /* connections initiated */
143: long spps_accepts; /* connections accepted */
144: long spps_connects; /* connections established */
145: long spps_drops; /* connections dropped */
146: long spps_conndrops; /* embryonic connections dropped */
147: long spps_closed; /* conn. closed (includes drops) */
148: long spps_segstimed; /* segs where we tried to get rtt */
149: long spps_rttupdated; /* times we succeeded */
150: long spps_delack; /* delayed acks sent */
151: long spps_timeoutdrop; /* conn. dropped in rxmt timeout */
152: long spps_rexmttimeo; /* retransmit timeouts */
153: long spps_persisttimeo; /* persist timeouts */
154: long spps_keeptimeo; /* keepalive timeouts */
155: long spps_keepprobe; /* keepalive probes sent */
156: long spps_keepdrops; /* connections dropped in keepalive */
157:
158: long spps_sndtotal; /* total packets sent */
159: long spps_sndpack; /* data packets sent */
160: long spps_sndbyte; /* data bytes sent */
161: long spps_sndrexmitpack; /* data packets retransmitted */
162: long spps_sndrexmitbyte; /* data bytes retransmitted */
163: long spps_sndacks; /* ack-only packets sent */
164: long spps_sndprobe; /* window probes sent */
165: long spps_sndurg; /* packets sent with URG only */
166: long spps_sndwinup; /* window update-only packets sent */
167: long spps_sndctrl; /* control (SYN|FIN|RST) packets sent */
168: long spps_sndvoid; /* couldn't find requested packet*/
169:
170: long spps_rcvtotal; /* total packets received */
171: long spps_rcvpack; /* packets received in sequence */
172: long spps_rcvbyte; /* bytes received in sequence */
173: long spps_rcvbadsum; /* packets received with ccksum errs */
174: long spps_rcvbadoff; /* packets received with bad offset */
175: long spps_rcvshort; /* packets received too short */
176: long spps_rcvduppack; /* duplicate-only packets received */
177: long spps_rcvdupbyte; /* duplicate-only bytes received */
178: long spps_rcvpartduppack; /* packets with some duplicate data */
179: long spps_rcvpartdupbyte; /* dup. bytes in part-dup. packets */
180: long spps_rcvoopack; /* out-of-order packets received */
181: long spps_rcvoobyte; /* out-of-order bytes received */
182: long spps_rcvpackafterwin; /* packets with data after window */
183: long spps_rcvbyteafterwin; /* bytes rcvd after window */
184: long spps_rcvafterclose; /* packets rcvd after "close" */
185: long spps_rcvwinprobe; /* rcvd window probe packets */
186: long spps_rcvdupack; /* rcvd duplicate acks */
187: long spps_rcvacktoomuch; /* rcvd acks for unsent data */
188: long spps_rcvackpack; /* rcvd ack packets */
189: long spps_rcvackbyte; /* bytes acked by rcvd acks */
190: long spps_rcvwinupd; /* rcvd window update packets */
191: };
192: struct spp_istat {
193: short hdrops;
194: short badsum;
195: short badlen;
196: short slotim;
197: short fastim;
198: short nonucn;
199: short noconn;
200: short notme;
201: short wrncon;
202: short bdreas;
203: short gonawy;
204: short notyet;
205: short lstdup;
206: struct sppstat newstats;
207: };
208:
209: #ifdef KERNEL
210: struct spp_istat spp_istat;
211:
212: /* Following was struct sppstat sppstat; */
213: #ifndef sppstat
214: #define sppstat spp_istat.newstats
215: #endif
216:
217: u_short spp_iss;
218: extern struct sppcb *spp_close(), *spp_disconnect(),
219: *spp_usrclosed(), *spp_timers(), *spp_drop();
220: #endif
221:
222: #define SPP_ISSINCR 128
223: /*
224: * SPP sequence numbers are 16 bit integers operated
225: * on with modular arithmetic. These macros can be
226: * used to compare such integers.
227: */
228: #ifdef sun
229: short xnsCbug;
230: #define SSEQ_LT(a,b) ((xnsCbug = (short)((a)-(b))) < 0)
231: #define SSEQ_LEQ(a,b) ((xnsCbug = (short)((a)-(b))) <= 0)
232: #define SSEQ_GT(a,b) ((xnsCbug = (short)((a)-(b))) > 0)
233: #define SSEQ_GEQ(a,b) ((xnsCbug = (short)((a)-(b))) >= 0)
234: #else
235: #define SSEQ_LT(a,b) (((short)((a)-(b))) < 0)
236: #define SSEQ_LEQ(a,b) (((short)((a)-(b))) <= 0)
237: #define SSEQ_GT(a,b) (((short)((a)-(b))) > 0)
238: #define SSEQ_GEQ(a,b) (((short)((a)-(b))) >= 0)
239: #endif
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.