199767f8919635c4928607450d9e0abb932109ceToomas Soome * Copyright (c) 1982, 1985, 1986, 1988, 1993, 1994
199767f8919635c4928607450d9e0abb932109ceToomas Soome * The Regents of the University of California. All rights reserved.
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Redistribution and use in source and binary forms, with or without
199767f8919635c4928607450d9e0abb932109ceToomas Soome * modification, are permitted provided that the following conditions
199767f8919635c4928607450d9e0abb932109ceToomas Soome * 1. Redistributions of source code must retain the above copyright
199767f8919635c4928607450d9e0abb932109ceToomas Soome * notice, this list of conditions and the following disclaimer.
199767f8919635c4928607450d9e0abb932109ceToomas Soome * 2. Redistributions in binary form must reproduce the above copyright
199767f8919635c4928607450d9e0abb932109ceToomas Soome * notice, this list of conditions and the following disclaimer in the
199767f8919635c4928607450d9e0abb932109ceToomas Soome * documentation and/or other materials provided with the distribution.
199767f8919635c4928607450d9e0abb932109ceToomas Soome * 4. Neither the name of the University nor the names of its contributors
199767f8919635c4928607450d9e0abb932109ceToomas Soome * may be used to endorse or promote products derived from this software
199767f8919635c4928607450d9e0abb932109ceToomas Soome * without specific prior written permission.
199767f8919635c4928607450d9e0abb932109ceToomas Soome * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
199767f8919635c4928607450d9e0abb932109ceToomas Soome * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
199767f8919635c4928607450d9e0abb932109ceToomas Soome * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
199767f8919635c4928607450d9e0abb932109ceToomas Soome * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
199767f8919635c4928607450d9e0abb932109ceToomas Soome * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
199767f8919635c4928607450d9e0abb932109ceToomas Soome * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
199767f8919635c4928607450d9e0abb932109ceToomas Soome * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
199767f8919635c4928607450d9e0abb932109ceToomas Soome * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
199767f8919635c4928607450d9e0abb932109ceToomas Soome * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
199767f8919635c4928607450d9e0abb932109ceToomas Soome * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
199767f8919635c4928607450d9e0abb932109ceToomas Soome * SUCH DAMAGE.
199767f8919635c4928607450d9e0abb932109ceToomas Soome * @(#)socket.h 8.4 (Berkeley) 2/21/94
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Definitions related to sockets: types, address families, options.
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Data types.
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define SOCK_RDM 4 /* reliably-delivered message */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define SOCK_SEQPACKET 5 /* sequenced packet stream */
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Creation flags, OR'ed into socket() and socketpair() type argument.
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Option flags per-socket.
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define SO_DEBUG 0x0001 /* turn on debugging info recording */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define SO_ACCEPTCONN 0x0002 /* socket has had listen() */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define SO_REUSEADDR 0x0004 /* allow local address reuse */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define SO_KEEPALIVE 0x0008 /* keep connections alive */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define SO_DONTROUTE 0x0010 /* just use interface addresses */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define SO_BROADCAST 0x0020 /* permit sending of broadcast msgs */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define SO_USELOOPBACK 0x0040 /* bypass hardware when possible */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define SO_LINGER 0x0080 /* linger on close if data present */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define SO_OOBINLINE 0x0100 /* leave received OOB data in line */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define SO_REUSEPORT 0x0200 /* allow local address & port reuse */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define SO_TIMESTAMP 0x0400 /* timestamp received dgram traffic */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define SO_NOSIGPIPE 0x0800 /* no SIGPIPE from EPIPE */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define SO_ACCEPTFILTER 0x1000 /* there is an accept filter */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define SO_BINTIME 0x2000 /* timestamp received dgram traffic */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define SO_NO_OFFLOAD 0x4000 /* socket cannot be offloaded */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define SO_NO_DDP 0x8000 /* disable direct data placement */
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Additional options, not kept in so_options.
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define SO_RCVBUF 0x1002 /* receive buffer size */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define SO_SNDLOWAT 0x1003 /* send low-water mark */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define SO_RCVLOWAT 0x1004 /* receive low-water mark */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define SO_RCVTIMEO 0x1006 /* receive timeout */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define SO_ERROR 0x1007 /* get error status and clear */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define SO_LABEL 0x1009 /* socket's MAC label */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define SO_PEERLABEL 0x1010 /* socket's peer's MAC label */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define SO_LISTENQLIMIT 0x1011 /* socket's backlog limit */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define SO_LISTENQLEN 0x1012 /* socket's complete queue length */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define SO_LISTENINCQLEN 0x1013 /* socket's incomplete queue length */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define SO_SETFIB 0x1014 /* use this FIB to route */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define SO_USER_COOKIE 0x1015 /* user cookie (dummynet etc.) */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define SO_PROTOCOL 0x1016 /* get socket protocol (Linux name) */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define SO_PROTOTYPE SO_PROTOCOL /* alias for SO_PROTOCOL (SunOS name) */
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Space reserved for new socket options added by third-party vendors.
199767f8919635c4928607450d9e0abb932109ceToomas Soome * This range applies to all socket option levels. New socket options
199767f8919635c4928607450d9e0abb932109ceToomas Soome * in FreeBSD should always use an option value less than SO_VENDOR.
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Structure used for manipulating linger option.
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Level number for (get/set)sockopt() to apply to socket itself.
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define SOL_SOCKET 0xffff /* options for socket level */
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Address families.
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define AF_LOCAL AF_UNIX /* local to host (pipes, portals) */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define AF_UNIX 1 /* standardized name for AF_LOCAL */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define AF_INET 2 /* internetwork: UDP, TCP, etc. */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define AF_IMPLINK 3 /* arpanet imp addresses */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define AF_ECMA 8 /* European computer manufacturers */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define AF_CCITT 10 /* CCITT protocols, X.25 etc */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define AF_DLI 13 /* DEC Direct data link interface */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define AF_ROUTE 17 /* Internal Routing Protocol */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define pseudo_AF_XTP 19 /* eXpress Transfer Protocol (no AF) */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define AF_COIP 20 /* connection-oriented IP, aka ST II */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define AF_CNT 21 /* Computer Network Technology */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define pseudo_AF_RTIP 22 /* Help Identify RTIP packets */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define AF_IPX 23 /* Novell Internet Protocol */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define AF_SIP 24 /* Simple Internet Protocol */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define pseudo_AF_PIP 25 /* Help Identify PIP packets */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define AF_ISDN 26 /* Integrated Services Digital Network*/
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define AF_E164 AF_ISDN /* CCITT E.164 recommendation */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define pseudo_AF_KEY 27 /* Internal key-management function */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define pseudo_AF_HDRCMPLT 31 /* Used by BPF to not rewrite headers
199767f8919635c4928607450d9e0abb932109ceToomas Soome * in interface output routine
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define AF_SCLUSTER 34 /* Sitara cluster protocol */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define AF_IEEE80211 37 /* IEEE 802.11 protocol */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define AF_INET_SDP 40 /* OFED Socket Direct Protocol ipv4 */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define AF_INET6_SDP 42 /* OFED Socket Direct Protocol ipv6 */
199767f8919635c4928607450d9e0abb932109ceToomas Soome * When allocating a new AF_ constant, please only allocate
199767f8919635c4928607450d9e0abb932109ceToomas Soome * even numbered constants for FreeBSD until 134 as odd numbered AF_
199767f8919635c4928607450d9e0abb932109ceToomas Soome * constants 39-133 are now reserved for vendors.
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Structure used by kernel to store most
199767f8919635c4928607450d9e0abb932109ceToomas Soome * addresses.
199767f8919635c4928607450d9e0abb932109ceToomas Soome char sa_data[14]; /* actually longer; address value */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define SOCK_MAXADDRLEN 255 /* longest possible addresses */
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Structure used by kernel to pass protocol
199767f8919635c4928607450d9e0abb932109ceToomas Soome * information in raw sockets.
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Protocol families, same as address families for now.
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define PF_UNIX PF_LOCAL /* backward compatibility */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define PF_XTP pseudo_AF_XTP /* really just proto family, no AF */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define PF_RTIP pseudo_AF_RTIP /* same format as AF_INET */
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Definitions for network related sysctl, CTL_NET.
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Second level is protocol family.
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Third level is protocol number.
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Further levels are defined by the individual families.
199767f8919635c4928607450d9e0abb932109ceToomas Soome * PF_ROUTE - Routing table
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Three additional levels are defined:
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Fourth: address family, 0 is wildcard
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Fifth: type of info, defined below
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Sixth: flag(s) to mask with for NET_RT_FLAGS
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define NET_RT_DUMP 1 /* dump; may limit to a.f. */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define NET_RT_FLAGS 2 /* by flags, e.g. RESOLVING */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define NET_RT_IFLIST 3 /* survey interface list */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define NET_RT_IFMALIST 4 /* return multicast address list */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define NET_RT_IFLISTL 5 /* Survey interface list, using 'l'en
199767f8919635c4928607450d9e0abb932109ceToomas Soome * versions of msghdr structs. */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#endif /* __BSD_VISIBLE */
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Maximum queue length specifiable by listen.
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Message header for recvmsg and sendmsg calls.
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Used value-result for recvmsg, value only for sendmsg.
199767f8919635c4928607450d9e0abb932109ceToomas Soome struct iovec *msg_iov; /* scatter/gather array */
199767f8919635c4928607450d9e0abb932109ceToomas Soome void *msg_control; /* ancillary data, see below */
199767f8919635c4928607450d9e0abb932109ceToomas Soome socklen_t msg_controllen; /* ancillary data buffer len */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define MSG_OOB 0x1 /* process out-of-band data */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define MSG_PEEK 0x2 /* peek at incoming message */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define MSG_DONTROUTE 0x4 /* send without using routing tables */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define MSG_TRUNC 0x10 /* data discarded before delivery */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define MSG_CTRUNC 0x20 /* control data lost before delivery */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define MSG_WAITALL 0x40 /* wait for full request or error */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define MSG_NOSIGNAL 0x20000 /* do not generate SIGPIPE on EOF */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define MSG_DONTWAIT 0x80 /* this message should be nonblocking */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define MSG_EOF 0x100 /* data completes connection */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define MSG_NOTIFICATION 0x2000 /* SCTP notification */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define MSG_NBIO 0x4000 /* FIONBIO mode, used by fifofs */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define MSG_COMPAT 0x8000 /* used in sendit() */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define MSG_CMSG_CLOEXEC 0x40000 /* make received fds close-on-exec */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define MSG_WAITFORONE 0x80000 /* for recvmmsg() */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define MSG_SOCALLBCK 0x10000 /* for use by socket callbacks - soreceive (TCP) */
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Header for ancillary data objects in msg_control buffer.
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Used for additional information with/about a datagram
199767f8919635c4928607450d9e0abb932109ceToomas Soome * not expressible by flags. The format is a sequence
199767f8919635c4928607450d9e0abb932109ceToomas Soome * of message elements headed by cmsghdr structures.
199767f8919635c4928607450d9e0abb932109ceToomas Soome socklen_t cmsg_len; /* data byte count, including hdr */
199767f8919635c4928607450d9e0abb932109ceToomas Soome/* followed by u_char cmsg_data[]; */
199767f8919635c4928607450d9e0abb932109ceToomas Soome * While we may have more groups than this, the cmsgcred struct must
199767f8919635c4928607450d9e0abb932109ceToomas Soome * be able to fit in an mbuf and we have historically supported a
199767f8919635c4928607450d9e0abb932109ceToomas Soome * maximum of 16 groups.
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Credentials structure, used to verify the identity of a peer
199767f8919635c4928607450d9e0abb932109ceToomas Soome * process that has sent us a message. This is allocated by the
199767f8919635c4928607450d9e0abb932109ceToomas Soome * peer process but filled in by the kernel. This prevents the
199767f8919635c4928607450d9e0abb932109ceToomas Soome * peer from lying about its identity. (Note that cmcred_groups[0]
199767f8919635c4928607450d9e0abb932109ceToomas Soome * is the effective GID.)
199767f8919635c4928607450d9e0abb932109ceToomas Soome uid_t cmcred_uid; /* real UID of sending process */
199767f8919635c4928607450d9e0abb932109ceToomas Soome uid_t cmcred_euid; /* effective UID of sending process */
199767f8919635c4928607450d9e0abb932109ceToomas Soome gid_t cmcred_gid; /* real GID of sending process */
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Socket credentials.
199767f8919635c4928607450d9e0abb932109ceToomas Soome int sc_ngroups; /* number of supplemental groups */
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Compute size of a sockcred structure with groups.
199767f8919635c4928607450d9e0abb932109ceToomas Soome (sizeof(struct sockcred) + (sizeof(gid_t) * ((ngrps) - 1)))
199767f8919635c4928607450d9e0abb932109ceToomas Soome#endif /* __BSD_VISIBLE */
199767f8919635c4928607450d9e0abb932109ceToomas Soome/* given pointer to struct cmsghdr, return pointer to data */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define CMSG_DATA(cmsg) ((unsigned char *)(cmsg) + \
199767f8919635c4928607450d9e0abb932109ceToomas Soome/* given pointer to struct cmsghdr, return pointer to next cmsghdr */
199767f8919635c4928607450d9e0abb932109ceToomas Soome ((char *)(cmsg) == NULL ? CMSG_FIRSTHDR(mhdr) : \
199767f8919635c4928607450d9e0abb932109ceToomas Soome ((char *)(cmsg) + _ALIGN(((struct cmsghdr *)(cmsg))->cmsg_len) + \
199767f8919635c4928607450d9e0abb932109ceToomas Soome (char *)(mhdr)->msg_control + (mhdr)->msg_controllen) ? \
199767f8919635c4928607450d9e0abb932109ceToomas Soome (struct cmsghdr *)0 : \
199767f8919635c4928607450d9e0abb932109ceToomas Soome * RFC 2292 requires to check msg_controllen, in case that the kernel returns
199767f8919635c4928607450d9e0abb932109ceToomas Soome * an empty list for some reasons.
199767f8919635c4928607450d9e0abb932109ceToomas Soome ((mhdr)->msg_controllen >= sizeof(struct cmsghdr) ? \
199767f8919635c4928607450d9e0abb932109ceToomas Soome/* RFC 2292 additions */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define CMSG_SPACE(l) (_ALIGN(sizeof(struct cmsghdr)) + _ALIGN(l))
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define CMSG_LEN(l) (_ALIGN(sizeof(struct cmsghdr)) + (l))
199767f8919635c4928607450d9e0abb932109ceToomas Soome/* "Socket"-level control message types: */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define SCM_RIGHTS 0x01 /* access rights (array of int) */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define SCM_TIMESTAMP 0x02 /* timestamp (struct timeval) */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define SCM_CREDS 0x03 /* process creds (struct cmsgcred) */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define SCM_BINTIME 0x04 /* timestamp (struct bintime) */
199767f8919635c4928607450d9e0abb932109ceToomas Soome * 4.3 compat sockaddr, move to compat file later
199767f8919635c4928607450d9e0abb932109ceToomas Soome char sa_data[14]; /* up to 14 bytes of direct address */
199767f8919635c4928607450d9e0abb932109ceToomas Soome * 4.3-compat message header (move to compat file later).
199767f8919635c4928607450d9e0abb932109ceToomas Soome struct iovec *msg_iov; /* scatter/gather array */
199767f8919635c4928607450d9e0abb932109ceToomas Soome char *msg_accrights; /* access rights sent/received */
199767f8919635c4928607450d9e0abb932109ceToomas Soome * howto arguments for shutdown(2), specified by Posix.1g.
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define SHUT_RD 0 /* shut down the reading side */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define SHUT_WR 1 /* shut down the writing side */
199767f8919635c4928607450d9e0abb932109ceToomas Soome/* for SCTP */
199767f8919635c4928607450d9e0abb932109ceToomas Soome/* we cheat and use the SHUT_XX defines for these */
199767f8919635c4928607450d9e0abb932109ceToomas Soome * sendfile(2) header/trailer struct
199767f8919635c4928607450d9e0abb932109ceToomas Soome struct iovec *headers; /* pointer to an array of header struct iovec's */
199767f8919635c4928607450d9e0abb932109ceToomas Soome struct iovec *trailers; /* pointer to an array of trailer struct iovec's */
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Sendfile-specific flag(s)
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define SF_FLAGS(rh, flags) (((rh) << 16) | (flags))
199767f8919635c4928607450d9e0abb932109ceToomas Soome#endif /* _KERNEL */
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Sendmmsg/recvmmsg specific structure(s)
199767f8919635c4928607450d9e0abb932109ceToomas Soome#endif /* __BSD_VISIBLE */
199767f8919635c4928607450d9e0abb932109ceToomas Soomeint accept(int, struct sockaddr * __restrict, socklen_t * __restrict);
199767f8919635c4928607450d9e0abb932109ceToomas Soomeint bind(int, const struct sockaddr *, socklen_t);
199767f8919635c4928607450d9e0abb932109ceToomas Soomeint connect(int, const struct sockaddr *, socklen_t);
199767f8919635c4928607450d9e0abb932109ceToomas Soomeint accept4(int, struct sockaddr * __restrict, socklen_t * __restrict, int);
199767f8919635c4928607450d9e0abb932109ceToomas Soomeint bindat(int, int, const struct sockaddr *, socklen_t);
199767f8919635c4928607450d9e0abb932109ceToomas Soomeint connectat(int, int, const struct sockaddr *, socklen_t);
199767f8919635c4928607450d9e0abb932109ceToomas Soomeint getpeername(int, struct sockaddr * __restrict, socklen_t * __restrict);
199767f8919635c4928607450d9e0abb932109ceToomas Soomeint getsockname(int, struct sockaddr * __restrict, socklen_t * __restrict);
199767f8919635c4928607450d9e0abb932109ceToomas Soomeint getsockopt(int, int, int, void * __restrict, socklen_t * __restrict);
199767f8919635c4928607450d9e0abb932109ceToomas Soomeint listen(int, int);
199767f8919635c4928607450d9e0abb932109ceToomas Soomessize_t recvfrom(int, void *, size_t, int, struct sockaddr * __restrict, socklen_t * __restrict);
199767f8919635c4928607450d9e0abb932109ceToomas Soomessize_t recvmmsg(int, struct mmsghdr * __restrict, size_t, int,
199767f8919635c4928607450d9e0abb932109ceToomas Soome size_t, int, const struct sockaddr *, socklen_t);
199767f8919635c4928607450d9e0abb932109ceToomas Soomessize_t sendmsg(int, const struct msghdr *, int);
199767f8919635c4928607450d9e0abb932109ceToomas Soomeint sendfile(int, int, off_t, size_t, struct sf_hdtr *, off_t *, int);
199767f8919635c4928607450d9e0abb932109ceToomas Soomessize_t sendmmsg(int, struct mmsghdr * __restrict, size_t, int);
199767f8919635c4928607450d9e0abb932109ceToomas Soomeint setsockopt(int, int, int, const void *, socklen_t);
199767f8919635c4928607450d9e0abb932109ceToomas Soomeint shutdown(int, int);
199767f8919635c4928607450d9e0abb932109ceToomas Soomeint socket(int, int, int);
199767f8919635c4928607450d9e0abb932109ceToomas Soomeint socketpair(int, int, int, int *);
199767f8919635c4928607450d9e0abb932109ceToomas Soome#endif /* !_KERNEL */
199767f8919635c4928607450d9e0abb932109ceToomas Soomestruct sockbuf *so_sockbuf_snd(struct socket *);
199767f8919635c4928607450d9e0abb932109ceToomas Soomestruct sockbuf *so_sockbuf_rcv(struct socket *);
199767f8919635c4928607450d9e0abb932109ceToomas Soomestruct protosw *so_protosw_get(const struct socket *);
199767f8919635c4928607450d9e0abb932109ceToomas Soomevoid so_protosw_set(struct socket *, struct protosw *);
199767f8919635c4928607450d9e0abb932109ceToomas Soomevoid so_listeners_apply_all(struct socket *so, void (*func)(struct socket *, void *), void *arg);
199767f8919635c4928607450d9e0abb932109ceToomas Soome#endif /* !_SYS_SOCKET_H_ */