]>
Commit | Line | Data |
---|---|---|
1c79356b | 1 | /* |
5d5c5d0d A |
2 | * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved. |
3 | * | |
8ad349bb | 4 | * @APPLE_LICENSE_OSREFERENCE_HEADER_START@ |
1c79356b | 5 | * |
8ad349bb A |
6 | * This file contains Original Code and/or Modifications of Original Code |
7 | * as defined in and that are subject to the Apple Public Source License | |
8 | * Version 2.0 (the 'License'). You may not use this file except in | |
9 | * compliance with the License. The rights granted to you under the | |
10 | * License may not be used to create, or enable the creation or | |
11 | * redistribution of, unlawful or unlicensed copies of an Apple operating | |
12 | * system, or to circumvent, violate, or enable the circumvention or | |
13 | * violation of, any terms of an Apple operating system software license | |
14 | * agreement. | |
15 | * | |
16 | * Please obtain a copy of the License at | |
17 | * http://www.opensource.apple.com/apsl/ and read it before using this | |
18 | * file. | |
19 | * | |
20 | * The Original Code and all software distributed under the License are | |
21 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER | |
22 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, | |
23 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, | |
24 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. | |
25 | * Please see the License for the specific language governing rights and | |
26 | * limitations under the License. | |
27 | * | |
28 | * @APPLE_LICENSE_OSREFERENCE_HEADER_END@ | |
1c79356b A |
29 | */ |
30 | /* Copyright (c) 1998, 1999 Apple Computer, Inc. All Rights Reserved */ | |
31 | /* Copyright (c) 1995 NeXT Computer, Inc. All Rights Reserved */ | |
32 | /*- | |
33 | * Copyright (c) 1982, 1986, 1990, 1993 | |
34 | * The Regents of the University of California. All rights reserved. | |
35 | * | |
36 | * Redistribution and use in source and binary forms, with or without | |
37 | * modification, are permitted provided that the following conditions | |
38 | * are met: | |
39 | * 1. Redistributions of source code must retain the above copyright | |
40 | * notice, this list of conditions and the following disclaimer. | |
41 | * 2. Redistributions in binary form must reproduce the above copyright | |
42 | * notice, this list of conditions and the following disclaimer in the | |
43 | * documentation and/or other materials provided with the distribution. | |
44 | * 3. All advertising materials mentioning features or use of this software | |
45 | * must display the following acknowledgement: | |
46 | * This product includes software developed by the University of | |
47 | * California, Berkeley and its contributors. | |
48 | * 4. Neither the name of the University nor the names of its contributors | |
49 | * may be used to endorse or promote products derived from this software | |
50 | * without specific prior written permission. | |
51 | * | |
52 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | |
53 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
54 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
55 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
56 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
57 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
58 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
59 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
60 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
61 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
62 | * SUCH DAMAGE. | |
63 | * | |
9bccf70c A |
64 | * @(#)socketvar.h 8.3 (Berkeley) 2/19/95 |
65 | * $FreeBSD: src/sys/sys/socketvar.h,v 1.46.2.6 2001/08/31 13:45:49 jlemon Exp $ | |
1c79356b A |
66 | */ |
67 | ||
9bccf70c | 68 | #ifndef _SYS_SOCKETVAR_H_ |
1c79356b A |
69 | #define _SYS_SOCKETVAR_H_ |
70 | ||
9bccf70c A |
71 | #include <sys/appleapiopts.h> |
72 | #include <sys/queue.h> /* for TAILQ macros */ | |
1c79356b | 73 | #include <sys/select.h> /* for struct selinfo */ |
1c79356b A |
74 | #include <net/kext_net.h> |
75 | #include <sys/ev.h> | |
91447636 A |
76 | #include <sys/cdefs.h> |
77 | ||
1c79356b A |
78 | /* |
79 | * Hacks to get around compiler complaints | |
80 | */ | |
81 | struct mbuf; | |
91447636 | 82 | struct socket_filter_entry; |
1c79356b A |
83 | struct protosw; |
84 | struct sockif; | |
85 | struct sockutil; | |
86 | ||
91447636 | 87 | #ifdef KERNEL_PRIVATE |
1c79356b A |
88 | /* strings for sleep message: */ |
89 | extern char netio[], netcon[], netcls[]; | |
90 | #define SOCKET_CACHE_ON | |
91 | #define SO_CACHE_FLUSH_INTERVAL 1 /* Seconds */ | |
92 | #define SO_CACHE_TIME_LIMIT (120/SO_CACHE_FLUSH_INTERVAL) /* Seconds */ | |
93 | #define SO_CACHE_MAX_FREE_BATCH 50 | |
94 | #define MAX_CACHED_SOCKETS 60000 | |
95 | #define TEMPDEBUG 0 | |
96 | ||
97 | /* | |
98 | * Kernel structure per socket. | |
99 | * Contains send and receive buffer queues, | |
100 | * handle on protocol and pointer to protocol | |
101 | * private data and error information. | |
102 | */ | |
91447636 A |
103 | #endif /* KERNEL_PRIVATE */ |
104 | ||
1c79356b A |
105 | typedef u_quad_t so_gen_t; |
106 | ||
91447636 | 107 | #ifdef KERNEL_PRIVATE |
9bccf70c A |
108 | #ifndef __APPLE__ |
109 | /* We don't support BSD style socket filters */ | |
110 | struct accept_filter; | |
111 | #endif | |
112 | ||
1c79356b | 113 | struct socket { |
9bccf70c A |
114 | int so_zone; /* zone we were allocated from */ |
115 | short so_type; /* generic type, see socket.h */ | |
1c79356b A |
116 | short so_options; /* from socket call, see socket.h */ |
117 | short so_linger; /* time to linger while closing */ | |
9bccf70c | 118 | short so_state; /* internal state flags SS_*, below */ |
1c79356b A |
119 | caddr_t so_pcb; /* protocol control block */ |
120 | struct protosw *so_proto; /* protocol handle */ | |
121 | /* | |
9bccf70c | 122 | * Variables for connection queuing. |
1c79356b A |
123 | * Socket where accepts occur is so_head in all subsidiary sockets. |
124 | * If so_head is 0, socket is not related to an accept. | |
9bccf70c A |
125 | * For head socket so_incomp queues partially completed connections, |
126 | * while so_comp is a queue of connections ready to be accepted. | |
1c79356b | 127 | * If a connection is aborted and it has so_head set, then |
9bccf70c | 128 | * it has to be pulled out of either so_incomp or so_comp. |
1c79356b A |
129 | * We allow connections to queue up based on current queue lengths |
130 | * and limit on number of queued connections for this socket. | |
131 | */ | |
132 | struct socket *so_head; /* back pointer to accept socket */ | |
133 | TAILQ_HEAD(, socket) so_incomp; /* queue of partial unaccepted connections */ | |
134 | TAILQ_HEAD(, socket) so_comp; /* queue of complete unaccepted connections */ | |
135 | TAILQ_ENTRY(socket) so_list; /* list of unaccepted connections */ | |
136 | short so_qlen; /* number of unaccepted connections */ | |
137 | short so_incqlen; /* number of unaccepted incomplete | |
138 | connections */ | |
139 | short so_qlimit; /* max number queued connections */ | |
140 | short so_timeo; /* connection timeout */ | |
141 | u_short so_error; /* error affecting connection */ | |
142 | pid_t so_pgid; /* pgid for signals */ | |
143 | u_long so_oobmark; /* chars to oob mark */ | |
9bccf70c A |
144 | #ifndef __APPLE__ |
145 | /* We don't support AIO ops */ | |
146 | TAILQ_HEAD(, aiocblist) so_aiojobq; /* AIO ops waiting on socket */ | |
147 | #endif | |
1c79356b A |
148 | /* |
149 | * Variables for socket buffering. | |
150 | */ | |
151 | struct sockbuf { | |
152 | u_long sb_cc; /* actual chars in buffer */ | |
153 | u_long sb_hiwat; /* max actual char count */ | |
154 | u_long sb_mbcnt; /* chars of mbufs used */ | |
155 | u_long sb_mbmax; /* max chars of mbufs to use */ | |
156 | long sb_lowat; /* low water mark */ | |
157 | struct mbuf *sb_mb; /* the mbuf chain */ | |
9bccf70c A |
158 | #if __APPLE__ |
159 | struct socket *sb_so; /* socket back ptr for kexts */ | |
160 | #endif | |
1c79356b A |
161 | struct selinfo sb_sel; /* process selecting read/write */ |
162 | short sb_flags; /* flags, see below */ | |
91447636 A |
163 | struct timeval sb_timeo; /* timeout for read/write */ |
164 | void *reserved1; /* for future use if needed */ | |
165 | void *reserved2; | |
1c79356b A |
166 | } so_rcv, so_snd; |
167 | #define SB_MAX (256*1024) /* default for max chars in sockbuf */ | |
168 | #define SB_LOCK 0x01 /* lock on data queue */ | |
169 | #define SB_WANT 0x02 /* someone is waiting to lock */ | |
170 | #define SB_WAIT 0x04 /* someone is waiting for data/space */ | |
0b4e3aa0 | 171 | #define SB_SEL 0x08 /* someone is selecting */ |
9bccf70c A |
172 | #define SB_ASYNC 0x10 /* ASYNC I/O, need signals */ |
173 | #define SB_UPCALL 0x20 /* someone wants an upcall */ | |
174 | #define SB_NOINTR 0x40 /* operations not interruptible */ | |
55e303ae | 175 | #define SB_KNOTE 0x100 /* kernel note attached */ |
9bccf70c A |
176 | #ifndef __APPLE__ |
177 | #define SB_AIO 0x80 /* AIO operations queued */ | |
9bccf70c | 178 | #else |
0b4e3aa0 | 179 | #define SB_NOTIFY (SB_WAIT|SB_SEL|SB_ASYNC) |
1c79356b A |
180 | #define SB_RECV 0x8000 /* this is rcv sb */ |
181 | ||
9bccf70c A |
182 | caddr_t so_tpcb; /* Wisc. protocol control block - XXX unused? */ |
183 | #endif | |
184 | ||
91447636 | 185 | void (*so_upcall)(struct socket *so, caddr_t arg, int waitf); |
1c79356b A |
186 | caddr_t so_upcallarg; /* Arg for above */ |
187 | uid_t so_uid; /* who opened the socket */ | |
188 | /* NB: generation count must not be first; easiest to make it last. */ | |
189 | so_gen_t so_gencnt; /* generation count */ | |
9bccf70c A |
190 | #ifndef __APPLE__ |
191 | void *so_emuldata; /* private data for emulators */ | |
192 | struct so_accf { | |
193 | struct accept_filter *so_accept_filter; | |
194 | void *so_accept_filter_arg; /* saved filter args */ | |
195 | char *so_accept_filter_str; /* saved user args */ | |
196 | } *so_accf; | |
197 | #else | |
1c79356b A |
198 | TAILQ_HEAD(,eventqelt) so_evlist; |
199 | int cached_in_sock_layer; /* Is socket bundled with pcb/pcb.inp_ppcb? */ | |
200 | struct socket *cache_next; | |
201 | struct socket *cache_prev; | |
202 | u_long cache_timestamp; | |
203 | caddr_t so_saved_pcb; /* Saved pcb when cacheing */ | |
204 | struct mbuf *so_temp; /* Holding area for outbound frags */ | |
205 | /* Plug-in support - make the socket interface overridable */ | |
206 | struct mbuf *so_tail; | |
91447636 | 207 | struct socket_filter_entry *so_filt; /* NKE hook */ |
9bccf70c | 208 | u_long so_flags; /* Flags */ |
91447636 A |
209 | #define SOF_NOSIGPIPE 0x00000001 |
210 | #define SOF_NOADDRAVAIL 0x00000002 /* returns EADDRNOTAVAIL if src address is gone */ | |
211 | #define SOF_PCBCLEARING 0x00000004 /* pru_disconnect done, no need to call pru_detach */ | |
212 | int so_usecount; /* refcounting of socket use */; | |
213 | int so_retaincnt; | |
214 | u_int32_t so_filteruse; /* usecount for the socket filters */ | |
5d5c5d0d A |
215 | /* for debug pruposes */ |
216 | #define SO_LCKDBG_MAX 4 /* number of debug locking Link Registers recorded */ | |
217 | u_int32_t lock_lr[SO_LCKDBG_MAX]; /* socket locking calling history */ | |
218 | int next_lock_lr; | |
219 | u_int32_t unlock_lr[SO_LCKDBG_MAX]; /* socket unlocking caller history */ | |
220 | int next_unlock_lr; | |
221 | ||
222 | ||
91447636 A |
223 | void *reserved3; /* Temporarily in use/debug: last socket lock LR */ |
224 | void *reserved4; /* Temporarily in use/debug: last socket unlock LR */ | |
3a60a9f5 | 225 | thread_t so_send_filt_thread; |
9bccf70c | 226 | #endif |
1c79356b | 227 | }; |
91447636 | 228 | #endif /* KERNEL_PRIVATE */ |
1c79356b A |
229 | |
230 | /* | |
231 | * Socket state bits. | |
232 | */ | |
233 | #define SS_NOFDREF 0x001 /* no file table ref any more */ | |
234 | #define SS_ISCONNECTED 0x002 /* socket connected to a peer */ | |
235 | #define SS_ISCONNECTING 0x004 /* in process of connecting to peer */ | |
236 | #define SS_ISDISCONNECTING 0x008 /* in process of disconnecting */ | |
237 | #define SS_CANTSENDMORE 0x010 /* can't send more data to peer */ | |
238 | #define SS_CANTRCVMORE 0x020 /* can't receive more data from peer */ | |
239 | #define SS_RCVATMARK 0x040 /* at mark on input */ | |
240 | ||
241 | #define SS_PRIV 0x080 /* privileged for broadcast, raw... */ | |
242 | #define SS_NBIO 0x100 /* non-blocking ops */ | |
243 | #define SS_ASYNC 0x200 /* async i/o notify */ | |
244 | #define SS_ISCONFIRMING 0x400 /* deciding to accept connection req */ | |
245 | #define SS_INCOMP 0x800 /* Unaccepted, incomplete connection */ | |
246 | #define SS_COMP 0x1000 /* unaccepted, complete connection */ | |
9bccf70c | 247 | #define SS_ISDISCONNECTED 0x2000 /* socket disconnected from peer */ |
91447636 | 248 | #define SS_DRAINING 0x4000 /* close waiting for blocked system calls to drain */ |
1c79356b A |
249 | |
250 | /* | |
251 | * Externalized form of struct socket used by the sysctl(3) interface. | |
252 | */ | |
253 | struct xsocket { | |
254 | size_t xso_len; /* length of this structure */ | |
255 | struct socket *xso_so; /* makes a convenient handle sometimes */ | |
256 | short so_type; | |
257 | short so_options; | |
258 | short so_linger; | |
259 | short so_state; | |
260 | caddr_t so_pcb; /* another convenient handle */ | |
261 | int xso_protocol; | |
262 | int xso_family; | |
263 | short so_qlen; | |
264 | short so_incqlen; | |
265 | short so_qlimit; | |
266 | short so_timeo; | |
267 | u_short so_error; | |
268 | pid_t so_pgid; | |
269 | u_long so_oobmark; | |
270 | struct xsockbuf { | |
271 | u_long sb_cc; | |
272 | u_long sb_hiwat; | |
273 | u_long sb_mbcnt; | |
274 | u_long sb_mbmax; | |
275 | long sb_lowat; | |
276 | short sb_flags; | |
277 | short sb_timeo; | |
278 | } so_rcv, so_snd; | |
279 | uid_t so_uid; /* XXX */ | |
280 | }; | |
281 | ||
91447636 | 282 | #ifdef KERNEL_PRIVATE |
1c79356b A |
283 | /* |
284 | * Macros for sockets and socket buffering. | |
285 | */ | |
91447636 | 286 | |
1c79356b A |
287 | #define sbtoso(sb) (sb->sb_so) |
288 | ||
9bccf70c A |
289 | /* |
290 | * Functions for sockets and socket buffering. | |
291 | * These are macros on FreeBSD. On Darwin the | |
292 | * implementation is in bsd/kern/uipc_socket2.c | |
293 | */ | |
91447636 A |
294 | |
295 | __BEGIN_DECLS | |
296 | int sb_notify(struct sockbuf *sb); | |
297 | long sbspace(struct sockbuf *sb); | |
298 | int sosendallatonce(struct socket *so); | |
299 | int soreadable(struct socket *so); | |
300 | int sowriteable(struct socket *so); | |
301 | void sballoc(struct sockbuf *sb, struct mbuf *m); | |
302 | void sbfree(struct sockbuf *sb, struct mbuf *m); | |
303 | int sblock(struct sockbuf *sb, int wf); | |
304 | void sbunlock(struct sockbuf *sb, int locked); | |
305 | void sorwakeup(struct socket * so); | |
306 | void sowwakeup(struct socket * so); | |
307 | __END_DECLS | |
1c79356b A |
308 | |
309 | /* | |
310 | * Socket extension mechanism: control block hooks: | |
311 | * This is the "head" of any control block for an extenstion | |
312 | * Note: we separate intercept function dispatch vectors from | |
313 | * the NFDescriptor to permit selective replacement during | |
314 | * operation, e.g., to disable some functions. | |
315 | */ | |
316 | struct kextcb | |
317 | { struct kextcb *e_next; /* Next kext control block */ | |
318 | void *e_fcb; /* Real filter control block */ | |
319 | struct NFDescriptor *e_nfd; /* NKE Descriptor */ | |
320 | /* Plug-in support - intercept functions */ | |
321 | struct sockif *e_soif; /* Socket functions */ | |
322 | struct sockutil *e_sout; /* Sockbuf utility functions */ | |
323 | }; | |
324 | #define EXT_NULL 0x0 /* STATE: Not in use */ | |
325 | #define sotokextcb(so) (so ? so->so_ext : 0) | |
326 | ||
327 | #ifdef KERNEL | |
9bccf70c | 328 | |
91447636 A |
329 | #define SO_FILT_HINT_LOCKED 0x1 |
330 | ||
1c79356b A |
331 | /* |
332 | * Argument structure for sosetopt et seq. This is in the KERNEL | |
333 | * section because it will never be visible to user code. | |
334 | */ | |
335 | enum sopt_dir { SOPT_GET, SOPT_SET }; | |
336 | struct sockopt { | |
337 | enum sopt_dir sopt_dir; /* is this a get or a set? */ | |
338 | int sopt_level; /* second arg of [gs]etsockopt */ | |
339 | int sopt_name; /* third arg of [gs]etsockopt */ | |
91447636 | 340 | user_addr_t sopt_val; /* fourth arg of [gs]etsockopt */ |
1c79356b A |
341 | size_t sopt_valsize; /* (almost) fifth arg of [gs]etsockopt */ |
342 | struct proc *sopt_p; /* calling process or null if kernel */ | |
343 | }; | |
344 | ||
345 | #if SENDFILE | |
1c79356b A |
346 | struct sf_buf { |
347 | SLIST_ENTRY(sf_buf) free_list; /* list of free buffer slots */ | |
348 | int refcnt; /* reference count */ | |
349 | struct vm_page *m; /* currently mapped page */ | |
350 | vm_offset_t kva; /* va of mapping */ | |
351 | }; | |
1c79356b A |
352 | #endif |
353 | ||
354 | #ifdef MALLOC_DECLARE | |
355 | MALLOC_DECLARE(M_PCB); | |
356 | MALLOC_DECLARE(M_SONAME); | |
357 | #endif | |
358 | ||
359 | extern int maxsockets; | |
360 | extern u_long sb_max; | |
361 | extern int socket_zone; | |
362 | extern so_gen_t so_gencnt; | |
363 | ||
364 | struct file; | |
365 | struct filedesc; | |
366 | struct mbuf; | |
367 | struct sockaddr; | |
368 | struct stat; | |
369 | struct ucred; | |
370 | struct uio; | |
9bccf70c | 371 | struct knote; |
1c79356b | 372 | |
1c79356b A |
373 | /* |
374 | * From uipc_socket and friends | |
375 | */ | |
91447636 A |
376 | __BEGIN_DECLS |
377 | struct sockaddr *dup_sockaddr(struct sockaddr *sa, int canwait); | |
378 | int getsock(struct filedesc *fdp, int fd, struct file **fpp); | |
379 | int sockargs(struct mbuf **mp, user_addr_t data, int buflen, int type); | |
380 | int getsockaddr(struct sockaddr **namp, user_addr_t uaddr, size_t len); | |
381 | int sbappend(struct sockbuf *sb, struct mbuf *m); | |
382 | int sbappendaddr(struct sockbuf *sb, struct sockaddr *asa, | |
383 | struct mbuf *m0, struct mbuf *control, int *error_out); | |
384 | int sbappendcontrol(struct sockbuf *sb, struct mbuf *m0, | |
385 | struct mbuf *control, int *error_out); | |
386 | int sbappendrecord(struct sockbuf *sb, struct mbuf *m0); | |
387 | void sbcheck(struct sockbuf *sb); | |
1c79356b | 388 | struct mbuf * |
91447636 A |
389 | sbcreatecontrol(caddr_t p, int size, int type, int level); |
390 | void sbdrop(struct sockbuf *sb, int len); | |
391 | void sbdroprecord(struct sockbuf *sb); | |
392 | void sbflush(struct sockbuf *sb); | |
393 | int sbinsertoob(struct sockbuf *sb, struct mbuf *m0); | |
394 | void sbrelease(struct sockbuf *sb); | |
395 | int sbreserve(struct sockbuf *sb, u_long cc); | |
396 | void sbtoxsockbuf(struct sockbuf *sb, struct xsockbuf *xsb); | |
397 | int sbwait(struct sockbuf *sb); | |
398 | int sb_lock(struct sockbuf *sb); | |
399 | int soabort(struct socket *so); | |
400 | int soaccept(struct socket *so, struct sockaddr **nam); | |
401 | int soacceptlock (struct socket *so, struct sockaddr **nam, int dolock); | |
402 | struct socket *soalloc(int waitok, int dom, int type); | |
403 | int sobind(struct socket *so, struct sockaddr *nam); | |
404 | void socantrcvmore(struct socket *so); | |
405 | void socantsendmore(struct socket *so); | |
406 | int soclose(struct socket *so); | |
407 | int soconnect(struct socket *so, struct sockaddr *nam); | |
408 | int soconnectlock (struct socket *so, struct sockaddr *nam, int dolock); | |
409 | int soconnect2(struct socket *so1, struct socket *so2); | |
410 | int socreate(int dom, struct socket **aso, int type, int proto); | |
411 | void sodealloc(struct socket *so); | |
412 | int sodisconnect(struct socket *so); | |
413 | void sofree(struct socket *so); | |
414 | int sogetopt(struct socket *so, struct sockopt *sopt); | |
415 | void sohasoutofband(struct socket *so); | |
416 | void soisconnected(struct socket *so); | |
417 | void soisconnecting(struct socket *so); | |
418 | void soisdisconnected(struct socket *so); | |
419 | void soisdisconnecting(struct socket *so); | |
420 | int solisten(struct socket *so, int backlog); | |
1c79356b | 421 | struct socket * |
91447636 | 422 | sodropablereq(struct socket *head); |
1c79356b | 423 | struct socket * |
91447636 A |
424 | sonewconn(struct socket *head, int connstatus, const struct sockaddr* from); |
425 | int sooptcopyin(struct sockopt *sopt, void *data, size_t len, size_t minlen); | |
426 | int sooptcopyout(struct sockopt *sopt, void *data, size_t len); | |
427 | int socket_lock(struct socket *so, int refcount); | |
428 | int socket_unlock(struct socket *so, int refcount); | |
9bccf70c A |
429 | |
430 | /* | |
431 | * XXX; prepare mbuf for (__FreeBSD__ < 3) routines. | |
432 | * Used primarily in IPSec and IPv6 code. | |
433 | */ | |
91447636 A |
434 | int soopt_getm(struct sockopt *sopt, struct mbuf **mp); |
435 | int soopt_mcopyin(struct sockopt *sopt, struct mbuf *m); | |
436 | int soopt_mcopyout(struct sockopt *sopt, struct mbuf *m); | |
9bccf70c | 437 | |
91447636 A |
438 | int sopoll(struct socket *so, int events, struct ucred *cred, void *wql); |
439 | int soreceive(struct socket *so, struct sockaddr **paddr, | |
1c79356b | 440 | struct uio *uio, struct mbuf **mp0, |
91447636 A |
441 | struct mbuf **controlp, int *flagsp); |
442 | int soreserve(struct socket *so, u_long sndcc, u_long rcvcc); | |
443 | void sorflush(struct socket *so); | |
444 | int sosend(struct socket *so, struct sockaddr *addr, struct uio *uio, | |
445 | struct mbuf *top, struct mbuf *control, int flags); | |
1c79356b | 446 | |
91447636 A |
447 | int sosetopt(struct socket *so, struct sockopt *sopt); |
448 | int soshutdown(struct socket *so, int how); | |
449 | void sotoxsocket(struct socket *so, struct xsocket *xso); | |
450 | void sowakeup(struct socket *so, struct sockbuf *sb); | |
451 | int soioctl(struct socket *so, u_long cmd, caddr_t data, struct proc *p); | |
1c79356b | 452 | |
9bccf70c A |
453 | #ifndef __APPLE__ |
454 | /* accept filter functions */ | |
91447636 A |
455 | int accept_filt_add(struct accept_filter *filt); |
456 | int accept_filt_del(char *name); | |
457 | struct accept_filter * accept_filt_get(char *name); | |
9bccf70c | 458 | #ifdef ACCEPT_FILTER_MOD |
91447636 | 459 | int accept_filt_generic_mod_event(module_t mod, int event, void *data); |
9bccf70c A |
460 | SYSCTL_DECL(_net_inet_accf); |
461 | #endif /* ACCEPT_FILTER_MOD */ | |
462 | #endif /* !defined(__APPLE__) */ | |
1c79356b | 463 | |
91447636 A |
464 | __END_DECLS |
465 | ||
1c79356b | 466 | #endif /* KERNEL */ |
91447636 | 467 | #endif /* KERNEL_PRIVATE */ |
9bccf70c | 468 | |
1c79356b | 469 | #endif /* !_SYS_SOCKETVAR_H_ */ |