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