]> git.saurik.com Git - apple/xnu.git/blame - bsd/sys/socket.h
xnu-517.3.15.tar.gz
[apple/xnu.git] / bsd / sys / socket.h
CommitLineData
1c79356b 1/*
9bccf70c 2 * Copyright (c) 2000-2002 Apple Computer, Inc. All rights reserved.
1c79356b
A
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
43866e37 6 * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
1c79356b 7 *
43866e37
A
8 * This file contains Original Code and/or Modifications of Original Code
9 * as defined in and that are subject to the Apple Public Source License
10 * Version 2.0 (the 'License'). You may not use this file except in
11 * compliance with the License. Please obtain a copy of the License at
12 * http://www.opensource.apple.com/apsl/ and read it before using this
13 * file.
14 *
15 * The Original Code and all software distributed under the License are
16 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
1c79356b
A
17 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
18 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
43866e37
A
19 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
20 * Please see the License for the specific language governing rights and
21 * limitations under the License.
1c79356b
A
22 *
23 * @APPLE_LICENSE_HEADER_END@
24 */
25/* Copyright (c) 1998, 1999 Apple Computer, Inc. All Rights Reserved */
26/* Copyright (c) 1995 NeXT Computer, Inc. All Rights Reserved */
27/*
28 * Copyright (c) 1982, 1985, 1986, 1988, 1993, 1994
29 * The Regents of the University of California. All rights reserved.
30 *
31 * Redistribution and use in source and binary forms, with or without
32 * modification, are permitted provided that the following conditions
33 * are met:
34 * 1. Redistributions of source code must retain the above copyright
35 * notice, this list of conditions and the following disclaimer.
36 * 2. Redistributions in binary form must reproduce the above copyright
37 * notice, this list of conditions and the following disclaimer in the
38 * documentation and/or other materials provided with the distribution.
39 * 3. All advertising materials mentioning features or use of this software
40 * must display the following acknowledgement:
41 * This product includes software developed by the University of
42 * California, Berkeley and its contributors.
43 * 4. Neither the name of the University nor the names of its contributors
44 * may be used to endorse or promote products derived from this software
45 * without specific prior written permission.
46 *
47 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
48 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
49 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
50 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
51 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
52 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
53 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
54 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
55 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
56 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
57 * SUCH DAMAGE.
58 *
59 * @(#)socket.h 8.4 (Berkeley) 2/21/94
9bccf70c 60 * $FreeBSD: src/sys/sys/socket.h,v 1.39.2.7 2001/07/03 11:02:01 ume Exp $
1c79356b
A
61 */
62
63#ifndef _SYS_SOCKET_H_
64#define _SYS_SOCKET_H_
65
9bccf70c
A
66#ifndef __APPLE__
67#include <machine/ansi.h>
68#endif
69#define _NO_NAMESPACE_POLLUTION
70#include <machine/param.h>
71#undef _NO_NAMESPACE_POLLUTION
1c79356b
A
72
73/*
74 * Definitions related to sockets: types, address families, options.
75 */
76
9bccf70c
A
77/*
78 * Data types.
79 */
80typedef u_char sa_family_t;
81#ifdef _BSD_SOCKLEN_T_
82typedef _BSD_SOCKLEN_T_ socklen_t;
83#undef _BSD_SOCKLEN_T_
84#endif
85
1c79356b
A
86/*
87 * Types
88 */
89#define SOCK_STREAM 1 /* stream socket */
90#define SOCK_DGRAM 2 /* datagram socket */
91#define SOCK_RAW 3 /* raw-protocol interface */
92#define SOCK_RDM 4 /* reliably-delivered message */
93#define SOCK_SEQPACKET 5 /* sequenced packet stream */
94
95/*
96 * Option flags per-socket.
97 */
98#define SO_DEBUG 0x0001 /* turn on debugging info recording */
99#define SO_ACCEPTCONN 0x0002 /* socket has had listen() */
100#define SO_REUSEADDR 0x0004 /* allow local address reuse */
101#define SO_KEEPALIVE 0x0008 /* keep connections alive */
102#define SO_DONTROUTE 0x0010 /* just use interface addresses */
103#define SO_BROADCAST 0x0020 /* permit sending of broadcast msgs */
104#define SO_USELOOPBACK 0x0040 /* bypass hardware when possible */
105#define SO_LINGER 0x0080 /* linger on close if data present */
106#define SO_OOBINLINE 0x0100 /* leave received OOB data in line */
107#define SO_REUSEPORT 0x0200 /* allow local address & port reuse */
108#define SO_TIMESTAMP 0x0400 /* timestamp received dgram traffic */
9bccf70c
A
109#ifndef __APPLE__
110#define SO_ACCEPTFILTER 0x1000 /* there is an accept filter */
111#else
1c79356b
A
112#define SO_DONTTRUNC 0x2000 /* APPLE: Retain unread data */
113 /* (ATOMIC proto) */
9bccf70c
A
114#define SO_WANTMORE 0x4000 /* APPLE: Give hint when more data ready */
115#define SO_WANTOOBFLAG 0x8000 /* APPLE: Want OOB in MSG_FLAG on receive */
116#endif
1c79356b
A
117
118/*
119 * Additional options, not kept in so_options.
120 */
121#define SO_SNDBUF 0x1001 /* send buffer size */
122#define SO_RCVBUF 0x1002 /* receive buffer size */
123#define SO_SNDLOWAT 0x1003 /* send low-water mark */
124#define SO_RCVLOWAT 0x1004 /* receive low-water mark */
125#define SO_SNDTIMEO 0x1005 /* send timeout */
126#define SO_RCVTIMEO 0x1006 /* receive timeout */
127#define SO_ERROR 0x1007 /* get error status and clear */
128#define SO_TYPE 0x1008 /* get socket type */
9bccf70c
A
129/*efine SO_PRIVSTATE 0x1009 get/deny privileged state */
130#ifdef __APPLE__
1c79356b
A
131#define SO_NREAD 0x1020 /* APPLE: get 1st-packet byte count */
132#define SO_NKE 0x1021 /* APPLE: Install socket-level NKE */
9bccf70c 133#define SO_NOSIGPIPE 0x1022 /* APPLE: No SIGPIPE on EPIPE */
55e303ae 134#define SO_NOADDRERR 0x1023 /* APPLE: Returns EADDRNOTAVAIL when src is not available anymore */
9bccf70c 135#endif
1c79356b
A
136/*
137 * Structure used for manipulating linger option.
138 */
139struct linger {
140 int l_onoff; /* option on/off */
141 int l_linger; /* linger time */
142};
143
9bccf70c
A
144#ifndef __APPLE__
145struct accept_filter_arg {
146 char af_name[16];
147 char af_arg[256-16];
148};
149#endif
150
1c79356b
A
151/*
152 * Level number for (get/set)sockopt() to apply to socket itself.
153 */
154#define SOL_SOCKET 0xffff /* options for socket level */
155
156/*
157 * Address families.
158 */
159#define AF_UNSPEC 0 /* unspecified */
9bccf70c 160#define AF_LOCAL 1 /* local to host (pipes) */
1c79356b
A
161#define AF_UNIX AF_LOCAL /* backward compatibility */
162#define AF_INET 2 /* internetwork: UDP, TCP, etc. */
163#define AF_IMPLINK 3 /* arpanet imp addresses */
164#define AF_PUP 4 /* pup protocols: e.g. BSP */
165#define AF_CHAOS 5 /* mit CHAOS protocols */
166#define AF_NS 6 /* XEROX NS protocols */
167#define AF_ISO 7 /* ISO protocols */
168#define AF_OSI AF_ISO
9bccf70c 169#define AF_ECMA 8 /* European computer manufacturers */
1c79356b
A
170#define AF_DATAKIT 9 /* datakit protocols */
171#define AF_CCITT 10 /* CCITT protocols, X.25 etc */
172#define AF_SNA 11 /* IBM SNA */
173#define AF_DECnet 12 /* DECnet */
174#define AF_DLI 13 /* DEC Direct data link interface */
175#define AF_LAT 14 /* LAT */
176#define AF_HYLINK 15 /* NSC Hyperchannel */
177#define AF_APPLETALK 16 /* Apple Talk */
178#define AF_ROUTE 17 /* Internal Routing Protocol */
179#define AF_LINK 18 /* Link layer interface */
180#define pseudo_AF_XTP 19 /* eXpress Transfer Protocol (no AF) */
181#define AF_COIP 20 /* connection-oriented IP, aka ST II */
182#define AF_CNT 21 /* Computer Network Technology */
183#define pseudo_AF_RTIP 22 /* Help Identify RTIP packets */
184#define AF_IPX 23 /* Novell Internet Protocol */
185#define AF_SIP 24 /* Simple Internet Protocol */
186#define pseudo_AF_PIP 25 /* Help Identify PIP packets */
9bccf70c
A
187#ifdef __APPLE__
188/*define pseudo_AF_BLUE 26 Identify packets for Blue Box - Not used */
1c79356b 189#define AF_NDRV 27 /* Network Driver 'raw' access */
9bccf70c 190#endif
1c79356b
A
191#define AF_ISDN 28 /* Integrated Services Digital Network*/
192#define AF_E164 AF_ISDN /* CCITT E.164 recommendation */
193#define pseudo_AF_KEY 29 /* Internal key-management function */
194#define AF_INET6 30 /* IPv6 */
195#define AF_NATM 31 /* native ATM access */
9bccf70c
A
196#ifdef __APPLE__
197#define AF_SYSTEM 32 /* Kernel event messages */
1c79356b 198#define AF_NETBIOS 33 /* NetBIOS */
0b4e3aa0 199#define AF_PPP 34 /* PPP communication protocol */
9bccf70c
A
200#else
201#define AF_ATM 30 /* ATM */
202#endif
203#define pseudo_AF_HDRCMPLT 35 /* Used by BPF to not rewrite headers
204 * in interface output routine
205 */
206#ifndef __APPLE__
207#define AF_NETGRAPH 32 /* Netgraph sockets */
208#endif
209#define AF_MAX 36
1c79356b
A
210
211/*
212 * Structure used by kernel to store most
213 * addresses.
214 */
215struct sockaddr {
216 u_char sa_len; /* total length */
217 u_char sa_family; /* address family */
9bccf70c 218 char sa_data[14]; /* actually longer; address value */
1c79356b
A
219};
220#define SOCK_MAXADDRLEN 255 /* longest possible addresses */
221
222/*
223 * Structure used by kernel to pass protocol
224 * information in raw sockets.
225 */
226struct sockproto {
227 u_short sp_family; /* address family */
228 u_short sp_protocol; /* protocol */
229};
230
1c79356b 231/*
9bccf70c 232 * RFC 2553: protocol-independent placeholder for socket addresses
1c79356b 233 */
9bccf70c
A
234#define _SS_MAXSIZE 128
235#define _SS_ALIGNSIZE (sizeof(int64_t))
236#define _SS_PAD1SIZE (_SS_ALIGNSIZE - sizeof(u_char) - sizeof(sa_family_t))
237#define _SS_PAD2SIZE (_SS_MAXSIZE - sizeof(u_char) - sizeof(sa_family_t) - \
1c79356b
A
238 _SS_PAD1SIZE - _SS_ALIGNSIZE)
239
240struct sockaddr_storage {
9bccf70c
A
241 u_char ss_len; /* address length */
242 sa_family_t ss_family; /* address family */
243 char __ss_pad1[_SS_PAD1SIZE];
244 int64_t __ss_align; /* force desired structure storage alignment */
245 char __ss_pad2[_SS_PAD2SIZE];
1c79356b 246};
1c79356b
A
247
248/*
249 * Protocol families, same as address families for now.
250 */
251#define PF_UNSPEC AF_UNSPEC
252#define PF_LOCAL AF_LOCAL
253#define PF_UNIX PF_LOCAL /* backward compatibility */
254#define PF_INET AF_INET
1c79356b
A
255#define PF_IMPLINK AF_IMPLINK
256#define PF_PUP AF_PUP
257#define PF_CHAOS AF_CHAOS
258#define PF_NS AF_NS
259#define PF_ISO AF_ISO
260#define PF_OSI AF_ISO
261#define PF_ECMA AF_ECMA
262#define PF_DATAKIT AF_DATAKIT
263#define PF_CCITT AF_CCITT
264#define PF_SNA AF_SNA
265#define PF_DECnet AF_DECnet
266#define PF_DLI AF_DLI
267#define PF_LAT AF_LAT
268#define PF_HYLINK AF_HYLINK
269#define PF_APPLETALK AF_APPLETALK
270#define PF_ROUTE AF_ROUTE
271#define PF_LINK AF_LINK
272#define PF_XTP pseudo_AF_XTP /* really just proto family, no AF */
273#define PF_COIP AF_COIP
274#define PF_CNT AF_CNT
275#define PF_SIP AF_SIP
276#define PF_IPX AF_IPX /* same format as AF_NS */
277#define PF_RTIP pseudo_AF_RTIP /* same format as AF_INET */
278#define PF_PIP pseudo_AF_PIP
9bccf70c 279#ifdef __APPLE__
1c79356b 280#define PF_NDRV AF_NDRV
9bccf70c 281#endif
1c79356b
A
282#define PF_ISDN AF_ISDN
283#define PF_KEY pseudo_AF_KEY
284#define PF_INET6 AF_INET6
285#define PF_NATM AF_NATM
9bccf70c 286#ifdef __APPLE__
1c79356b
A
287#define PF_SYSTEM AF_SYSTEM
288#define PF_NETBIOS AF_NETBIOS
0b4e3aa0 289#define PF_PPP AF_PPP
9bccf70c
A
290#else
291#define PF_ATM AF_ATM
292#define PF_NETGRAPH AF_NETGRAPH
293#endif
1c79356b
A
294
295#define PF_MAX AF_MAX
296
297/*
298 * Definitions for network related sysctl, CTL_NET.
299 *
300 * Second level is protocol family.
301 * Third level is protocol number.
302 *
303 * Further levels are defined by the individual families below.
304 */
305#define NET_MAXID AF_MAX
306
307#define CTL_NET_NAMES { \
308 { 0, 0 }, \
309 { "local", CTLTYPE_NODE }, \
310 { "inet", CTLTYPE_NODE }, \
311 { "implink", CTLTYPE_NODE }, \
312 { "pup", CTLTYPE_NODE }, \
313 { "chaos", CTLTYPE_NODE }, \
314 { "xerox_ns", CTLTYPE_NODE }, \
315 { "iso", CTLTYPE_NODE }, \
316 { "emca", CTLTYPE_NODE }, \
317 { "datakit", CTLTYPE_NODE }, \
318 { "ccitt", CTLTYPE_NODE }, \
319 { "ibm_sna", CTLTYPE_NODE }, \
320 { "decnet", CTLTYPE_NODE }, \
321 { "dec_dli", CTLTYPE_NODE }, \
322 { "lat", CTLTYPE_NODE }, \
323 { "hylink", CTLTYPE_NODE }, \
324 { "appletalk", CTLTYPE_NODE }, \
325 { "route", CTLTYPE_NODE }, \
326 { "link_layer", CTLTYPE_NODE }, \
327 { "xtp", CTLTYPE_NODE }, \
328 { "coip", CTLTYPE_NODE }, \
329 { "cnt", CTLTYPE_NODE }, \
330 { "rtip", CTLTYPE_NODE }, \
331 { "ipx", CTLTYPE_NODE }, \
332 { "sip", CTLTYPE_NODE }, \
333 { "pip", CTLTYPE_NODE }, \
9bccf70c
A
334 { 0, 0 }, \
335 { "ndrv", CTLTYPE_NODE }, \
1c79356b
A
336 { "isdn", CTLTYPE_NODE }, \
337 { "key", CTLTYPE_NODE }, \
338 { "inet6", CTLTYPE_NODE }, \
339 { "natm", CTLTYPE_NODE }, \
9bccf70c
A
340 { "sys", CTLTYPE_NODE }, \
341 { "netbios", CTLTYPE_NODE }, \
342 { "ppp", CTLTYPE_NODE }, \
343 { "hdrcomplete", CTLTYPE_NODE }, \
1c79356b
A
344}
345
346/*
347 * PF_ROUTE - Routing table
348 *
349 * Three additional levels are defined:
350 * Fourth: address family, 0 is wildcard
351 * Fifth: type of info, defined below
352 * Sixth: flag(s) to mask with for NET_RT_FLAGS
353 */
354#define NET_RT_DUMP 1 /* dump; may limit to a.f. */
355#define NET_RT_FLAGS 2 /* by flags, e.g. RESOLVING */
356#define NET_RT_IFLIST 3 /* survey interface list */
357#define NET_RT_MAXID 4
358
359#define CTL_NET_RT_NAMES { \
360 { 0, 0 }, \
361 { "dump", CTLTYPE_STRUCT }, \
362 { "flags", CTLTYPE_STRUCT }, \
363 { "iflist", CTLTYPE_STRUCT }, \
364}
365
366/*
367 * Maximum queue length specifiable by listen.
368 */
369#define SOMAXCONN 128
370
371/*
372 * Message header for recvmsg and sendmsg calls.
373 * Used value-result for recvmsg, value only for sendmsg.
374 */
375struct msghdr {
55e303ae
A
376 caddr_t msg_name; /* optional address */
377 socklen_t msg_namelen; /* size of address */
378 struct iovec *msg_iov; /* scatter/gather array */
379 u_int msg_iovlen; /* # elements in msg_iov */
380 caddr_t msg_control; /* ancillary data, see below */
381 socklen_t msg_controllen; /* ancillary data buffer len */
382 int msg_flags; /* flags on received message */
1c79356b
A
383};
384
385#define MSG_OOB 0x1 /* process out-of-band data */
386#define MSG_PEEK 0x2 /* peek at incoming message */
387#define MSG_DONTROUTE 0x4 /* send without using routing tables */
388#define MSG_EOR 0x8 /* data completes record */
389#define MSG_TRUNC 0x10 /* data discarded before delivery */
390#define MSG_CTRUNC 0x20 /* control data lost before delivery */
391#define MSG_WAITALL 0x40 /* wait for full request or error */
392#define MSG_DONTWAIT 0x80 /* this message should be nonblocking */
393#define MSG_EOF 0x100 /* data completes connection */
9bccf70c 394#ifdef __APPLE__
55e303ae 395#define MSG_WAITSTREAM 0x200 /* wait up to full request.. may return partial */
1c79356b
A
396#define MSG_FLUSH 0x400 /* Start of 'hold' seq; dump so_temp */
397#define MSG_HOLD 0x800 /* Hold frag in so_temp */
398#define MSG_SEND 0x1000 /* Send the packet in so_temp */
399#define MSG_HAVEMORE 0x2000 /* Data ready to be read */
400#define MSG_RCVMORE 0x4000 /* Data remains in current pkt */
9bccf70c 401#endif
1c79356b 402#define MSG_COMPAT 0x8000 /* used in sendit() */
4a249263 403#define MSG_NEEDSA 0x10000 /* Fail receive if socket address cannot be allocated */
1c79356b
A
404
405/*
406 * Header for ancillary data objects in msg_control buffer.
407 * Used for additional information with/about a datagram
408 * not expressible by flags. The format is a sequence
409 * of message elements headed by cmsghdr structures.
410 */
411struct cmsghdr {
55e303ae
A
412 socklen_t cmsg_len; /* data byte count, including hdr */
413 int cmsg_level; /* originating protocol */
414 int cmsg_type; /* protocol-specific type */
1c79356b
A
415/* followed by u_char cmsg_data[]; */
416};
417
9bccf70c
A
418#ifndef __APPLE__
419/*
420 * While we may have more groups than this, the cmsgcred struct must
421 * be able to fit in an mbuf, and NGROUPS_MAX is too large to allow
422 * this.
423*/
424#define CMGROUP_MAX 16
1c79356b 425
9bccf70c
A
426/*
427 * Credentials structure, used to verify the identity of a peer
428 * process that has sent us a message. This is allocated by the
429 * peer process but filled in by the kernel. This prevents the
430 * peer from lying about its identity. (Note that cmcred_groups[0]
431 * is the effective GID.)
1c79356b 432 */
9bccf70c
A
433struct cmsgcred {
434 pid_t cmcred_pid; /* PID of sending process */
435 uid_t cmcred_uid; /* real UID of sending process */
436 uid_t cmcred_euid; /* effective UID of sending process */
437 gid_t cmcred_gid; /* real GID of sending process */
438 short cmcred_ngroups; /* number or groups */
439 gid_t cmcred_groups[CMGROUP_MAX]; /* groups */
440};
441#endif
442
443/* given pointer to struct cmsghdr, return pointer to data */
444#define CMSG_DATA(cmsg) ((u_char *)(cmsg) + \
445 ALIGN(sizeof(struct cmsghdr)))
1c79356b
A
446
447/* given pointer to struct cmsghdr, return pointer to next cmsghdr */
448#define CMSG_NXTHDR(mhdr, cmsg) \
9bccf70c
A
449 (((caddr_t)(cmsg) + ALIGN((cmsg)->cmsg_len) + \
450 ALIGN(sizeof(struct cmsghdr)) > \
451 (caddr_t)(mhdr)->msg_control + (mhdr)->msg_controllen) ? \
1c79356b 452 (struct cmsghdr *)NULL : \
9bccf70c 453 (struct cmsghdr *)((caddr_t)(cmsg) + ALIGN((cmsg)->cmsg_len)))
1c79356b
A
454
455#define CMSG_FIRSTHDR(mhdr) ((struct cmsghdr *)(mhdr)->msg_control)
456
9bccf70c
A
457/* RFC 2292 additions */
458
459#define CMSG_SPACE(l) (ALIGN(sizeof(struct cmsghdr)) + ALIGN(l))
460#define CMSG_LEN(l) (ALIGN(sizeof(struct cmsghdr)) + (l))
461
462#ifdef KERNEL
463#define CMSG_ALIGN(n) ALIGN(n)
464#endif
1c79356b
A
465
466/* "Socket"-level control message types: */
467#define SCM_RIGHTS 0x01 /* access rights (array of int) */
468#define SCM_TIMESTAMP 0x02 /* timestamp (struct timeval) */
469#define SCM_CREDS 0x03 /* process creds (struct cmsgcred) */
470
471/*
472 * 4.3 compat sockaddr, move to compat file later
473 */
474struct osockaddr {
475 u_short sa_family; /* address family */
476 char sa_data[14]; /* up to 14 bytes of direct address */
477};
478
479/*
480 * 4.3-compat message header (move to compat file later).
481 */
482struct omsghdr {
483 caddr_t msg_name; /* optional address */
484 int msg_namelen; /* size of address */
485 struct iovec *msg_iov; /* scatter/gather array */
486 int msg_iovlen; /* # elements in msg_iov */
487 caddr_t msg_accrights; /* access rights sent/received */
488 int msg_accrightslen;
489};
490
491/*
492 * howto arguments for shutdown(2), specified by Posix.1g.
493 */
494#define SHUT_RD 0 /* shut down the reading side */
495#define SHUT_WR 1 /* shut down the writing side */
496#define SHUT_RDWR 2 /* shut down both sides */
497
498#if SENDFILE
499/*
500 * sendfile(2) header/trailer struct
501 */
502struct sf_hdtr {
503 struct iovec *headers; /* pointer to an array of header struct iovec's */
504 int hdr_cnt; /* number of header iovec's */
505 struct iovec *trailers; /* pointer to an array of trailer struct iovec's */
506 int trl_cnt; /* number of trailer iovec's */
507};
508#endif
509
510#ifndef KERNEL
511
512#include <sys/cdefs.h>
513
514__BEGIN_DECLS
55e303ae
A
515int accept __P((int, struct sockaddr *, socklen_t *));
516int bind __P((int, const struct sockaddr *, socklen_t));
517int connect __P((int, const struct sockaddr *, socklen_t));
518int getpeername __P((int, struct sockaddr *, socklen_t *));
519int getsockname __P((int, struct sockaddr *, socklen_t *));
1c79356b
A
520int getsockopt __P((int, int, int, void *, int *));
521int listen __P((int, int));
522ssize_t recv __P((int, void *, size_t, int));
55e303ae 523ssize_t recvfrom __P((int, void *, size_t, int, struct sockaddr *, socklen_t *));
1c79356b
A
524ssize_t recvmsg __P((int, struct msghdr *, int));
525ssize_t send __P((int, const void *, size_t, int));
526ssize_t sendto __P((int, const void *,
55e303ae 527 size_t, int, const struct sockaddr *, socklen_t));
1c79356b
A
528ssize_t sendmsg __P((int, const struct msghdr *, int));
529#if SENDFILE
530int sendfile __P((int, int, off_t, size_t, struct sf_hdtr *, off_t *, int));
531#endif
55e303ae 532int setsockopt __P((int, int, int, const void *, socklen_t));
1c79356b
A
533int shutdown __P((int, int));
534int socket __P((int, int, int));
535int socketpair __P((int, int, int, int *));
9bccf70c
A
536
537void pfctlinput __P((int, struct sockaddr *));
1c79356b
A
538__END_DECLS
539
540#endif /* !KERNEL */
9bccf70c 541
1c79356b 542#endif /* !_SYS_SOCKET_H_ */