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