Remove pca and speaker device remains (both deleted).
[dragonfly.git] / sys / netinet / sctp_var.h
1 /*      $KAME: sctp_var.h,v 1.23 2004/10/27 07:57:49 itojun Exp $       */
2 /*      $DragonFly: src/sys/netinet/sctp_var.h,v 1.4 2007/04/22 01:13:14 dillon Exp $   */
3
4 /*
5  * Copyright (c) 2001, 2002, 2003, 2004 Cisco Systems, Inc.
6  * All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
11  * 1. Redistributions of source code must retain the above copyright
12  *    notice, this list of conditions and the following disclaimer.
13  * 2. Redistributions in binary form must reproduce the above copyright
14  *    notice, this list of conditions and the following disclaimer in the
15  *    documentation and/or other materials provided with the distribution.
16  * 3. All advertising materials mentioning features or use of this software
17  *    must display the following acknowledgement:
18  *      This product includes software developed by Cisco Systems, Inc.
19  * 4. Neither the name of the project nor the names of its contributors
20  *    may be used to endorse or promote products derived from this software
21  *    without specific prior written permission.
22  *
23  * THIS SOFTWARE IS PROVIDED BY CISCO SYSTEMS AND CONTRIBUTORS ``AS IS'' AND
24  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26  * ARE DISCLAIMED.  IN NO EVENT SHALL CISCO SYSTEMS OR CONTRIBUTORS BE LIABLE
27  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33  * SUCH DAMAGE.
34  */
35
36 #ifndef _NETINET_SCTP_VAR_H_
37 #define _NETINET_SCTP_VAR_H_
38
39 #ifndef __OpenBSD__
40 #include <sys/socketvar.h>
41 #endif
42 #include <netinet/sctp_uio.h>
43
44 /* SCTP Kernel structures */
45
46 /*
47  * Names for SCTP sysctl objects
48  */
49 #ifndef __APPLE__
50 #define SCTPCTL_MAXDGRAM            1   /* max datagram size */
51 #define SCTPCTL_RECVSPACE           2   /* default receive buffer space */
52 #define SCTPCTL_AUTOASCONF          3   /* auto asconf enable/disable flag */
53 #define SCTPCTL_ECN_ENABLE          4   /* Is ecn allowed */
54 #define SCTPCTL_ECN_NONCE           5   /* Is ecn nonce allowed */
55 #define SCTPCTL_STRICT_SACK         6   /* strictly require sack'd TSN's to be
56                                          * smaller than sndnxt.
57                                          */
58 #define SCTPCTL_NOCSUM_LO           7   /* Require that the Loopback NOT have
59                                          * the crc32 checksum on packets routed over
60                                          * it.
61                                          */
62 #define SCTPCTL_STRICT_INIT         8
63 #define SCTPCTL_PEER_CHK_OH         9
64 #define SCTPCTL_MAXBURST            10
65 #define SCTPCTL_MAXCHUNKONQ         11
66 #define SCTPCTL_DELAYED_SACK        12
67 #define SCTPCTL_HB_INTERVAL         13
68 #define SCTPCTL_PMTU_RAISE          14
69 #define SCTPCTL_SHUTDOWN_GUARD      15
70 #define SCTPCTL_SECRET_LIFETIME     16
71 #define SCTPCTL_RTO_MAX             17
72 #define SCTPCTL_RTO_MIN             18
73 #define SCTPCTL_RTO_INITIAL         19
74 #define SCTPCTL_INIT_RTO_MAX        20
75 #define SCTPCTL_COOKIE_LIFE         21
76 #define SCTPCTL_INIT_RTX_MAX        22
77 #define SCTPCTL_ASSOC_RTX_MAX       23
78 #define SCTPCTL_PATH_RTX_MAX        24
79 #define SCTPCTL_NR_OUTGOING_STREAMS 25
80 #ifdef SCTP_DEBUG
81 #define SCTPCTL_DEBUG               26
82 #define SCTPCTL_MAXID               27
83 #else
84 #define SCTPCTL_MAXID               26
85 #endif
86
87 #endif
88
89 #ifdef SCTP_DEBUG
90 #define SCTPCTL_NAMES { \
91         { 0, 0 }, \
92         { "maxdgram", CTLTYPE_INT }, \
93         { "recvspace", CTLTYPE_INT }, \
94         { "autoasconf", CTLTYPE_INT }, \
95         { "ecn_enable", CTLTYPE_INT }, \
96         { "ecn_nonce", CTLTYPE_INT }, \
97         { "strict_sack", CTLTYPE_INT }, \
98         { "looback_nocsum", CTLTYPE_INT }, \
99         { "strict_init", CTLTYPE_INT }, \
100         { "peer_chkoh", CTLTYPE_INT }, \
101         { "maxburst", CTLTYPE_INT }, \
102         { "maxchunks", CTLTYPE_INT }, \
103         { "delayed_sack_time", CTLTYPE_INT }, \
104         { "heartbeat_interval", CTLTYPE_INT }, \
105         { "pmtu_raise_time", CTLTYPE_INT }, \
106         { "shutdown_guard_time", CTLTYPE_INT }, \
107         { "secret_lifetime", CTLTYPE_INT }, \
108         { "rto_max", CTLTYPE_INT }, \
109         { "rto_min", CTLTYPE_INT }, \
110         { "rto_initial", CTLTYPE_INT }, \
111         { "init_rto_max", CTLTYPE_INT }, \
112         { "valid_cookie_life", CTLTYPE_INT }, \
113         { "init_rtx_max", CTLTYPE_INT }, \
114         { "assoc_rtx_max", CTLTYPE_INT }, \
115         { "path_rtx_max", CTLTYPE_INT }, \
116         { "nr_outgoing_streams", CTLTYPE_INT }, \
117         { "debug", CTLTYPE_INT }, \
118 }
119 #else
120 #define SCTPCTL_NAMES { \
121         { 0, 0 }, \
122         { "maxdgram", CTLTYPE_INT }, \
123         { "recvspace", CTLTYPE_INT }, \
124         { "autoasconf", CTLTYPE_INT }, \
125         { "ecn_enable", CTLTYPE_INT }, \
126         { "ecn_nonce", CTLTYPE_INT }, \
127         { "strict_sack", CTLTYPE_INT }, \
128         { "looback_nocsum", CTLTYPE_INT }, \
129         { "strict_init", CTLTYPE_INT }, \
130         { "peer_chkoh", CTLTYPE_INT }, \
131         { "maxburst", CTLTYPE_INT }, \
132         { "maxchunks", CTLTYPE_INT }, \
133         { "delayed_sack_time", CTLTYPE_INT }, \
134         { "heartbeat_interval", CTLTYPE_INT }, \
135         { "pmtu_raise_time", CTLTYPE_INT }, \
136         { "shutdown_guard_time", CTLTYPE_INT }, \
137         { "secret_lifetime", CTLTYPE_INT }, \
138         { "rto_max", CTLTYPE_INT }, \
139         { "rto_min", CTLTYPE_INT }, \
140         { "rto_initial", CTLTYPE_INT }, \
141         { "init_rto_max", CTLTYPE_INT }, \
142         { "valid_cookie_life", CTLTYPE_INT }, \
143         { "init_rtx_max", CTLTYPE_INT }, \
144         { "assoc_rtx_max", CTLTYPE_INT }, \
145         { "path_rtx_max", CTLTYPE_INT }, \
146         { "nr_outgoing_streams", CTLTYPE_INT }, \
147 }
148 #endif
149
150 #if defined(_KERNEL) || (defined(__APPLE__) && defined(KERNEL))
151
152 #if defined(__FreeBSD__) || defined(__APPLE__) || defined(__DragonFly__)
153 #ifdef SYSCTL_DECL
154 SYSCTL_DECL(_net_inet_sctp);
155 #endif
156 extern struct   pr_usrreqs sctp_usrreqs;
157 #elif defined(__NetBSD__)
158 int sctp_usrreq(struct socket *, int, struct mbuf *, struct mbuf *,
159                       struct mbuf *, struct proc *);
160 #else
161 int sctp_usrreq(struct socket *, int, struct mbuf *, struct mbuf *,
162                       struct mbuf *);
163 #endif
164
165 #define sctp_sbspace(ssb) ((long) (((ssb)->ssb_hiwat > (ssb)->ssb_cc) ? ((ssb)->ssb_hiwat - (ssb)->ssb_cc) : 0))
166
167 #define sctp_sbspace_sub(a,b) ((a > b) ? (a - b) : 0)
168
169 extern int      sctp_sendspace;
170 extern int      sctp_recvspace;
171 extern int      sctp_ecn;
172 extern int      sctp_ecn_nonce;
173
174 struct sctp_nets;
175 struct sctp_inpcb;
176 struct sctp_tcb;
177 struct sctphdr;
178
179 #if defined(__OpenBSD__)
180 void sctp_fasttim(void);
181 #endif
182
183 union netmsg;
184
185 #if defined(__FreeBSD__) || defined(__APPLE__)
186 void    sctp_ctlinput(int, struct sockaddr *, void *);
187 int     sctp_ctloutput(struct socket *, struct sockopt *);
188 void    sctp_input(struct mbuf *, int);
189 #elif defined(__DragonFly__)
190 void    sctp_ctlinput(union netmsg *);
191 void    sctp_ctloutput(union netmsg *);
192 int     sctp_input(struct mbuf **, int *, int);
193 #else
194 void*   sctp_ctlinput(int, struct sockaddr *, void *);
195 int     sctp_ctloutput(int, struct socket *, int, int, struct mbuf **);
196 void    sctp_input(struct mbuf *, ... );
197 #endif
198 void    sctp_drain(void);
199 void    sctp_init(void);
200 void    sctp_shutdown(union netmsg *);
201 void    sctp_notify(struct sctp_inpcb *, int, struct sctphdr *,
202                     struct sockaddr *, struct sctp_tcb *,
203                     struct sctp_nets *);
204 void    sctp_usr_recvd(union netmsg *);
205
206 #if defined(INET6)
207 void ip_2_ip6_hdr(struct ip6_hdr *, struct ip *);
208 #endif
209
210 int sctp_bindx(struct socket *, int, struct sockaddr_storage *,
211         int, int, struct proc *);
212
213 /* can't use sctp_assoc_t here */
214 int sctp_peeloff(struct socket *, struct socket *, int, caddr_t, int *);
215
216
217 sctp_assoc_t sctp_getassocid(struct sockaddr *);
218
219 int sctp_ingetaddr_oncpu(struct socket *, struct sockaddr **);
220 int sctp_peeraddr_oncpu(struct socket *, struct sockaddr **);
221 void sctp_peeraddr(union netmsg *);
222 void sctp_listen(union netmsg *);
223 void sctp_accept(union netmsg *);
224 void sctp_send(union netmsg *);
225
226 #if defined(__NetBSD__) || defined(__OpenBSD__)
227 int sctp_sysctl(int *, u_int, void *, size_t *, void *, size_t);
228 #endif
229
230 /*
231  * compatibility defines for OpenBSD, Apple
232  */
233
234 /* map callout into timeout for OpenBSD */
235 #ifdef __OpenBSD__
236 #ifndef callout_init
237 #define callout_init(args)
238 #define callout_reset(c, ticks, func, arg) \
239 do { \
240         timeout_set((c), (func), (arg)); \
241         timeout_add((c), (ticks)); \
242 } while (0)
243 #define callout_stop(c) timeout_del(c)
244 #define callout_pending(c) timeout_pending(c)
245 #define callout_active(c) timeout_initialized(c)
246 #endif
247 #endif
248
249 /* XXX: Hopefully temporary until APPLE changes to newer defs like other BSDs */
250 #if defined(__APPLE__)
251 #define if_addrlist     if_addrhead
252 #define if_list         if_link
253 #define ifa_list        ifa_link
254 #endif /* __APPLE__ **/
255
256 #endif /* _KERNEL */
257
258 #endif /* !_NETINET_SCTP_VAR_H_ */