1/* $NetBSD: socket.h,v 1.82 2006/06/27 03:49:08 mrg 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 78typedef __sa_family_t sa_family_t; 79#define sa_family_t __sa_family_t 80#endif 81 82#ifndef socklen_t 83typedef __socklen_t socklen_t; 84#define socklen_t __socklen_t 85#endif 86 87#include <machine/ansi.h> 88 89#ifdef _EFI_SIZE_T_ 90typedef _EFI_SIZE_T_ size_t; 91#undef _EFI_SIZE_T_ 92#undef _BSD_SIZE_T_ 93#endif 94 95#ifdef _BSD_SSIZE_T_ 96typedef _BSD_SSIZE_T_ ssize_t; 97#undef _BSD_SSIZE_T_ 98#endif 99 100#include <sys/uio.h> 101 102/* 103 * Socket types. 104 */ 105#define SOCK_STREAM 1 /* stream socket */ 106#define SOCK_DGRAM 2 /* datagram socket */ 107#define SOCK_RAW 3 /* raw-protocol interface */ 108#define SOCK_RDM 4 /* reliably-delivered message */ 109#define SOCK_SEQPACKET 5 /* sequenced packet stream */ 110 111/* 112 * Option flags per-socket. 113 */ 114#define SO_DEBUG 0x0001 /* turn on debugging info recording */ 115#define SO_ACCEPTCONN 0x0002 /* socket has had listen() */ 116#define SO_REUSEADDR 0x0004 /* allow local address reuse */ 117#define SO_KEEPALIVE 0x0008 /* keep connections alive */ 118#define SO_DONTROUTE 0x0010 /* just use interface addresses */ 119#define SO_BROADCAST 0x0020 /* permit sending of broadcast msgs */ 120#define SO_USELOOPBACK 0x0040 /* bypass hardware when possible */ 121#define SO_LINGER 0x0080 /* linger on close if data present */ 122#define SO_OOBINLINE 0x0100 /* leave received OOB data in line */ 123#define SO_REUSEPORT 0x0200 /* allow local address & port reuse */ 124#define SO_TIMESTAMP 0x0400 /* timestamp received dgram traffic */ 125 126 127/* 128 * Additional options, not kept in so_options. 129 */ 130#define SO_SNDBUF 0x1001 /* send buffer size */ 131#define SO_RCVBUF 0x1002 /* receive buffer size */ 132#define SO_SNDLOWAT 0x1003 /* send low-water mark */ 133#define SO_RCVLOWAT 0x1004 /* receive low-water mark */ 134#define SO_SNDTIMEO 0x1005 /* send timeout */ 135#define SO_RCVTIMEO 0x1006 /* receive timeout */ 136#define SO_ERROR 0x1007 /* get error status and clear */ 137#define SO_TYPE 0x1008 /* get socket type */ 138#define SO_OVERFLOWED 0x1009 /* datagrams: return packets dropped */ 139 140/* 141 * Structure used for manipulating linger option. 142 */ 143struct linger { 144 int l_onoff; /* option on/off */ 145 int l_linger; /* linger time in seconds */ 146}; 147 148/* 149 * Level number for (get/set)sockopt() to apply to socket itself. 150 */ 151#define SOL_SOCKET 0xffff /* options for socket level */ 152 153/* 154 * Address families. 155 */ 156#define AF_UNSPEC 0 /* unspecified */ 157#define AF_LOCAL 1 /* local to host (pipes, portals) */ 158#define AF_UNIX AF_LOCAL /* backward compatibility */ 159#define AF_INET 2 /* internetwork: UDP, TCP, etc. */ 160#define AF_IMPLINK 3 /* arpanet imp addresses */ 161#define AF_PUP 4 /* pup protocols: e.g. BSP */ 162#define AF_CHAOS 5 /* mit CHAOS protocols */ 163#define AF_NS 6 /* XEROX NS protocols */ 164#define AF_ISO 7 /* ISO protocols */ 165#define AF_OSI AF_ISO 166#define AF_ECMA 8 /* european computer manufacturers */ 167#define AF_DATAKIT 9 /* datakit protocols */ 168#define AF_CCITT 10 /* CCITT protocols, X.25 etc */ 169#define AF_SNA 11 /* IBM SNA */ 170#define AF_DECnet 12 /* DECnet */ 171#define AF_DLI 13 /* DEC Direct data link interface */ 172#define AF_LAT 14 /* LAT */ 173#define AF_HYLINK 15 /* NSC Hyperchannel */ 174#define AF_APPLETALK 16 /* Apple Talk */ 175#define AF_ROUTE 17 /* Internal Routing Protocol */ 176#define AF_LINK 18 /* Link layer interface */ 177#if defined(_NETBSD_SOURCE) 178#define pseudo_AF_XTP 19 /* eXpress Transfer Protocol (no AF) */ 179#endif 180#define AF_COIP 20 /* connection-oriented IP, aka ST II */ 181#define AF_CNT 21 /* Computer Network Technology */ 182#if defined(_NETBSD_SOURCE) 183#define pseudo_AF_RTIP 22 /* Help Identify RTIP packets */ 184#endif 185#define AF_IPX 23 /* Novell Internet Protocol */ 186#define AF_INET6 24 /* IP version 6 */ 187#if defined(_NETBSD_SOURCE) 188#define pseudo_AF_PIP 25 /* Help Identify PIP packets */ 189#endif 190#define AF_ISDN 26 /* Integrated Services Digital Network*/ 191#define AF_E164 AF_ISDN /* CCITT E.164 recommendation */ 192#define AF_NATM 27 /* native ATM access */ 193#define AF_ARP 28 /* (rev.) addr. res. prot. (RFC 826) */ 194#if defined(_NETBSD_SOURCE) 195#define pseudo_AF_KEY 29 /* Internal key management protocol */ 196#define pseudo_AF_HDRCMPLT 30 /* Used by BPF to not rewrite hdrs 197 in interface output routine */ 198#endif 199#define AF_BLUETOOTH 31 200 201#define AF_MAX 32 202 203/* 204 * Structure used by kernel to store most 205 * addresses. 206 */ 207struct sockaddr { 208 __uint8_t sa_len; /* total length */ 209 sa_family_t sa_family; /* address family */ 210 char sa_data[14]; /* actually longer; address value */ 211}; 212 213#if defined(_KERNEL) 214/* 215 * Structure used by kernel to pass protocol 216 * information in raw sockets. 217 */ 218struct sockproto { 219 u_short sp_family; /* address family */ 220 u_short sp_protocol; /* protocol */ 221}; 222#endif /* _KERNEL */ 223 224#if 1 225/* 226 * RFC 2553: protocol-independent placeholder for socket addresses 227 */ 228#define _SS_MAXSIZE 128 229#define _SS_ALIGNSIZE (sizeof(__int64_t)) 230#define _SS_PAD1SIZE (_SS_ALIGNSIZE - 2) 231#define _SS_PAD2SIZE (_SS_MAXSIZE - 2 - \ 232 _SS_PAD1SIZE - _SS_ALIGNSIZE) 233 234#if (_XOPEN_SOURCE - 0) >= 500 || defined(_NETBSD_SOURCE) 235struct sockaddr_storage { 236 __uint8_t ss_len; /* address length */ 237 sa_family_t ss_family; /* address family */ 238 char __ss_pad1[_SS_PAD1SIZE]; 239 __int64_t __ss_align;/* force desired structure storage alignment */ 240 char __ss_pad2[_SS_PAD2SIZE]; 241}; 242#endif /* _XOPEN_SOURCE >= 500 || _NETBSD_SOURCE */ 243#endif /* 1 */ 244 245/* 246 * Protocol families, same as address families for now. 247 */ 248#define PF_UNSPEC AF_UNSPEC 249#define PF_LOCAL AF_LOCAL 250#define PF_UNIX PF_LOCAL /* backward compatibility */ 251#define PF_INET AF_INET 252#define PF_IMPLINK AF_IMPLINK 253#define PF_PUP AF_PUP 254#define PF_CHAOS AF_CHAOS 255#define PF_NS AF_NS 256#define PF_ISO AF_ISO 257#define PF_OSI AF_ISO 258#define PF_ECMA AF_ECMA 259#define PF_DATAKIT AF_DATAKIT 260#define PF_CCITT AF_CCITT 261#define PF_SNA AF_SNA 262#define PF_DECnet AF_DECnet 263#define PF_DLI AF_DLI 264#define PF_LAT AF_LAT 265#define PF_HYLINK AF_HYLINK 266#define PF_APPLETALK AF_APPLETALK 267#define PF_ROUTE AF_ROUTE 268#define PF_LINK AF_LINK 269#if defined(_NETBSD_SOURCE) 270#define PF_XTP pseudo_AF_XTP /* really just proto family, no AF */ 271#endif 272#define PF_COIP AF_COIP 273#define PF_CNT AF_CNT 274#define PF_INET6 AF_INET6 275#define PF_IPX AF_IPX /* same format as AF_NS */ 276#if defined(_NETBSD_SOURCE) 277#define PF_RTIP pseudo_AF_RTIP /* same format as AF_INET */ 278#define PF_PIP pseudo_AF_PIP 279#endif 280#define PF_ISDN AF_ISDN /* same as E164 */ 281#define PF_E164 AF_E164 282#define PF_NATM AF_NATM 283#define PF_ARP AF_ARP 284#if defined(_NETBSD_SOURCE) 285#define PF_KEY pseudo_AF_KEY /* like PF_ROUTE, only for key mgmt */ 286#endif 287#define PF_BLUETOOTH AF_BLUETOOTH 288 289#define PF_MAX AF_MAX 290 291#if defined(_NETBSD_SOURCE) 292 293#ifndef gid_t 294typedef __gid_t gid_t; /* group id */ 295#define gid_t __gid_t 296#endif 297 298#ifndef uid_t 299typedef __uid_t uid_t; /* user id */ 300#define uid_t __uid_t 301#endif 302 303/* 304 * Socket credentials. 305 */ 306struct sockcred { 307 uid_t sc_uid; /* real user id */ 308 uid_t sc_euid; /* effective user id */ 309 gid_t sc_gid; /* real group id */ 310 gid_t sc_egid; /* effective group id */ 311 int sc_ngroups; /* number of supplemental groups */ 312 gid_t sc_groups[1]; /* variable length */ 313}; 314 315/* 316 * Compute size of a sockcred structure with groups. 317 */ 318#define SOCKCREDSIZE(ngrps) \ 319 (sizeof(struct sockcred) + (sizeof(gid_t) * ((ngrps) - 1))) 320#endif /* _NETBSD_SOURCE */ 321 322 323#if defined(_NETBSD_SOURCE) 324/* 325 * Definitions for network related sysctl, CTL_NET. 326 * 327 * Second level is protocol family. 328 * Third level is protocol number. 329 * 330 * Further levels are defined by the individual families below. 331 */ 332#define NET_MAXID AF_MAX 333 334#define CTL_NET_NAMES { \ 335 { 0, 0 }, \ 336 { "local", CTLTYPE_NODE }, \ 337 { "inet", CTLTYPE_NODE }, \ 338 { "implink", CTLTYPE_NODE }, \ 339 { "pup", CTLTYPE_NODE }, \ 340 { "chaos", CTLTYPE_NODE }, \ 341 { "xerox_ns", CTLTYPE_NODE }, \ 342 { "iso", CTLTYPE_NODE }, \ 343 { "emca", CTLTYPE_NODE }, \ 344 { "datakit", CTLTYPE_NODE }, \ 345 { "ccitt", CTLTYPE_NODE }, \ 346 { "ibm_sna", CTLTYPE_NODE }, \ 347 { "decnet", CTLTYPE_NODE }, \ 348 { "dec_dli", CTLTYPE_NODE }, \ 349 { "lat", CTLTYPE_NODE }, \ 350 { "hylink", CTLTYPE_NODE }, \ 351 { "appletalk", CTLTYPE_NODE }, \ 352 { "route", CTLTYPE_NODE }, \ 353 { "link_layer", CTLTYPE_NODE }, \ 354 { "xtp", CTLTYPE_NODE }, \ 355 { "coip", CTLTYPE_NODE }, \ 356 { "cnt", CTLTYPE_NODE }, \ 357 { "rtip", CTLTYPE_NODE }, \ 358 { "ipx", CTLTYPE_NODE }, \ 359 { "inet6", CTLTYPE_NODE }, \ 360 { "pip", CTLTYPE_NODE }, \ 361 { "isdn", CTLTYPE_NODE }, \ 362 { "natm", CTLTYPE_NODE }, \ 363 { "arp", CTLTYPE_NODE }, \ 364 { "key", CTLTYPE_NODE }, \ 365} 366 367struct kinfo_pcb { 368 __uint64_t ki_pcbaddr; /* PTR: pcb addr */ 369 __uint64_t ki_ppcbaddr; /* PTR: ppcb addr */ 370 __uint64_t ki_sockaddr; /* PTR: socket addr */ 371 372 __uint32_t ki_family; /* INT: protocol family */ 373 __uint32_t ki_type; /* INT: socket type */ 374 __uint32_t ki_protocol; /* INT: protocol */ 375 __uint32_t ki_pflags; /* INT: generic protocol flags */ 376 377 __uint32_t ki_sostate; /* INT: socket state */ 378 __uint32_t ki_prstate; /* INT: protocol state */ 379 __int32_t ki_tstate; /* INT: tcp state */ 380 __uint32_t ki_tflags; /* INT: tcp flags */ 381 382 __uint64_t ki_rcvq; /* U_LONG: receive queue len */ 383 __uint64_t ki_sndq; /* U_LONG: send queue len */ 384 385 union { 386 struct sockaddr _kis_src; /* STRUCT: local address */ 387 char _kis_pad[256 + 8]; /* pad to max addr length */ 388 } ki_s; 389 union { 390 struct sockaddr _kid_dst; /* STRUCT: remote address */ 391 char _kid_pad[256 + 8]; /* pad to max addr length */ 392 } ki_d; 393 394 __uint64_t ki_inode; /* INO_T: fake inode number */ 395 __uint64_t ki_vnode; /* PTR: if associated with file */ 396 __uint64_t ki_conn; /* PTR: control block of peer */ 397 __uint64_t ki_refs; /* PTR: referencing socket */ 398 __uint64_t ki_nextref; /* PTR: link in refs list */ 399}; 400 401#define ki_src ki_s._kis_src 402#define ki_dst ki_d._kid_dst 403 404#define PCB_SLOP 20 405#define PCB_ALL 0 406 407#endif /* _NETBSD_SOURCE */ 408 409#if defined(_NETBSD_SOURCE) 410/* 411 * PF_ROUTE - Routing table 412 * 413 * Three additional levels are defined: 414 * Fourth: address family, 0 is wildcard 415 * Fifth: type of info, defined below 416 * Sixth: flag(s) to mask with for NET_RT_FLAGS 417 */ 418#define NET_RT_DUMP 1 /* dump; may limit to a.f. */ 419#define NET_RT_FLAGS 2 /* by flags, e.g. RESOLVING */ 420#define NET_RT_OIFLIST 3 /* old NET_RT_IFLIST (pre 1.5) */ 421#define NET_RT_IFLIST 4 /* survey interface list */ 422#define NET_RT_MAXID 5 423 424#define CTL_NET_RT_NAMES { \ 425 { 0, 0 }, \ 426 { "dump", CTLTYPE_STRUCT }, \ 427 { "flags", CTLTYPE_STRUCT }, \ 428 { 0, 0 }, \ 429 { "iflist", CTLTYPE_STRUCT }, \ 430} 431#endif /* _NETBSD_SOURCE */ 432 433/* 434 * Maximum queue length specifiable by listen(2). 435 */ 436#ifndef SOMAXCONN 437#define SOMAXCONN 128 438#endif 439 440/* 441 * Message header for recvmsg and sendmsg calls. 442 * Used value-result for recvmsg, value only for sendmsg. 443 */ 444struct msghdr { 445 void *msg_name; /* optional address */ 446 socklen_t msg_namelen; /* size of address */ 447 struct iovec *msg_iov; /* scatter/gather array */ 448 int msg_iovlen; /* # elements in msg_iov */ 449 void *msg_control; /* ancillary data, see below */ 450 socklen_t msg_controllen; /* ancillary data buffer len */ 451 int msg_flags; /* flags on received message */ 452}; 453 454#define MSG_OOB 0x0001 /* process out-of-band data */ 455#define MSG_PEEK 0x0002 /* peek at incoming message */ 456#define MSG_DONTROUTE 0x0004 /* send without using routing tables */ 457#define MSG_EOR 0x0008 /* data completes record */ 458#define MSG_TRUNC 0x0010 /* data discarded before delivery */ 459#define MSG_CTRUNC 0x0020 /* control data lost before delivery */ 460#define MSG_WAITALL 0x0040 /* wait for full request or error */ 461#define MSG_DONTWAIT 0x0080 /* this message should be nonblocking */ 462#define MSG_BCAST 0x0100 /* this message was rcvd using link-level brdcst */ 463#define MSG_MCAST 0x0200 /* this message was rcvd using link-level mcast */ 464#define MSG_NOSIGNAL 0x0400 /* do not generate SIGPIPE on EOF */ 465 466/* 467 * Header for ancillary data objects in msg_control buffer. 468 * Used for additional information with/about a datagram 469 * not expressible by flags. The format is a sequence 470 * of message elements headed by cmsghdr structures. 471 */ 472struct cmsghdr { 473 socklen_t cmsg_len; /* data byte count, including hdr */ 474 int cmsg_level; /* originating protocol */ 475 int cmsg_type; /* protocol-specific type */ 476/* followed by u_char cmsg_data[]; */ 477}; 478 479/* given pointer to struct cmsghdr, return pointer to data */ 480#define CMSG_DATA(cmsg) \ 481 ((u_char *)(void *)(cmsg) + __CMSG_ALIGN(sizeof(struct cmsghdr))) 482#define CCMSG_DATA(cmsg) \ 483 ((const u_char *)(const void *)(cmsg) + \ 484 __CMSG_ALIGN(sizeof(struct cmsghdr))) 485 486/* 487 * Alignment requirement for CMSG struct manipulation. 488 * This basically behaves the same as ALIGN() ARCH/include/param.h. 489 * We declare it separately for two reasons: 490 * (1) avoid dependency between machine/param.h, and (2) to sync with kernel's 491 * idea of ALIGNBYTES at runtime. 492 * without (2), we can't guarantee binary compatibility in case of future 493 * changes in ALIGNBYTES. 494 */ 495#define __CMSG_ALIGN(n) (((n) + __cmsg_alignbytes()) & ~__cmsg_alignbytes()) 496#ifdef _KERNEL 497#define CMSG_ALIGN(n) __CMSG_ALIGN(n) 498#endif 499 500/* given pointer to struct cmsghdr, return pointer to next cmsghdr */ 501#define CMSG_NXTHDR(mhdr, cmsg) \ 502 (((__caddr_t)(cmsg) + __CMSG_ALIGN((cmsg)->cmsg_len) + \ 503 __CMSG_ALIGN(sizeof(struct cmsghdr)) > \ 504 (((__caddr_t)(mhdr)->msg_control) + (mhdr)->msg_controllen)) ? \ 505 (struct cmsghdr *)0 : \ 506 (struct cmsghdr *)((__caddr_t)(cmsg) + \ 507 __CMSG_ALIGN((cmsg)->cmsg_len))) 508 509/* 510 * RFC 2292 requires to check msg_controllen, in case that the kernel returns 511 * an empty list for some reasons. 512 */ 513#define CMSG_FIRSTHDR(mhdr) \ 514 ((mhdr)->msg_controllen >= sizeof(struct cmsghdr) ? \ 515 (struct cmsghdr *)(mhdr)->msg_control : \ 516 (struct cmsghdr *)0) 517 518#define CMSG_SPACE(l) (__CMSG_ALIGN(sizeof(struct cmsghdr)) + __CMSG_ALIGN(l)) 519#define CMSG_LEN(l) (__CMSG_ALIGN(sizeof(struct cmsghdr)) + (l)) 520 521/* "Socket"-level control message types: */ 522#define SCM_RIGHTS 0x01 /* access rights (array of int) */ 523#if defined(_NETBSD_SOURCE) 524#define SCM_TIMESTAMP 0x02 /* timestamp (struct timeval) */ 525#define SCM_CREDS 0x04 /* credentials (struct sockcred) */ 526#endif 527 528/* 529 * Types of socket shutdown(2). 530 */ 531#define SHUT_RD 0 /* Disallow further receives. */ 532#define SHUT_WR 1 /* Disallow further sends. */ 533#define SHUT_RDWR 2 /* Disallow further sends/receives. */ 534 535#include <sys/EfiCdefs.h> 536 537__BEGIN_DECLS 538int __cmsg_alignbytes(void); 539__END_DECLS 540 541#ifndef _KERNEL 542 543__BEGIN_DECLS 544int accept(int, struct sockaddr * __restrict, socklen_t * __restrict); 545int bind(int, const struct sockaddr *, socklen_t); 546int connect(int, const struct sockaddr *, socklen_t); 547int getpeername(int, struct sockaddr * __restrict, socklen_t * __restrict); 548int getsockname(int, struct sockaddr * __restrict, socklen_t * __restrict); 549int getsockopt(int, int, int, void * __restrict, socklen_t * __restrict); 550int listen(int, int); 551ssize_t recv(int, void *, size_t, int); 552ssize_t recvfrom(int, void * __restrict, size_t, int, 553 struct sockaddr * __restrict, socklen_t * __restrict); 554ssize_t recvmsg(int, struct msghdr *, int); 555ssize_t send(int, const void *, size_t, int); 556ssize_t sendto(int, const void *, 557 size_t, int, const struct sockaddr *, socklen_t); 558ssize_t sendmsg(int, const struct msghdr *, int); 559int setsockopt(int, int, int, const void *, socklen_t); 560int shutdown(int, int); 561int sockatmark(int); 562int socket(int, int, int) 563#if !defined(__LIBC12_SOURCE__) && !defined(_STANDALONE) 564__RENAME(__socket30) 565#endif 566 ; 567int socketpair(int, int, int, int *); 568__END_DECLS 569#endif /* !_KERNEL */ 570 571#endif /* !_SYS_SOCKET_H_ */ 572