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