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