socketvar.h revision 61837
1191450Smarcel/*-
2191450Smarcel * Copyright (c) 1982, 1986, 1990, 1993
3191450Smarcel *	The Regents of the University of California.  All rights reserved.
4191450Smarcel *
5191450Smarcel * Redistribution and use in source and binary forms, with or without
6191450Smarcel * modification, are permitted provided that the following conditions
7191450Smarcel * are met:
8191450Smarcel * 1. Redistributions of source code must retain the above copyright
9191450Smarcel *    notice, this list of conditions and the following disclaimer.
10191450Smarcel * 2. Redistributions in binary form must reproduce the above copyright
11191450Smarcel *    notice, this list of conditions and the following disclaimer in the
12191450Smarcel *    documentation and/or other materials provided with the distribution.
13191450Smarcel * 3. All advertising materials mentioning features or use of this software
14191450Smarcel *    must display the following acknowledgement:
15191450Smarcel *	This product includes software developed by the University of
16191450Smarcel *	California, Berkeley and its contributors.
17191450Smarcel * 4. Neither the name of the University nor the names of its contributors
18191450Smarcel *    may be used to endorse or promote products derived from this software
19191450Smarcel *    without specific prior written permission.
20191450Smarcel *
21191450Smarcel * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22191450Smarcel * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23191450Smarcel * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24191450Smarcel * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25191450Smarcel * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26191450Smarcel * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27191450Smarcel * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28191450Smarcel * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29191450Smarcel * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30191450Smarcel * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31224552Smarcel * SUCH DAMAGE.
32224552Smarcel *
33191450Smarcel *	@(#)socketvar.h	8.3 (Berkeley) 2/19/95
34191450Smarcel * $FreeBSD: head/sys/sys/socketvar.h 61837 2000-06-20 01:09:23Z alfred $
35191450Smarcel */
36191450Smarcel
37191450Smarcel#ifndef _SYS_SOCKETVAR_H_
38191450Smarcel#define _SYS_SOCKETVAR_H_
39191450Smarcel
40191450Smarcel#include <sys/queue.h>			/* for TAILQ macros */
41209908Sraj#include <sys/select.h>			/* for struct selinfo */
42191450Smarcel
43191450Smarcel/*
44191450Smarcel * Kernel structure per socket.
45191450Smarcel * Contains send and receive buffer queues,
46191450Smarcel * handle on protocol and pointer to protocol
47191450Smarcel * private data and error information.
48191450Smarcel */
49191450Smarceltypedef	u_quad_t so_gen_t;
50191450Smarcel
51191450Smarcelstruct accept_filter;
52191450Smarcel
53191450Smarcelstruct socket {
54191450Smarcel	struct	vm_zone *so_zone;	/* zone we were allocated from */
55191450Smarcel	short	so_type;		/* generic type, see socket.h */
56191450Smarcel	short	so_options;		/* from socket call, see socket.h */
57191450Smarcel	short	so_linger;		/* time to linger while closing */
58191450Smarcel	short	so_state;		/* internal state flags SS_*, below */
59191450Smarcel	caddr_t	so_pcb;			/* protocol control block */
60191450Smarcel	struct	protosw *so_proto;	/* protocol handle */
61191450Smarcel/*
62191450Smarcel * Variables for connection queuing.
63191450Smarcel * Socket where accepts occur is so_head in all subsidiary sockets.
64191450Smarcel * If so_head is 0, socket is not related to an accept.
65191450Smarcel * For head socket so_q0 queues partially completed connections,
66191450Smarcel * while so_q is a queue of connections ready to be accepted.
67191450Smarcel * If a connection is aborted and it has so_head set, then
68191450Smarcel * it has to be pulled out of either so_q0 or so_q.
69191450Smarcel * We allow connections to queue up based on current queue lengths
70191450Smarcel * and limit on number of queued connections for this socket.
71191450Smarcel */
72191450Smarcel	struct	socket *so_head;	/* back pointer to accept socket */
73191450Smarcel	TAILQ_HEAD(, socket) so_incomp;	/* queue of partial unaccepted connections */
74191450Smarcel	TAILQ_HEAD(, socket) so_comp;	/* queue of complete unaccepted connections */
75191450Smarcel	TAILQ_ENTRY(socket) so_list;	/* list of unaccepted connections */
76191450Smarcel	short	so_qlen;		/* number of unaccepted connections */
77191450Smarcel	short	so_incqlen;		/* number of unaccepted incomplete
78191450Smarcel					   connections */
79191450Smarcel	short	so_qlimit;		/* max number queued connections */
80191450Smarcel	short	so_timeo;		/* connection timeout */
81191450Smarcel	u_short	so_error;		/* error affecting connection */
82257059Snwhitehorn	struct  sigio *so_sigio;	/* information for async I/O or
83257059Snwhitehorn					   out of band data (SIGURG) */
84257059Snwhitehorn	u_long	so_oobmark;		/* chars to oob mark */
85191450Smarcel	TAILQ_HEAD(, aiocblist) so_aiojobq; /* AIO ops waiting on socket */
86191450Smarcel/*
87191450Smarcel * Variables for socket buffering.
88191450Smarcel */
89191450Smarcel	struct	sockbuf {
90191450Smarcel		u_long	sb_cc;		/* actual chars in buffer */
91191450Smarcel		u_long	sb_hiwat;	/* max actual char count */
92191450Smarcel		u_long	sb_mbcnt;	/* chars of mbufs used */
93191450Smarcel		u_long	sb_mbmax;	/* max chars of mbufs to use */
94191450Smarcel		long	sb_lowat;	/* low water mark */
95191450Smarcel		struct	mbuf *sb_mb;	/* the mbuf chain */
96191450Smarcel		struct	selinfo sb_sel;	/* process selecting read/write */
97191450Smarcel		short	sb_flags;	/* flags, see below */
98191450Smarcel		short	sb_timeo;	/* timeout for read/write */
99191450Smarcel	} so_rcv, so_snd;
100257059Snwhitehorn#define	SB_MAX		(256*1024)	/* default for max chars in sockbuf */
101257059Snwhitehorn#define	SB_LOCK		0x01		/* lock on data queue */
102191450Smarcel#define	SB_WANT		0x02		/* someone is waiting to lock */
103191450Smarcel#define	SB_WAIT		0x04		/* someone is waiting for data/space */
104191450Smarcel#define	SB_SEL		0x08		/* someone is selecting */
105191450Smarcel#define	SB_ASYNC	0x10		/* ASYNC I/O, need signals */
106191450Smarcel#define	SB_UPCALL	0x20		/* someone wants an upcall */
107191450Smarcel#define	SB_NOINTR	0x40		/* operations not interruptible */
108191450Smarcel#define SB_AIO		0x80		/* AIO operations queued */
109191450Smarcel#define SB_KNOTE	0x100		/* kernel note attached */
110191450Smarcel
111191450Smarcel	void	(*so_upcall) __P((struct socket *, void *, int));
112191450Smarcel	void	*so_upcallarg;
113191450Smarcel	struct	ucred *so_cred;		/* user credentials */
114191450Smarcel	/* NB: generation count must not be first; easiest to make it last. */
115191450Smarcel	so_gen_t so_gencnt;		/* generation count */
116191450Smarcel	void	*so_emuldata;		/* private data for emulators */
117191450Smarcel	struct	so_accf {
118191450Smarcel		struct	accept_filter *so_accept_filter;
119191450Smarcel		void	*so_accept_filter_arg;	/* saved filter args */
120191450Smarcel		char	*so_accept_filter_str;	/* saved user args */
121191450Smarcel	} *so_accf;
122191450Smarcel};
123191450Smarcel
124191450Smarcel/*
125191450Smarcel * Socket state bits.
126191450Smarcel */
127191450Smarcel#define	SS_NOFDREF		0x0001	/* no file table ref any more */
128191450Smarcel#define	SS_ISCONNECTED		0x0002	/* socket connected to a peer */
129191450Smarcel#define	SS_ISCONNECTING		0x0004	/* in process of connecting to peer */
130191450Smarcel#define	SS_ISDISCONNECTING	0x0008	/* in process of disconnecting */
131191450Smarcel#define	SS_CANTSENDMORE		0x0010	/* can't send more data to peer */
132191450Smarcel#define	SS_CANTRCVMORE		0x0020	/* can't receive more data from peer */
133191450Smarcel#define	SS_RCVATMARK		0x0040	/* at mark on input */
134191450Smarcel
135191450Smarcel#define	SS_NBIO			0x0100	/* non-blocking ops */
136191450Smarcel#define	SS_ASYNC		0x0200	/* async i/o notify */
137191450Smarcel#define	SS_ISCONFIRMING		0x0400	/* deciding to accept connection req */
138191450Smarcel
139191450Smarcel#define	SS_INCOMP		0x0800	/* unaccepted, incomplete connection */
140191450Smarcel#define	SS_COMP			0x1000	/* unaccepted, complete connection */
141191450Smarcel#define	SS_ISDISCONNECTED	0x2000	/* socket disconnected from peer */
142209493Smarcel
143191450Smarcel/*
144191450Smarcel * Externalized form of struct socket used by the sysctl(3) interface.
145191450Smarcel */
146191450Smarcelstruct	xsocket {
147191450Smarcel	size_t	xso_len;	/* length of this structure */
148191450Smarcel	struct	socket *xso_so;	/* makes a convenient handle sometimes */
149191450Smarcel	short	so_type;
150191450Smarcel	short	so_options;
151191450Smarcel	short	so_linger;
152191450Smarcel	short	so_state;
153191450Smarcel	caddr_t	so_pcb;		/* another convenient handle */
154191450Smarcel	int	xso_protocol;
155191450Smarcel	int	xso_family;
156191450Smarcel	short	so_qlen;
157191450Smarcel	short	so_incqlen;
158191450Smarcel	short	so_qlimit;
159218075Smarcel	short	so_timeo;
160191450Smarcel	u_short	so_error;
161191450Smarcel	pid_t	so_pgid;
162191450Smarcel	u_long	so_oobmark;
163191450Smarcel	struct	xsockbuf {
164191450Smarcel		u_long	sb_cc;
165191450Smarcel		u_long	sb_hiwat;
166191450Smarcel		u_long	sb_mbcnt;
167191450Smarcel		u_long	sb_mbmax;
168191450Smarcel		long	sb_lowat;
169191450Smarcel		short	sb_flags;
170191450Smarcel		short	sb_timeo;
171191450Smarcel	} so_rcv, so_snd;
172191450Smarcel	uid_t	so_uid;		/* XXX */
173191450Smarcel};
174191450Smarcel
175191450Smarcel/*
176191450Smarcel * Macros for sockets and socket buffering.
177191450Smarcel */
178191450Smarcel
179191450Smarcel/*
180191450Smarcel * Do we need to notify the other side when I/O is possible?
181191450Smarcel */
182191450Smarcel#define	sb_notify(sb)	(((sb)->sb_flags & (SB_WAIT | SB_SEL | SB_ASYNC | \
183191450Smarcel    SB_UPCALL | SB_AIO | SB_KNOTE)) != 0)
184191450Smarcel
185191450Smarcel/*
186191450Smarcel * How much space is there in a socket buffer (so->so_snd or so->so_rcv)?
187191450Smarcel * This is problematical if the fields are unsigned, as the space might
188191450Smarcel * still be negative (cc > hiwat or mbcnt > mbmax).  Should detect
189191450Smarcel * overflow and return 0.  Should use "lmin" but it doesn't exist now.
190191450Smarcel */
191191450Smarcel#define	sbspace(sb) \
192191450Smarcel    ((long) imin((int)((sb)->sb_hiwat - (sb)->sb_cc), \
193191450Smarcel	 (int)((sb)->sb_mbmax - (sb)->sb_mbcnt)))
194191450Smarcel
195191450Smarcel/* do we have to send all at once on a socket? */
196191450Smarcel#define	sosendallatonce(so) \
197191450Smarcel    ((so)->so_proto->pr_flags & PR_ATOMIC)
198191450Smarcel
199191450Smarcel/* can we read something from so? */
200191450Smarcel#define	soreadable(so) \
201191450Smarcel    ((so)->so_rcv.sb_cc >= (so)->so_rcv.sb_lowat || \
202191450Smarcel	((so)->so_state & SS_CANTRCVMORE) || \
203191450Smarcel	(so)->so_comp.tqh_first || (so)->so_error)
204191450Smarcel
205191450Smarcel/* can we write something to so? */
206191450Smarcel#define	sowriteable(so) \
207191450Smarcel    ((sbspace(&(so)->so_snd) >= (so)->so_snd.sb_lowat && \
208191450Smarcel	(((so)->so_state&SS_ISCONNECTED) || \
209191450Smarcel	  ((so)->so_proto->pr_flags&PR_CONNREQUIRED)==0)) || \
210191450Smarcel     ((so)->so_state & SS_CANTSENDMORE) || \
211191450Smarcel     (so)->so_error)
212191450Smarcel
213191450Smarcel/* adjust counters in sb reflecting allocation of m */
214191450Smarcel#define	sballoc(sb, m) { \
215191450Smarcel	(sb)->sb_cc += (m)->m_len; \
216191450Smarcel	(sb)->sb_mbcnt += MSIZE; \
217191450Smarcel	if ((m)->m_flags & M_EXT) \
218193144Smarcel		(sb)->sb_mbcnt += (m)->m_ext.ext_size; \
219209493Smarcel}
220191450Smarcel
221191450Smarcel/* adjust counters in sb reflecting freeing of m */
222191450Smarcel#define	sbfree(sb, m) { \
223191450Smarcel	(sb)->sb_cc -= (m)->m_len; \
224191450Smarcel	(sb)->sb_mbcnt -= MSIZE; \
225191450Smarcel	if ((m)->m_flags & M_EXT) \
226218075Smarcel		(sb)->sb_mbcnt -= (m)->m_ext.ext_size; \
227191450Smarcel}
228191450Smarcel
229191450Smarcel/*
230191450Smarcel * Set lock on sockbuf sb; sleep if lock is already held.
231191450Smarcel * Unless SB_NOINTR is set on sockbuf, sleep is interruptible.
232191450Smarcel * Returns error without lock if sleep is interrupted.
233191450Smarcel */
234191450Smarcel#define sblock(sb, wf) ((sb)->sb_flags & SB_LOCK ? \
235191450Smarcel		(((wf) == M_WAITOK) ? sb_lock(sb) : EWOULDBLOCK) : \
236191450Smarcel		((sb)->sb_flags |= SB_LOCK), 0)
237191450Smarcel
238191450Smarcel/* release lock on sockbuf sb */
239191450Smarcel#define	sbunlock(sb) { \
240191450Smarcel	(sb)->sb_flags &= ~SB_LOCK; \
241191450Smarcel	if ((sb)->sb_flags & SB_WANT) { \
242191450Smarcel		(sb)->sb_flags &= ~SB_WANT; \
243191450Smarcel		wakeup((caddr_t)&(sb)->sb_flags); \
244191450Smarcel	} \
245191450Smarcel}
246191450Smarcel
247191450Smarcel#define	sorwakeup(so)	do { \
248191450Smarcel			  if (sb_notify(&(so)->so_rcv)) \
249191450Smarcel			    sowakeup((so), &(so)->so_rcv); \
250191450Smarcel			} while (0)
251191450Smarcel
252191450Smarcel#define	sowwakeup(so)	do { \
253191450Smarcel			  if (sb_notify(&(so)->so_snd)) \
254191450Smarcel			    sowakeup((so), &(so)->so_snd); \
255191450Smarcel			} while (0)
256191450Smarcel
257191450Smarcel#ifdef _KERNEL
258191450Smarcel
259191450Smarcel/*
260191450Smarcel * Argument structure for sosetopt et seq.  This is in the KERNEL
261191450Smarcel * section because it will never be visible to user code.
262191450Smarcel */
263191450Smarcelenum sopt_dir { SOPT_GET, SOPT_SET };
264191450Smarcelstruct sockopt {
265191450Smarcel	enum	sopt_dir sopt_dir; /* is this a get or a set? */
266191450Smarcel	int	sopt_level;	/* second arg of [gs]etsockopt */
267191450Smarcel	int	sopt_name;	/* third arg of [gs]etsockopt */
268191450Smarcel	void   *sopt_val;	/* fourth arg of [gs]etsockopt */
269191450Smarcel	size_t	sopt_valsize;	/* (almost) fifth arg of [gs]etsockopt */
270191450Smarcel	struct	proc *sopt_p;	/* calling process or null if kernel */
271191450Smarcel};
272191450Smarcel
273191450Smarcelstruct sf_buf {
274191450Smarcel	SLIST_ENTRY(sf_buf) free_list;	/* list of free buffer slots */
275191450Smarcel	int		refcnt;		/* reference count */
276191450Smarcel	struct		vm_page *m;	/* currently mapped page */
277191450Smarcel	vm_offset_t	kva;		/* va of mapping */
278191450Smarcel};
279191450Smarcel
280191450Smarcelstruct accept_filter {
281191450Smarcel	char	accf_name[16];
282191450Smarcel	void	(*accf_callback)
283191450Smarcel		__P((struct socket *so, void *arg, int waitflag));
284191450Smarcel	void *	(*accf_create)
285191450Smarcel		__P((struct socket *so, char *arg));
286191450Smarcel	void	(*accf_destroy)
287191450Smarcel		__P((struct socket *so));
288191450Smarcel	SLIST_ENTRY(accept_filter) accf_next;	/* next on the list */
289191450Smarcel};
290191450Smarcel
291191450Smarcel#ifdef MALLOC_DECLARE
292191450SmarcelMALLOC_DECLARE(M_PCB);
293191450SmarcelMALLOC_DECLARE(M_SONAME);
294191450SmarcelMALLOC_DECLARE(M_ACCF);
295191450Smarcel#endif
296191450Smarcel
297191450Smarcelextern int	maxsockets;
298191450Smarcelextern u_long	sb_max;
299191450Smarcelextern struct	vm_zone *socket_zone;
300191450Smarcelextern so_gen_t so_gencnt;
301191450Smarcel
302191450Smarcelstruct file;
303191450Smarcelstruct filedesc;
304191450Smarcelstruct mbuf;
305191450Smarcelstruct sockaddr;
306191450Smarcelstruct stat;
307191450Smarcelstruct ucred;
308191450Smarcelstruct uio;
309191450Smarcel
310191450Smarcel/*
311191450Smarcel * File operations on sockets.
312191450Smarcel */
313191450Smarcelint	soo_read __P((struct file *fp, struct uio *uio, struct ucred *cred,
314191450Smarcel	    int flags, struct proc *p));
315191450Smarcelint	soo_write __P((struct file *fp, struct uio *uio, struct ucred *cred,
316191450Smarcel	    int flags, struct proc *p));
317191450Smarcelint	soo_close __P((struct file *fp, struct proc *p));
318191450Smarcelint	soo_ioctl __P((struct file *fp, u_long cmd, caddr_t data,
319191450Smarcel	    struct proc *p));
320191450Smarcelint	soo_poll __P((struct file *fp, int events, struct ucred *cred,
321191450Smarcel	    struct proc *p));
322191450Smarcelint	soo_stat __P((struct file *fp, struct stat *ub, struct proc *p));
323191450Smarcel
324191450Smarcel/*
325191450Smarcel * From uipc_socket and friends
326191450Smarcel */
327191450Smarcelstruct	sockaddr *dup_sockaddr __P((struct sockaddr *sa, int canwait));
328191450Smarcelint	getsock __P((struct filedesc *fdp, int fdes, struct file **fpp));
329191450Smarcelint	sockargs __P((struct mbuf **mp, caddr_t buf, int buflen, int type));
330191450Smarcelint	getsockaddr __P((struct sockaddr **namp, caddr_t uaddr, size_t len));
331191450Smarcelvoid	sbappend __P((struct sockbuf *sb, struct mbuf *m));
332191450Smarcelint	sbappendaddr __P((struct sockbuf *sb, struct sockaddr *asa,
333257059Snwhitehorn	    struct mbuf *m0, struct mbuf *control));
334257059Snwhitehornint	sbappendcontrol __P((struct sockbuf *sb, struct mbuf *m0,
335257059Snwhitehorn	    struct mbuf *control));
336257059Snwhitehornvoid	sbappendrecord __P((struct sockbuf *sb, struct mbuf *m0));
337257059Snwhitehornvoid	sbcheck __P((struct sockbuf *sb));
338257059Snwhitehornvoid	sbcompress __P((struct sockbuf *sb, struct mbuf *m, struct mbuf *n));
339257059Snwhitehornstruct mbuf *
340257059Snwhitehorn	sbcreatecontrol __P((caddr_t p, int size, int type, int level));
341257059Snwhitehornvoid	sbdrop __P((struct sockbuf *sb, int len));
342257059Snwhitehornvoid	sbdroprecord __P((struct sockbuf *sb));
343257059Snwhitehornvoid	sbflush __P((struct sockbuf *sb));
344257059Snwhitehornvoid	sbinsertoob __P((struct sockbuf *sb, struct mbuf *m0));
345257059Snwhitehornvoid	sbrelease __P((struct sockbuf *sb, struct socket *so));
346257059Snwhitehornint	sbreserve __P((struct sockbuf *sb, u_long cc, struct socket *so,
347257059Snwhitehorn		       struct proc *p));
348257059Snwhitehornvoid	sbtoxsockbuf __P((struct sockbuf *sb, struct xsockbuf *xsb));
349257059Snwhitehornint	sbwait __P((struct sockbuf *sb));
350257059Snwhitehornint	sb_lock __P((struct sockbuf *sb));
351257059Snwhitehornint	soabort __P((struct socket *so));
352257059Snwhitehornint	soaccept __P((struct socket *so, struct sockaddr **nam));
353257059Snwhitehornstruct	socket *soalloc __P((int waitok));
354257059Snwhitehornint	sobind __P((struct socket *so, struct sockaddr *nam, struct proc *p));
355257059Snwhitehornvoid	socantrcvmore __P((struct socket *so));
356257059Snwhitehornvoid	socantsendmore __P((struct socket *so));
357257059Snwhitehornint	soclose __P((struct socket *so));
358257059Snwhitehornint	soconnect __P((struct socket *so, struct sockaddr *nam, struct proc *p));
359257059Snwhitehornint	soconnect2 __P((struct socket *so1, struct socket *so2));
360257059Snwhitehornint	socreate __P((int dom, struct socket **aso, int type, int proto,
361257059Snwhitehorn	    struct proc *p));
362257059Snwhitehornvoid	sodealloc __P((struct socket *so));
363257059Snwhitehornint	sodisconnect __P((struct socket *so));
364257059Snwhitehornvoid	sofree __P((struct socket *so));
365int	sogetopt __P((struct socket *so, struct sockopt *sopt));
366void	sohasoutofband __P((struct socket *so));
367void	soisconnected __P((struct socket *so));
368void	soisconnecting __P((struct socket *so));
369void	soisdisconnected __P((struct socket *so));
370void	soisdisconnecting __P((struct socket *so));
371int	solisten __P((struct socket *so, int backlog, struct proc *p));
372struct socket *
373	sodropablereq __P((struct socket *head));
374struct socket *
375	sonewconn __P((struct socket *head, int connstatus));
376struct socket *
377	sonewconn3 __P((struct socket *head, int connstatus, struct proc *p));
378int	sooptcopyin __P((struct sockopt *sopt, void *buf, size_t len,
379			 size_t minlen));
380int	sooptcopyout __P((struct sockopt *sopt, void *buf, size_t len));
381
382/* XXX; prepare mbuf for (__FreeBSD__ < 3) routines. */
383int	soopt_getm __P((struct sockopt *sopt, struct mbuf **mp));
384int	soopt_mcopyin __P((struct sockopt *sopt, struct mbuf *m));
385int	soopt_mcopyout __P((struct sockopt *sopt, struct mbuf *m));
386
387int	sopoll __P((struct socket *so, int events, struct ucred *cred,
388		    struct proc *p));
389int	soreceive __P((struct socket *so, struct sockaddr **paddr,
390		       struct uio *uio, struct mbuf **mp0,
391		       struct mbuf **controlp, int *flagsp));
392int	soreserve __P((struct socket *so, u_long sndcc, u_long rcvcc));
393void	sorflush __P((struct socket *so));
394int	sosend __P((struct socket *so, struct sockaddr *addr, struct uio *uio,
395		    struct mbuf *top, struct mbuf *control, int flags,
396		    struct proc *p));
397int	sosetopt __P((struct socket *so, struct sockopt *sopt));
398int	soshutdown __P((struct socket *so, int how));
399void	sotoxsocket __P((struct socket *so, struct xsocket *xso));
400void	sowakeup __P((struct socket *so, struct sockbuf *sb));
401
402/* accept filter functions */
403int	accept_filt_add __P((struct accept_filter *filt));
404int	accept_filt_del __P((char *name));
405struct accept_filter *	accept_filt_get __P((char *name));
406#ifdef ACCEPT_FILTER_MOD
407int accept_filt_generic_mod_event __P((module_t mod, int event, void *data));
408#endif /* ACCEPT_FILTER_MOD */
409
410#endif /* _KERNEL */
411
412#endif /* !_SYS_SOCKETVAR_H_ */
413