The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/sys/socket.h

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /*      $NetBSD: socket.h,v 1.68 2003/08/07 16:34:14 agc Exp $  */
    2 
    3 /*
    4  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
    5  * All rights reserved.
    6  * 
    7  * Redistribution and use in source and binary forms, with or without
    8  * modification, are permitted provided that the following conditions
    9  * are met:
   10  * 1. Redistributions of source code must retain the above copyright
   11  *    notice, this list of conditions and the following disclaimer.
   12  * 2. Redistributions in binary form must reproduce the above copyright
   13  *    notice, this list of conditions and the following disclaimer in the
   14  *    documentation and/or other materials provided with the distribution.
   15  * 3. Neither the name of the project nor the names of its contributors
   16  *    may be used to endorse or promote products derived from this software
   17  *    without specific prior written permission.
   18  * 
   19  * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
   20  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   21  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   22  * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
   23  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   24  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   25  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   26  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   27  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   28  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   29  * SUCH DAMAGE.
   30  */
   31 
   32 /*
   33  * Copyright (c) 1982, 1985, 1986, 1988, 1993, 1994
   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. Neither the name of the University nor the names of its contributors
   45  *    may be used to endorse or promote products derived from this software
   46  *    without specific prior written permission.
   47  *
   48  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
   49  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   50  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   51  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
   52  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   53  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   54  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   55  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   56  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   57  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   58  * SUCH DAMAGE.
   59  *
   60  *      @(#)socket.h    8.6 (Berkeley) 5/3/95
   61  */
   62 
   63 #ifndef _SYS_SOCKET_H_
   64 #define _SYS_SOCKET_H_
   65 
   66 #include <sys/featuretest.h>
   67 
   68 /*
   69  * Definitions related to sockets: types, address families, options.
   70  */
   71 
   72 /*
   73  * Data types.
   74  */
   75 #include <sys/ansi.h>
   76 
   77 #ifndef sa_family_t
   78 typedef __sa_family_t   sa_family_t;
   79 #define sa_family_t     __sa_family_t
   80 #endif
   81 
   82 #ifndef socklen_t
   83 typedef __socklen_t     socklen_t;
   84 #define socklen_t       __socklen_t
   85 #endif
   86 
   87 #include <machine/ansi.h>
   88 
   89 #ifdef  _BSD_SIZE_T_
   90 typedef _BSD_SIZE_T_    size_t;
   91 #undef  _BSD_SIZE_T_
   92 #endif
   93 
   94 #ifdef  _BSD_SSIZE_T_
   95 typedef _BSD_SSIZE_T_   ssize_t;
   96 #undef  _BSD_SSIZE_T_
   97 #endif
   98 
   99 #include <sys/uio.h>
  100 
  101 /*
  102  * Socket types.
  103  */
  104 #define SOCK_STREAM     1               /* stream socket */
  105 #define SOCK_DGRAM      2               /* datagram socket */
  106 #define SOCK_RAW        3               /* raw-protocol interface */
  107 #define SOCK_RDM        4               /* reliably-delivered message */
  108 #define SOCK_SEQPACKET  5               /* sequenced packet stream */
  109 
  110 /*
  111  * Option flags per-socket.
  112  */
  113 #define SO_DEBUG        0x0001          /* turn on debugging info recording */
  114 #define SO_ACCEPTCONN   0x0002          /* socket has had listen() */
  115 #define SO_REUSEADDR    0x0004          /* allow local address reuse */
  116 #define SO_KEEPALIVE    0x0008          /* keep connections alive */
  117 #define SO_DONTROUTE    0x0010          /* just use interface addresses */
  118 #define SO_BROADCAST    0x0020          /* permit sending of broadcast msgs */
  119 #define SO_USELOOPBACK  0x0040          /* bypass hardware when possible */
  120 #define SO_LINGER       0x0080          /* linger on close if data present */
  121 #define SO_OOBINLINE    0x0100          /* leave received OOB data in line */
  122 #define SO_REUSEPORT    0x0200          /* allow local address & port reuse */
  123 #define SO_TIMESTAMP    0x0400          /* timestamp received dgram traffic */
  124 
  125 /*
  126  * Additional options, not kept in so_options.
  127  */
  128 #define SO_SNDBUF       0x1001          /* send buffer size */
  129 #define SO_RCVBUF       0x1002          /* receive buffer size */
  130 #define SO_SNDLOWAT     0x1003          /* send low-water mark */
  131 #define SO_RCVLOWAT     0x1004          /* receive low-water mark */
  132 #define SO_SNDTIMEO     0x1005          /* send timeout */
  133 #define SO_RCVTIMEO     0x1006          /* receive timeout */
  134 #define SO_ERROR        0x1007          /* get error status and clear */
  135 #define SO_TYPE         0x1008          /* get socket type */
  136 
  137 /*
  138  * Structure used for manipulating linger option.
  139  */
  140 struct  linger {
  141         int     l_onoff;                /* option on/off */
  142         int     l_linger;               /* linger time in seconds */
  143 };
  144 
  145 /*
  146  * Level number for (get/set)sockopt() to apply to socket itself.
  147  */
  148 #define SOL_SOCKET      0xffff          /* options for socket level */
  149 
  150 /*
  151  * Address families.
  152  */
  153 #define AF_UNSPEC       0               /* unspecified */
  154 #define AF_LOCAL        1               /* local to host (pipes, portals) */
  155 #define AF_UNIX         AF_LOCAL        /* backward compatibility */
  156 #define AF_INET         2               /* internetwork: UDP, TCP, etc. */
  157 #define AF_IMPLINK      3               /* arpanet imp addresses */
  158 #define AF_PUP          4               /* pup protocols: e.g. BSP */
  159 #define AF_CHAOS        5               /* mit CHAOS protocols */
  160 #define AF_NS           6               /* XEROX NS protocols */
  161 #define AF_ISO          7               /* ISO protocols */
  162 #define AF_OSI          AF_ISO
  163 #define AF_ECMA         8               /* european computer manufacturers */
  164 #define AF_DATAKIT      9               /* datakit protocols */
  165 #define AF_CCITT        10              /* CCITT protocols, X.25 etc */
  166 #define AF_SNA          11              /* IBM SNA */
  167 #define AF_DECnet       12              /* DECnet */
  168 #define AF_DLI          13              /* DEC Direct data link interface */
  169 #define AF_LAT          14              /* LAT */
  170 #define AF_HYLINK       15              /* NSC Hyperchannel */
  171 #define AF_APPLETALK    16              /* Apple Talk */
  172 #define AF_ROUTE        17              /* Internal Routing Protocol */
  173 #define AF_LINK         18              /* Link layer interface */
  174 #if defined(_NETBSD_SOURCE)
  175 #define pseudo_AF_XTP   19              /* eXpress Transfer Protocol (no AF) */
  176 #endif
  177 #define AF_COIP         20              /* connection-oriented IP, aka ST II */
  178 #define AF_CNT          21              /* Computer Network Technology */
  179 #if defined(_NETBSD_SOURCE)
  180 #define pseudo_AF_RTIP  22              /* Help Identify RTIP packets */
  181 #endif
  182 #define AF_IPX          23              /* Novell Internet Protocol */
  183 #define AF_INET6        24              /* IP version 6 */
  184 #if defined(_NETBSD_SOURCE)
  185 #define pseudo_AF_PIP   25              /* Help Identify PIP packets */
  186 #endif
  187 #define AF_ISDN         26              /* Integrated Services Digital Network*/
  188 #define AF_E164         AF_ISDN         /* CCITT E.164 recommendation */
  189 #define AF_NATM         27              /* native ATM access */
  190 #define AF_ARP          28              /* (rev.) addr. res. prot. (RFC 826) */
  191 #if defined(_NETBSD_SOURCE)
  192 #define pseudo_AF_KEY   29              /* Internal key management protocol  */
  193 #define pseudo_AF_HDRCMPLT 30           /* Used by BPF to not rewrite hdrs
  194                                            in interface output routine */
  195 #endif
  196 
  197 #define AF_MAX          31
  198 
  199 /*
  200  * Structure used by kernel to store most
  201  * addresses.
  202  */
  203 struct sockaddr {
  204         __uint8_t       sa_len;         /* total length */
  205         sa_family_t     sa_family;      /* address family */
  206         char            sa_data[14];    /* actually longer; address value */
  207 };
  208 
  209 #if defined(_KERNEL)
  210 /*
  211  * Structure used by kernel to pass protocol
  212  * information in raw sockets.
  213  */
  214 struct sockproto {
  215         u_short sp_family;              /* address family */
  216         u_short sp_protocol;            /* protocol */
  217 };
  218 #endif /* _KERNEL */
  219 
  220 #if 1
  221 /*
  222  * RFC 2553: protocol-independent placeholder for socket addresses
  223  */
  224 #define _SS_MAXSIZE     128
  225 #define _SS_ALIGNSIZE   (sizeof(__int64_t))
  226 #define _SS_PAD1SIZE    (_SS_ALIGNSIZE - 2)
  227 #define _SS_PAD2SIZE    (_SS_MAXSIZE - 2 - \
  228                                 _SS_PAD1SIZE - _SS_ALIGNSIZE)
  229 
  230 #if (_XOPEN_SOURCE - 0) >= 500 || defined(_NETBSD_SOURCE)
  231 struct sockaddr_storage {
  232         __uint8_t       ss_len;         /* address length */
  233         sa_family_t     ss_family;      /* address family */
  234         char            __ss_pad1[_SS_PAD1SIZE];
  235         __int64_t     __ss_align;/* force desired structure storage alignment */
  236         char            __ss_pad2[_SS_PAD2SIZE];
  237 };
  238 #endif /* _XOPEN_SOURCE >= 500 || _NETBSD_SOURCE */
  239 #endif /* 1 */
  240 
  241 /*
  242  * Protocol families, same as address families for now.
  243  */
  244 #define PF_UNSPEC       AF_UNSPEC
  245 #define PF_LOCAL        AF_LOCAL
  246 #define PF_UNIX         PF_LOCAL        /* backward compatibility */
  247 #define PF_INET         AF_INET
  248 #define PF_IMPLINK      AF_IMPLINK
  249 #define PF_PUP          AF_PUP
  250 #define PF_CHAOS        AF_CHAOS
  251 #define PF_NS           AF_NS
  252 #define PF_ISO          AF_ISO
  253 #define PF_OSI          AF_ISO
  254 #define PF_ECMA         AF_ECMA
  255 #define PF_DATAKIT      AF_DATAKIT
  256 #define PF_CCITT        AF_CCITT
  257 #define PF_SNA          AF_SNA
  258 #define PF_DECnet       AF_DECnet
  259 #define PF_DLI          AF_DLI
  260 #define PF_LAT          AF_LAT
  261 #define PF_HYLINK       AF_HYLINK
  262 #define PF_APPLETALK    AF_APPLETALK
  263 #define PF_ROUTE        AF_ROUTE
  264 #define PF_LINK         AF_LINK
  265 #if defined(_NETBSD_SOURCE)
  266 #define PF_XTP          pseudo_AF_XTP   /* really just proto family, no AF */
  267 #endif
  268 #define PF_COIP         AF_COIP
  269 #define PF_CNT          AF_CNT
  270 #define PF_INET6        AF_INET6
  271 #define PF_IPX          AF_IPX          /* same format as AF_NS */
  272 #if defined(_NETBSD_SOURCE)
  273 #define PF_RTIP         pseudo_AF_FTIP  /* same format as AF_INET */
  274 #define PF_PIP          pseudo_AF_PIP
  275 #endif
  276 #define PF_ISDN         AF_ISDN         /* same as E164 */
  277 #define PF_E164         AF_E164
  278 #define PF_NATM         AF_NATM
  279 #define PF_ARP          AF_ARP
  280 #if defined(_NETBSD_SOURCE)
  281 #define PF_KEY          pseudo_AF_KEY   /* like PF_ROUTE, only for key mgmt */
  282 #endif
  283 
  284 #define PF_MAX          AF_MAX
  285 
  286 #if defined(_NETBSD_SOURCE)
  287 
  288 #ifndef gid_t
  289 typedef __gid_t         gid_t;          /* group id */
  290 #define gid_t           __gid_t
  291 #endif
  292 
  293 #ifndef uid_t
  294 typedef __uid_t         uid_t;          /* user id */
  295 #define uid_t           __uid_t
  296 #endif
  297 
  298 /*
  299  * Socket credentials.
  300  */
  301 struct sockcred {
  302         uid_t   sc_uid;                 /* real user id */
  303         uid_t   sc_euid;                /* effective user id */
  304         gid_t   sc_gid;                 /* real group id */
  305         gid_t   sc_egid;                /* effective group id */
  306         int     sc_ngroups;             /* number of supplemental groups */
  307         gid_t   sc_groups[1];           /* variable length */
  308 };
  309 
  310 /*
  311  * Compute size of a sockcred structure with groups.
  312  */
  313 #define SOCKCREDSIZE(ngrps) \
  314         (sizeof(struct sockcred) + (sizeof(gid_t) * ((ngrps) - 1)))
  315 #endif /* _NETBSD_SOURCE */
  316 
  317 
  318 #if defined(_NETBSD_SOURCE)
  319 /*
  320  * Definitions for network related sysctl, CTL_NET.
  321  *
  322  * Second level is protocol family.
  323  * Third level is protocol number.
  324  *
  325  * Further levels are defined by the individual families below.
  326  */
  327 #define NET_MAXID       AF_MAX
  328 
  329 #define CTL_NET_NAMES { \
  330         { 0, 0 }, \
  331         { "local", CTLTYPE_NODE }, \
  332         { "inet", CTLTYPE_NODE }, \
  333         { "implink", CTLTYPE_NODE }, \
  334         { "pup", CTLTYPE_NODE }, \
  335         { "chaos", CTLTYPE_NODE }, \
  336         { "xerox_ns", CTLTYPE_NODE }, \
  337         { "iso", CTLTYPE_NODE }, \
  338         { "emca", CTLTYPE_NODE }, \
  339         { "datakit", CTLTYPE_NODE }, \
  340         { "ccitt", CTLTYPE_NODE }, \
  341         { "ibm_sna", CTLTYPE_NODE }, \
  342         { "decnet", CTLTYPE_NODE }, \
  343         { "dec_dli", CTLTYPE_NODE }, \
  344         { "lat", CTLTYPE_NODE }, \
  345         { "hylink", CTLTYPE_NODE }, \
  346         { "appletalk", CTLTYPE_NODE }, \
  347         { "route", CTLTYPE_NODE }, \
  348         { "link_layer", CTLTYPE_NODE }, \
  349         { "xtp", CTLTYPE_NODE }, \
  350         { "coip", CTLTYPE_NODE }, \
  351         { "cnt", CTLTYPE_NODE }, \
  352         { "rtip", CTLTYPE_NODE }, \
  353         { "ipx", CTLTYPE_NODE }, \
  354         { "inet6", CTLTYPE_NODE }, \
  355         { "pip", CTLTYPE_NODE }, \
  356         { "isdn", CTLTYPE_NODE }, \
  357         { "natm", CTLTYPE_NODE }, \
  358         { "arp", CTLTYPE_NODE }, \
  359         { "key", CTLTYPE_NODE }, \
  360 }
  361 #endif /* _NETBSD_SOURCE */
  362 
  363 #if defined(_NETBSD_SOURCE)
  364 /*
  365  * PF_ROUTE - Routing table
  366  *
  367  * Three additional levels are defined:
  368  *      Fourth: address family, 0 is wildcard
  369  *      Fifth: type of info, defined below
  370  *      Sixth: flag(s) to mask with for NET_RT_FLAGS
  371  */
  372 #define NET_RT_DUMP     1               /* dump; may limit to a.f. */
  373 #define NET_RT_FLAGS    2               /* by flags, e.g. RESOLVING */
  374 #define NET_RT_OIFLIST  3               /* old NET_RT_IFLIST (pre 1.5) */
  375 #define NET_RT_IFLIST   4               /* survey interface list */
  376 #define NET_RT_MAXID    5
  377 
  378 #define CTL_NET_RT_NAMES { \
  379         { 0, 0 }, \
  380         { "dump", CTLTYPE_STRUCT }, \
  381         { "flags", CTLTYPE_STRUCT }, \
  382         { 0, 0 }, \
  383         { "iflist", CTLTYPE_STRUCT }, \
  384 }
  385 #endif /* _NETBSD_SOURCE */
  386 
  387 /*
  388  * Maximum queue length specifiable by listen(2).
  389  */
  390 #ifndef SOMAXCONN
  391 #define SOMAXCONN       128
  392 #endif
  393 
  394 /*
  395  * Message header for recvmsg and sendmsg calls.
  396  * Used value-result for recvmsg, value only for sendmsg.
  397  */
  398 struct msghdr {
  399         void            *msg_name;      /* optional address */
  400         socklen_t       msg_namelen;    /* size of address */
  401         struct iovec    *msg_iov;       /* scatter/gather array */
  402         int             msg_iovlen;     /* # elements in msg_iov */
  403         void            *msg_control;   /* ancillary data, see below */
  404         socklen_t       msg_controllen; /* ancillary data buffer len */
  405         int             msg_flags;      /* flags on received message */
  406 };
  407 
  408 #define MSG_OOB         0x1             /* process out-of-band data */
  409 #define MSG_PEEK        0x2             /* peek at incoming message */
  410 #define MSG_DONTROUTE   0x4             /* send without using routing tables */
  411 #define MSG_EOR         0x8             /* data completes record */
  412 #define MSG_TRUNC       0x10            /* data discarded before delivery */
  413 #define MSG_CTRUNC      0x20            /* control data lost before delivery */
  414 #define MSG_WAITALL     0x40            /* wait for full request or error */
  415 #define MSG_DONTWAIT    0x80            /* this message should be nonblocking */
  416 #define MSG_BCAST       0x100           /* this message was rcvd using link-level brdcst */
  417 #define MSG_MCAST       0x200           /* this message was rcvd using link-level mcast */
  418 
  419 /*
  420  * Header for ancillary data objects in msg_control buffer.
  421  * Used for additional information with/about a datagram
  422  * not expressible by flags.  The format is a sequence
  423  * of message elements headed by cmsghdr structures.
  424  */
  425 struct cmsghdr {
  426         socklen_t       cmsg_len;       /* data byte count, including hdr */
  427         int             cmsg_level;     /* originating protocol */
  428         int             cmsg_type;      /* protocol-specific type */
  429 /* followed by  u_char  cmsg_data[]; */
  430 };
  431 
  432 /* given pointer to struct cmsghdr, return pointer to data */
  433 #define CMSG_DATA(cmsg) \
  434         ((u_char *)(void *)(cmsg) + __CMSG_ALIGN(sizeof(struct cmsghdr)))
  435 
  436 /*
  437  * Alignment requirement for CMSG struct manipulation.
  438  * This basically behaves the same as ALIGN() ARCH/include/param.h.
  439  * We declare it separately for two reasons:
  440  * (1) avoid dependency between machine/param.h, and (2) to sync with kernel's
  441  * idea of ALIGNBYTES at runtime.
  442  * without (2), we can't guarantee binary compatibility in case of future
  443  * changes in ALIGNBYTES.
  444  */
  445 #define __CMSG_ALIGN(n) (((n) + __cmsg_alignbytes()) & ~__cmsg_alignbytes())
  446 #ifdef _KERNEL
  447 #define CMSG_ALIGN(n)   __CMSG_ALIGN(n)
  448 #endif
  449 
  450 /* given pointer to struct cmsghdr, return pointer to next cmsghdr */
  451 #define CMSG_NXTHDR(mhdr, cmsg) \
  452         (((__caddr_t)(cmsg) + __CMSG_ALIGN((cmsg)->cmsg_len) + \
  453                             __CMSG_ALIGN(sizeof(struct cmsghdr)) > \
  454             (((__caddr_t)(mhdr)->msg_control) + (mhdr)->msg_controllen)) ? \
  455             (struct cmsghdr *)NULL : \
  456             (struct cmsghdr *)((__caddr_t)(cmsg) + \
  457                 __CMSG_ALIGN((cmsg)->cmsg_len)))
  458 
  459 /*
  460  * RFC 2292 requires to check msg_controllen, in case that the kernel returns
  461  * an empty list for some reasons.
  462  */
  463 #define CMSG_FIRSTHDR(mhdr) \
  464         ((mhdr)->msg_controllen >= sizeof(struct cmsghdr) ? \
  465          (struct cmsghdr *)(mhdr)->msg_control : \
  466          (struct cmsghdr *)NULL)
  467 
  468 #define CMSG_SPACE(l)   (__CMSG_ALIGN(sizeof(struct cmsghdr)) + __CMSG_ALIGN(l))
  469 #define CMSG_LEN(l)     (__CMSG_ALIGN(sizeof(struct cmsghdr)) + (l))
  470 
  471 /* "Socket"-level control message types: */
  472 #define SCM_RIGHTS      0x01            /* access rights (array of int) */
  473 #if defined(_NETBSD_SOURCE)
  474 #define SCM_TIMESTAMP   0x02            /* timestamp (struct timeval) */
  475 #define SCM_CREDS       0x04            /* credentials (struct sockcred) */
  476 #endif
  477 
  478 /*
  479  * Types of socket shutdown(2).
  480  */
  481 #define SHUT_RD         0               /* Disallow further receives. */
  482 #define SHUT_WR         1               /* Disallow further sends. */
  483 #define SHUT_RDWR       2               /* Disallow further sends/receives. */
  484 
  485 #if defined(_NETBSD_SOURCE)
  486 /*
  487  * 4.3 compat sockaddr, move to compat file later
  488  */
  489 struct osockaddr {
  490         __uint16_t      sa_family;      /* address family */
  491         char            sa_data[14];    /* up to 14 bytes of direct address */
  492 };
  493 
  494 /*
  495  * 4.3-compat message header (move to compat file later).
  496  */
  497 struct omsghdr {
  498         __caddr_t       msg_name;       /* optional address */
  499         int             msg_namelen;    /* size of address */
  500         struct iovec    *msg_iov;       /* scatter/gather array */
  501         int             msg_iovlen;     /* # elements in msg_iov */
  502         __caddr_t       msg_accrights;  /* access rights sent/received */
  503         int             msg_accrightslen;
  504 };
  505 #endif
  506 
  507 #include <sys/cdefs.h>
  508 
  509 __BEGIN_DECLS
  510 int     __cmsg_alignbytes __P((void));
  511 __END_DECLS
  512 
  513 #ifndef _KERNEL
  514 
  515 __BEGIN_DECLS
  516 int     accept __P((int, struct sockaddr * __restrict, socklen_t * __restrict));
  517 int     bind __P((int, const struct sockaddr *, socklen_t));
  518 int     connect __P((int, const struct sockaddr *, socklen_t));
  519 int     getpeername __P((int, struct sockaddr * __restrict,
  520             socklen_t * __restrict));
  521 int     getsockname __P((int, struct sockaddr * __restrict,
  522             socklen_t * __restrict));
  523 int     getsockopt __P((int, int, int, void * __restrict,
  524             socklen_t * __restrict));
  525 int     listen __P((int, int));
  526 ssize_t recv __P((int, void *, size_t, int));
  527 ssize_t recvfrom __P((int, void * __restrict, size_t, int,
  528             struct sockaddr * __restrict, socklen_t * __restrict));
  529 ssize_t recvmsg __P((int, struct msghdr *, int));
  530 ssize_t send __P((int, const void *, size_t, int));
  531 ssize_t sendto __P((int, const void *,
  532             size_t, int, const struct sockaddr *, socklen_t));
  533 ssize_t sendmsg __P((int, const struct msghdr *, int));
  534 int     setsockopt __P((int, int, int, const void *, socklen_t));
  535 int     shutdown __P((int, int));
  536 int     sockatmark __P((int));
  537 int     socket __P((int, int, int));
  538 int     socketpair __P((int, int, int, int *));
  539 __END_DECLS
  540 #endif /* !_KERNEL */
  541 
  542 #endif /* !_SYS_SOCKET_H_ */

Cache object: 3790af0b01f326c3081014f2b7b35d45


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.