socket: Replicate soreceive() to sorecvtcp() for cleanup and optimization
[dragonfly.git] / sys / sys / socketvar.h
CommitLineData
984263bc
MD
1/*-
2 * Copyright (c) 1982, 1986, 1990, 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 * 3. All advertising materials mentioning features or use of this software
14 * must display the following acknowledgement:
15 * This product includes software developed by the University of
16 * California, Berkeley and its contributors.
17 * 4. Neither the name of the University nor the names of its contributors
18 * may be used to endorse or promote products derived from this software
19 * without specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 *
33 * @(#)socketvar.h 8.3 (Berkeley) 2/19/95
f1f552f6 34 * $FreeBSD: src/sys/sys/socketvar.h,v 1.46.2.10 2003/08/24 08:24:39 hsu Exp $
4402d8a2 35 * $DragonFly: src/sys/sys/socketvar.h,v 1.35 2008/08/28 23:15:45 dillon Exp $
984263bc
MD
36 */
37
38#ifndef _SYS_SOCKETVAR_H_
39#define _SYS_SOCKETVAR_H_
40
03d6a592
MD
41#ifndef _SYS_TYPES_H_
42#include <sys/types.h>
43#endif
44#ifndef _SYS_QUEUE_H_
984263bc 45#include <sys/queue.h> /* for TAILQ macros */
03d6a592 46#endif
5b22f1a7
SG
47#ifndef _SYS_EVENT_H_
48#include <sys/event.h> /* for struct kqinfo */
03d6a592 49#endif
6cef7136
MD
50#ifndef _SYS_THREAD_H_
51#include <sys/thread.h> /* for struct lwkt_token */
52#endif
6d49aa6f
MD
53#ifndef _SYS_SOCKBUF_H_
54#include <sys/sockbuf.h>
55#endif
984263bc 56
03d6a592 57#if defined(_KERNEL) || defined(_KERNEL_STRUCTURES)
6d49aa6f 58
acd31a69
SZ
59#ifndef _NET_NETMSG_H_
60#include <net/netmsg.h>
61#endif
62
6d49aa6f
MD
63struct accept_filter;
64
984263bc 65/*
6d49aa6f
MD
66 * Signaling socket buffers contain additional elements for locking
67 * and signaling conditions. These are used primarily by sockets.
14343ad3
MD
68 *
69 * WARNING: See partial clearing of fields in kern/uipc_socket.c
70 * sorflush() and sowflush().
984263bc 71 */
6d49aa6f
MD
72struct signalsockbuf {
73 struct sockbuf sb;
5b22f1a7 74 struct kqinfo ssb_kq; /* process selecting read/write */
14343ad3 75 uint32_t ssb_flags; /* flags, see below (use atomic ops) */
45546849 76 u_int ssb_timeo; /* timeout for read/write */
6d49aa6f
MD
77 long ssb_lowat; /* low water mark */
78 u_long ssb_hiwat; /* high water mark / max actual char count */
79 u_long ssb_mbmax; /* max chars of mbufs to use */
6cef7136 80 struct lwkt_token ssb_token; /* frontend/backend serializer */
6d49aa6f 81};
984263bc 82
6d49aa6f
MD
83#define ssb_cc sb.sb_cc /* commonly used fields */
84#define ssb_mb sb.sb_mb /* commonly used fields */
85#define ssb_mbcnt sb.sb_mbcnt /* commonly used fields */
f786a6ac
SZ
86#define ssb_cc_prealloc sb.sb_cc_prealloc
87#define ssb_mbcnt_prealloc sb.sb_mbcnt_prealloc
6d49aa6f 88
14343ad3
MD
89#define SSB_LOCK 0x0001 /* lock on data queue */
90#define SSB_WANT 0x0002 /* someone is waiting to lock */
91#define SSB_WAIT 0x0004 /* someone is waiting for data/space */
92#define SSB_ASYNC 0x0010 /* ASYNC I/O, need signals */
93#define SSB_UPCALL 0x0020 /* someone wants an upcall */
94#define SSB_NOINTR 0x0040 /* operations not interruptible */
91bcbcd6 95/*#define SSB_AIO 0x0080*/ /* AIO operations queued */
14343ad3
MD
96#define SSB_KNOTE 0x0100 /* kernel note attached */
97#define SSB_MEVENT 0x0200 /* need message event notification */
98#define SSB_STOP 0x0400 /* backpressure indicator */
99#define SSB_AUTOSIZE 0x0800 /* automatically size socket buffer */
dbcbe5d3 100#define SSB_AUTOLOWAT 0x1000 /* automatically scale lowat */
14343ad3
MD
101#define SSB_WAKEUP 0x2000 /* wakeup event race */
102
103#define SSB_CLEAR_MASK (SSB_ASYNC | SSB_UPCALL | SSB_STOP | \
104 SSB_AUTOSIZE | SSB_AUTOLOWAT)
105
106#define SSB_NOTIFY_MASK (SSB_WAIT | SSB_ASYNC | SSB_UPCALL | \
91bcbcd6 107 SSB_KNOTE | SSB_MEVENT)
984263bc 108
6d49aa6f
MD
109/*
110 * Per-socket kernel structure. Contains universal send and receive queues,
111 * protocol control handle, and error information.
112 */
984263bc
MD
113struct socket {
114 short so_type; /* generic type, see socket.h */
115 short so_options; /* from socket call, see socket.h */
116 short so_linger; /* time to linger while closing */
117 short so_state; /* internal state flags SS_*, below */
ef87f48d 118 void *so_pcb; /* protocol control block */
984263bc 119 struct protosw *so_proto; /* protocol handle */
984263bc 120 struct socket *so_head; /* back pointer to accept socket */
48e7b118 121 lwkt_port_t so_port; /* message port */
6d49aa6f
MD
122
123 /*
124 * These fields are used to manage sockets capable of accepting
125 * new connections.
126 */
127 TAILQ_HEAD(, socket) so_incomp; /* in-progress, incomplete */
128 TAILQ_HEAD(, socket) so_comp; /* completed but not yet accepted */
984263bc 129 TAILQ_ENTRY(socket) so_list; /* list of unaccepted connections */
6d49aa6f
MD
130 short so_qlen; /* so_comp count */
131 short so_incqlen; /* so_incomp count */
984263bc 132 short so_qlimit; /* max number queued connections */
6d49aa6f
MD
133
134 /*
135 * Misc socket support
136 */
984263bc
MD
137 short so_timeo; /* connection timeout */
138 u_short so_error; /* error affecting connection */
139 struct sigio *so_sigio; /* information for async I/O or
140 out of band data (SIGURG) */
141 u_long so_oobmark; /* chars to oob mark */
142 TAILQ_HEAD(, aiocblist) so_aiojobq; /* AIO ops waiting on socket */
6d49aa6f
MD
143 struct signalsockbuf so_rcv;
144 struct signalsockbuf so_snd;
984263bc 145
b153f746 146 void (*so_upcall) (struct socket *, void *, int);
984263bc
MD
147 void *so_upcallarg;
148 struct ucred *so_cred; /* user credentials */
149 /* NB: generation count must not be first; easiest to make it last. */
984263bc 150 void *so_emuldata; /* private data for emulators */
6cef7136 151 int so_refs; /* shutdown refs */
984263bc
MD
152 struct so_accf {
153 struct accept_filter *so_accept_filter;
154 void *so_accept_filter_arg; /* saved filter args */
155 char *so_accept_filter_str; /* saved user args */
156 } *so_accf;
acd31a69
SZ
157
158 struct netmsg_base so_clomsg;
88da6203 159 struct sockaddr *so_faddr;
984263bc
MD
160};
161
03d6a592
MD
162#endif
163
984263bc
MD
164/*
165 * Socket state bits.
6cef7136
MD
166 *
167 * NOTE: The following states are interlocked with so_refs:
168 *
169 * SS_NOFDREF so_refs while not set
170 * (so_pcb) so_refs while set
984263bc
MD
171 */
172#define SS_NOFDREF 0x0001 /* no file table ref any more */
173#define SS_ISCONNECTED 0x0002 /* socket connected to a peer */
174#define SS_ISCONNECTING 0x0004 /* in process of connecting to peer */
175#define SS_ISDISCONNECTING 0x0008 /* in process of disconnecting */
176#define SS_CANTSENDMORE 0x0010 /* can't send more data to peer */
177#define SS_CANTRCVMORE 0x0020 /* can't receive more data from peer */
178#define SS_RCVATMARK 0x0040 /* at mark on input */
179
e28d8186 180#define SS_ASSERTINPROG 0x0100 /* sonewconn race debugging */
984263bc
MD
181#define SS_ASYNC 0x0200 /* async i/o notify */
182#define SS_ISCONFIRMING 0x0400 /* deciding to accept connection req */
183
184#define SS_INCOMP 0x0800 /* unaccepted, incomplete connection */
185#define SS_COMP 0x1000 /* unaccepted, complete connection */
186#define SS_ISDISCONNECTED 0x2000 /* socket disconnected from peer */
187
188/*
189 * Externalized form of struct socket used by the sysctl(3) interface.
190 */
191struct xsocket {
192 size_t xso_len; /* length of this structure */
193 struct socket *xso_so; /* makes a convenient handle sometimes */
194 short so_type;
195 short so_options;
196 short so_linger;
197 short so_state;
ef87f48d 198 void *so_pcb; /* another convenient handle */
984263bc
MD
199 int xso_protocol;
200 int xso_family;
201 short so_qlen;
202 short so_incqlen;
203 short so_qlimit;
204 short so_timeo;
205 u_short so_error;
206 pid_t so_pgid;
207 u_long so_oobmark;
208 struct xsockbuf {
209 u_long sb_cc;
210 u_long sb_hiwat;
211 u_long sb_mbcnt;
212 u_long sb_mbmax;
213 long sb_lowat;
45546849 214 u_int sb_timeo;
984263bc 215 short sb_flags;
984263bc
MD
216 } so_rcv, so_snd;
217 uid_t so_uid; /* XXX */
218};
219
220/*
221 * Macros for sockets and socket buffering.
222 */
223
984263bc
MD
224#define sosendallatonce(so) \
225 ((so)->so_proto->pr_flags & PR_ATOMIC)
226
227/* can we read something from so? */
228#define soreadable(so) \
6d49aa6f 229 ((so)->so_rcv.ssb_cc >= (so)->so_rcv.ssb_lowat || \
984263bc 230 ((so)->so_state & SS_CANTRCVMORE) || \
ecd80f47 231 !TAILQ_EMPTY(&(so)->so_comp) || (so)->so_error)
984263bc
MD
232
233/* can we write something to so? */
234#define sowriteable(so) \
6d49aa6f 235 ((ssb_space(&(so)->so_snd) >= (so)->so_snd.ssb_lowat && \
984263bc
MD
236 (((so)->so_state&SS_ISCONNECTED) || \
237 ((so)->so_proto->pr_flags&PR_CONNREQUIRED)==0)) || \
238 ((so)->so_state & SS_CANTSENDMORE) || \
239 (so)->so_error)
240
6d49aa6f
MD
241/*
242 * Do we need to notify the other side when I/O is possible?
14343ad3
MD
243 *
244 * NOTE: Interlock for ssb_wait/wakeup. The protocol side will set
245 * SSB_WAKEUP asynchronously and this can race, so if it isn't
246 * set we have to go through the full-on notification check.
247 * If it is set but no waiting ever takes place it simply
248 * remains set.
6d49aa6f 249 */
14343ad3
MD
250#define ssb_notify(ssb) \
251 (((ssb)->ssb_flags & SSB_NOTIFY_MASK) || \
252 ((ssb)->ssb_flags & SSB_WAKEUP) == 0)
984263bc 253
6d49aa6f 254/* do we have to send all at once on a socket? */
984263bc 255
0efd86dd
MD
256#ifdef _KERNEL
257
6d49aa6f
MD
258/*
259 * How much space is there in a socket buffer (so->so_snd or so->so_rcv)?
260 * This is problematical if the fields are unsigned, as the space might
261 * still be negative (cc > hiwat or mbcnt > mbmax). Should detect
3a6117bb
MD
262 * overflow and return 0.
263 *
264 * SSB_STOP ignores cc/hiwat and returns 0. This is used by unix domain
265 * stream sockets to signal backpressure.
6d49aa6f 266 */
3a6117bb
MD
267static __inline
268long
269ssb_space(struct signalsockbuf *ssb)
270{
271 long bleft;
272 long mleft;
273
274 if (ssb->ssb_flags & SSB_STOP)
275 return(0);
276 bleft = ssb->ssb_hiwat - ssb->ssb_cc;
277 mleft = ssb->ssb_mbmax - ssb->ssb_mbcnt;
278 return((bleft < mleft) ? bleft : mleft);
279}
6d49aa6f 280
f786a6ac
SZ
281static __inline long
282ssb_space_prealloc(struct signalsockbuf *ssb)
283{
284 long bleft, bleft_prealloc;
285 long mleft, mleft_prealloc;
286
287 if (ssb->ssb_flags & SSB_STOP)
288 return(0);
289
290 bleft = ssb->ssb_hiwat - ssb->ssb_cc;
291 bleft_prealloc = ssb->ssb_hiwat - ssb->ssb_cc_prealloc;
292 if (bleft_prealloc < bleft)
293 bleft = bleft_prealloc;
294
295 mleft = ssb->ssb_mbmax - ssb->ssb_mbcnt;
296 mleft_prealloc = ssb->ssb_mbmax - ssb->ssb_mbcnt_prealloc;
297 if (mleft_prealloc < mleft)
298 mleft = mleft_prealloc;
299
300 return((bleft < mleft) ? bleft : mleft);
301}
302
303/*
304 * NOTE: Only works w/ later ssb_appendstream() on m
305 */
306static __inline void
307ssb_preallocstream(struct signalsockbuf *ssb, struct mbuf *m)
308{
309 if (m->m_len == 0)
310 return;
311 sbprealloc(&ssb->sb, m);
312}
313
0efd86dd
MD
314#endif
315
6d49aa6f
MD
316#define ssb_append(ssb, m) \
317 sbappend(&(ssb)->sb, m)
318
319#define ssb_appendstream(ssb, m) \
320 sbappendstream(&(ssb)->sb, m)
321
322#define ssb_appendrecord(ssb, m) \
323 sbappendrecord(&(ssb)->sb, m)
324
325#define ssb_appendaddr(ssb, src, m, control) \
ee38db90 326 ((ssb_space(ssb) <= 0) ? 0 : sbappendaddr(&(ssb)->sb, src, m, control))
6d49aa6f
MD
327
328#define ssb_appendcontrol(ssb, m, control) \
ee38db90 329 ((ssb_space(ssb) <= 0) ? 0 : sbappendcontrol(&(ssb)->sb, m, control))
6d49aa6f
MD
330
331#define ssb_insert_knote(ssb, kn) { \
14343ad3
MD
332 knote_insert(&(ssb)->ssb_kq.ki_note, kn); \
333 atomic_set_int(&(ssb)->ssb_flags, SSB_KNOTE); \
6d49aa6f
MD
334}
335
336#define ssb_remove_knote(ssb, kn) { \
14343ad3 337 knote_remove(&(ssb)->ssb_kq.ki_note, kn); \
5b22f1a7 338 if (SLIST_EMPTY(&(ssb)->ssb_kq.ki_note)) \
14343ad3 339 atomic_clear_int(&(ssb)->ssb_flags, SSB_KNOTE); \
6d49aa6f
MD
340}
341
14343ad3
MD
342#define sorwakeup(so) \
343 do { \
344 if (ssb_notify(&(so)->so_rcv)) \
345 sowakeup((so), &(so)->so_rcv); \
346 } while (0)
347
348#define sowwakeup(so) \
349 do { \
350 if (ssb_notify(&(so)->so_snd)) \
351 sowakeup((so), &(so)->so_snd); \
352 } while (0)
984263bc
MD
353
354#ifdef _KERNEL
355
356/*
357 * Argument structure for sosetopt et seq. This is in the KERNEL
358 * section because it will never be visible to user code.
359 */
360enum sopt_dir { SOPT_GET, SOPT_SET };
361struct sockopt {
362 enum sopt_dir sopt_dir; /* is this a get or a set? */
363 int sopt_level; /* second arg of [gs]etsockopt */
364 int sopt_name; /* third arg of [gs]etsockopt */
365 void *sopt_val; /* fourth arg of [gs]etsockopt */
366 size_t sopt_valsize; /* (almost) fifth arg of [gs]etsockopt */
dadab5e9 367 struct thread *sopt_td; /* calling thread or null if kernel */
984263bc
MD
368};
369
984263bc
MD
370struct accept_filter {
371 char accf_name[16];
372 void (*accf_callback)
b153f746 373 (struct socket *so, void *arg, int waitflag);
984263bc 374 void * (*accf_create)
b153f746 375 (struct socket *so, char *arg);
984263bc 376 void (*accf_destroy)
b153f746 377 (struct socket *so);
984263bc
MD
378 SLIST_ENTRY(accept_filter) accf_next; /* next on the list */
379};
380
381#ifdef MALLOC_DECLARE
382MALLOC_DECLARE(M_PCB);
383MALLOC_DECLARE(M_SONAME);
384MALLOC_DECLARE(M_ACCF);
385#endif
386
387extern int maxsockets;
e9855d6b
MD
388extern u_long sb_max; /* nominal limit */
389extern u_long sb_max_adj; /* actual limit used by sbreserve() */
984263bc
MD
390
391struct file;
392struct filedesc;
393struct mbuf;
e4700d00 394struct rlimit;
984263bc
MD
395struct sockaddr;
396struct stat;
397struct ucred;
398struct uio;
399struct knote;
87baaf0c 400struct sysmsg;
984263bc
MD
401
402/*
403 * File operations on sockets.
404 */
b153f746 405int soo_read (struct file *fp, struct uio *uio, struct ucred *cred,
87baaf0c 406 int flags);
b153f746 407int soo_write (struct file *fp, struct uio *uio, struct ucred *cred,
87baaf0c 408 int flags);
87de5057
MD
409int soo_close (struct file *fp);
410int soo_shutdown (struct file *fp, int how);
b153f746 411int soo_ioctl (struct file *fp, u_long cmd, caddr_t data,
87baaf0c 412 struct ucred *cred, struct sysmsg *msg);
87de5057 413int soo_stat (struct file *fp, struct stat *ub, struct ucred *cred);
b153f746 414int sokqfilter (struct file *fp, struct knote *kn);
984263bc
MD
415
416/*
417 * From uipc_socket and friends
418 */
590b8cd4 419struct sockaddr *dup_sockaddr (const struct sockaddr *sa);
b153f746 420int getsockaddr (struct sockaddr **namp, caddr_t uaddr, size_t len);
6d49aa6f
MD
421
422void ssb_release (struct signalsockbuf *ssb, struct socket *so);
423int ssb_reserve (struct signalsockbuf *ssb, u_long cc, struct socket *so,
e4700d00 424 struct rlimit *rl);
6d49aa6f
MD
425void ssbtoxsockbuf (struct signalsockbuf *sb, struct xsockbuf *xsb);
426int ssb_wait (struct signalsockbuf *sb);
427int _ssb_lock (struct signalsockbuf *sb);
428
4402d8a2
MD
429void soabort (struct socket *so);
430void soaborta (struct socket *so);
fd86a41c 431void soabort_oncpu (struct socket *so);
b153f746 432int soaccept (struct socket *so, struct sockaddr **nam);
88da6203 433void soaccept_generic (struct socket *so);
b153f746
RG
434struct socket *soalloc (int waitok);
435int sobind (struct socket *so, struct sockaddr *nam, struct thread *td);
436void socantrcvmore (struct socket *so);
437void socantsendmore (struct socket *so);
8b5c39bb 438int socket_wait (struct socket *so, struct timespec *ts, int *res);
9ba76b73 439int soclose (struct socket *so, int fflags);
b153f746
RG
440int soconnect (struct socket *so, struct sockaddr *nam, struct thread *td);
441int soconnect2 (struct socket *so1, struct socket *so2);
442int socreate (int dom, struct socket **aso, int type, int proto,
443 struct thread *td);
b153f746
RG
444int sodisconnect (struct socket *so);
445void sofree (struct socket *so);
446int sogetopt (struct socket *so, struct sockopt *sopt);
447void sohasoutofband (struct socket *so);
448void soisconnected (struct socket *so);
449void soisconnecting (struct socket *so);
450void soisdisconnected (struct socket *so);
451void soisdisconnecting (struct socket *so);
0f2e13ef
SG
452void soisreconnected (struct socket *so);
453void soisreconnecting (struct socket *so);
48e7b118 454void sosetport (struct socket *so, struct lwkt_port *port);
b153f746
RG
455int solisten (struct socket *so, int backlog, struct thread *td);
456struct socket *sonewconn (struct socket *head, int connstatus);
88da6203
SZ
457struct socket *sonewconn_faddr (struct socket *head, int connstatus,
458 const struct sockaddr *faddr);
b153f746
RG
459int sooptcopyin (struct sockopt *sopt, void *buf, size_t len,
460 size_t minlen);
e71a125f
AE
461int soopt_to_kbuf (struct sockopt *sopt, void *buf, size_t len,
462 size_t minlen);
f1f552f6 463int sooptcopyout (struct sockopt *sopt, const void *buf, size_t len);
e71a125f 464void soopt_from_kbuf (struct sockopt *sopt, const void *buf, size_t len);
984263bc
MD
465
466/* XXX; prepare mbuf for (__FreeBSD__ < 3) routines. */
b153f746
RG
467int soopt_getm (struct sockopt *sopt, struct mbuf **mp);
468int soopt_mcopyin (struct sockopt *sopt, struct mbuf *m);
e71a125f 469void soopt_to_mbuf (struct sockopt *sopt, struct mbuf *m);
b153f746 470int soopt_mcopyout (struct sockopt *sopt, struct mbuf *m);
e71a125f 471int soopt_from_mbuf (struct sockopt *sopt, struct mbuf *m);
984263bc 472
b153f746 473int soreceive (struct socket *so, struct sockaddr **paddr,
6d49aa6f 474 struct uio *uio, struct sockbuf *sio,
b153f746 475 struct mbuf **controlp, int *flagsp);
9510c423
SZ
476int sorecvtcp (struct socket *so, struct sockaddr **paddr,
477 struct uio *uio, struct sockbuf *sio,
478 struct mbuf **controlp, int *flagsp);
e4700d00
JH
479int soreserve (struct socket *so, u_long sndcc, u_long rcvcc,
480 struct rlimit *rl);
b153f746
RG
481void sorflush (struct socket *so);
482int sosend (struct socket *so, struct sockaddr *addr, struct uio *uio,
984263bc 483 struct mbuf *top, struct mbuf *control, int flags,
b153f746 484 struct thread *td);
6ea1e9b9
JH
485int sosendudp (struct socket *so, struct sockaddr *addr, struct uio *uio,
486 struct mbuf *top, struct mbuf *control, int flags,
487 struct thread *td);
5bc42dd1
SZ
488int sosendtcp (struct socket *so, struct sockaddr *addr, struct uio *uio,
489 struct mbuf *top, struct mbuf *control, int flags,
490 struct thread *td);
b153f746
RG
491int sosetopt (struct socket *so, struct sockopt *sopt);
492int soshutdown (struct socket *so, int how);
493void sotoxsocket (struct socket *so, struct xsocket *xso);
6d49aa6f 494void sowakeup (struct socket *so, struct signalsockbuf *sb);
984263bc
MD
495
496/* accept filter functions */
b153f746
RG
497int accept_filt_add (struct accept_filter *filt);
498int accept_filt_del (char *name);
499struct accept_filter * accept_filt_get (char *name);
984263bc 500#ifdef ACCEPT_FILTER_MOD
b153f746 501int accept_filt_generic_mod_event (module_t mod, int event, void *data);
984263bc
MD
502SYSCTL_DECL(_net_inet_accf);
503#endif /* ACCEPT_FILTER_MOD */
504
505#endif /* _KERNEL */
506
507#endif /* !_SYS_SOCKETVAR_H_ */