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