FreeBSD/Linux Kernel Cross Reference
sys/netipx/spx.h
1 /*-
2 * Copyright (c) 1984, 1985, 1986, 1987, 1993
3 * The Regents of the University of California. 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 * 4. Neither the name of the University nor the names of its contributors
14 * may be used to endorse or promote products derived from this software
15 * without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 *
29 * Copyright (c) 1995, Mike Mitchell
30 *
31 * Redistribution and use in source and binary forms, with or without
32 * modification, are permitted provided that the following conditions
33 * are met:
34 * 1. Redistributions of source code must retain the above copyright
35 * notice, this list of conditions and the following disclaimer.
36 * 2. Redistributions in binary form must reproduce the above copyright
37 * notice, this list of conditions and the following disclaimer in the
38 * documentation and/or other materials provided with the distribution.
39 * 3. All advertising materials mentioning features or use of this software
40 * must display the following acknowledgement:
41 * This product includes software developed by the University of
42 * California, Berkeley and its contributors.
43 * 4. Neither the name of the University nor the names of its contributors
44 * may be used to endorse or promote products derived from this software
45 * without specific prior written permission.
46 *
47 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
48 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
49 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
50 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
51 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
52 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
53 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
54 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
55 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
56 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
57 * SUCH DAMAGE.
58 *
59 * @(#)spx.h
60 *
61 * $FreeBSD$
62 */
63
64 #ifndef _NETIPX_SPX_H_
65 #define _NETIPX_SPX_H_
66
67 /*
68 * Definitions for IPX style Sequenced Packet Protocol
69 */
70
71 struct spxhdr {
72 u_char spx_cc; /* connection control */
73 u_char spx_dt; /* datastream type */
74 #define SPX_SP 0x80 /* system packet */
75 #define SPX_SA 0x40 /* send acknowledgement */
76 #define SPX_OB 0x20 /* attention (out of band data) */
77 #define SPX_EM 0x10 /* end of message */
78 u_short spx_sid; /* source connection identifier */
79 u_short spx_did; /* destination connection identifier */
80 u_short spx_seq; /* sequence number */
81 u_short spx_ack; /* acknowledge number */
82 u_short spx_alo; /* allocation number */
83 } __packed;
84
85 /*
86 * Definitions for NS(tm) Internet Datagram Protocol
87 * containing a Sequenced Packet Protocol packet.
88 */
89 struct spx {
90 struct ipx si_i;
91 struct spxhdr si_s;
92 } __packed;
93 struct spx_q {
94 struct spx_q *si_next;
95 struct spx_q *si_prev;
96 };
97 #define SI(x) ((struct spx *)x)
98 #define si_sum si_i.ipx_sum
99 #define si_len si_i.ipx_len
100 #define si_tc si_i.ipx_tc
101 #define si_pt si_i.ipx_pt
102 #define si_dna si_i.ipx_dna
103 #define si_sna si_i.ipx_sna
104 #define si_sport si_i.ipx_sna.x_port
105 #define si_cc si_s.spx_cc
106 #define si_dt si_s.spx_dt
107 #define si_sid si_s.spx_sid
108 #define si_did si_s.spx_did
109 #define si_seq si_s.spx_seq
110 #define si_ack si_s.spx_ack
111 #define si_alo si_s.spx_alo
112
113 /*
114 * SPX control block, one per connection
115 */
116 struct spxpcb {
117 struct spx_q s_q; /* queue for out-of-order receipt */
118 struct ipxpcb *s_ipxpcb; /* backpointer to internet pcb */
119 u_char s_state;
120 u_char s_flags;
121 #define SF_ACKNOW 0x01 /* Ack peer immediately */
122 #define SF_DELACK 0x02 /* Ack, but try to delay it */
123 #define SF_HI 0x04 /* Show headers on input */
124 #define SF_HO 0x08 /* Show headers on output */
125 #define SF_PI 0x10 /* Packet (datagram) interface */
126 #define SF_WIN 0x20 /* Window info changed */
127 #define SF_RXT 0x40 /* Rxt info changed */
128 #define SF_RVD 0x80 /* Calling from read usrreq routine */
129 u_short s_mtu; /* Max packet size for this stream */
130 /* use sequence fields in headers to store sequence numbers for this
131 connection */
132 struct ipx *s_ipx;
133 struct spxhdr s_shdr; /* prototype header to transmit */
134 #define s_cc s_shdr.spx_cc /* connection control (for EM bit) */
135 #define s_dt s_shdr.spx_dt /* datastream type */
136 #define s_sid s_shdr.spx_sid /* source connection identifier */
137 #define s_did s_shdr.spx_did /* destination connection identifier */
138 #define s_seq s_shdr.spx_seq /* sequence number */
139 #define s_ack s_shdr.spx_ack /* acknowledge number */
140 #define s_alo s_shdr.spx_alo /* allocation number */
141 #define s_dport s_ipx->ipx_dna.x_port /* where we are sending */
142 struct spxhdr s_rhdr; /* last received header (in effect!)*/
143 u_short s_rack; /* their acknowledge number */
144 u_short s_ralo; /* their allocation number */
145 u_short s_smax; /* highest packet # we have sent */
146 u_short s_snxt; /* which packet to send next */
147
148 /* congestion control */
149 #define CUNIT 1024 /* scaling for ... */
150 int s_cwnd; /* Congestion-controlled window */
151 /* in packets * CUNIT */
152 short s_swnd; /* == tcp snd_wnd, in packets */
153 short s_smxw; /* == tcp max_sndwnd */
154 /* difference of two spx_seq's can be
155 no bigger than a short */
156 u_short s_swl1; /* == tcp snd_wl1 */
157 u_short s_swl2; /* == tcp snd_wl2 */
158 int s_cwmx; /* max allowable cwnd */
159 int s_ssthresh; /* s_cwnd size threshold for
160 * slow start exponential-to-
161 * linear switch */
162 /* transmit timing stuff
163 * srtt and rttvar are stored as fixed point, for convenience in smoothing.
164 * srtt has 3 bits to the right of the binary point, rttvar has 2.
165 */
166 short s_idle; /* time idle */
167 #define SPXT_NTIMERS 4
168 short s_timer[SPXT_NTIMERS]; /* timers */
169 short s_rxtshift; /* log(2) of rexmt exp. backoff */
170 short s_rxtcur; /* current retransmit value */
171 u_short s_rtseq; /* packet being timed */
172 short s_rtt; /* timer for round trips */
173 short s_srtt; /* averaged timer */
174 short s_rttvar; /* variance in round trip time */
175 char s_force; /* which timer expired */
176 char s_dupacks; /* counter to intuit xmt loss */
177
178 /* out of band data */
179 char s_oobflags;
180 #define SF_SOOB 0x08 /* sending out of band data */
181 #define SF_IOOB 0x10 /* receiving out of band data */
182 char s_iobc; /* input characters */
183 /* debug stuff */
184 u_short s_want; /* Last candidate for sending */
185 char s_outx; /* exit taken from spx_output */
186 char s_inx; /* exit taken from spx_input */
187 u_short s_flags2; /* more flags for testing */
188 #define SF_NEWCALL 0x100 /* for new_recvmsg */
189 #define SO_NEWCALL 10 /* for new_recvmsg */
190 };
191
192 #define ipxtospxpcb(np) ((struct spxpcb *)(np)->ipxp_pcb)
193 #define sotospxpcb(so) (ipxtospxpcb(sotoipxpcb(so)))
194
195 #ifdef _KERNEL
196
197 extern struct pr_usrreqs spx_usrreqs;
198 extern struct pr_usrreqs spx_usrreq_sps;
199
200 void spx_ctlinput(int cmd, struct sockaddr *arg_as_sa, void *dummy);
201 int spx_ctloutput(struct socket *so, struct sockopt *sopt);
202 void spx_fasttimo(void);
203 void spx_init(void);
204 void spx_input(struct mbuf *m, struct ipxpcb *ipxp);
205 void spx_slowtimo(void);
206
207 #endif /* _KERNEL */
208
209 #endif /* !_NETIPX_SPX_H_ */
Cache object: f5b71c57d0a05a1ff093636c95e21b12
|