Mercurial > flash_v2
comparison packages/net/tcpip/current/include/sys/socket.h @ 97:ced4577552cd ecos-sw-2000-06-06
Merge from eCos master repository on 2000-06-06-08:44:00-BST
| author | jlarmour |
|---|---|
| date | Tue, 06 Jun 2000 08:39:36 +0000 |
| parents | |
| children | e0c0827131d1 |
comparison
equal
deleted
inserted
replaced
| 96:b15c60e34c84 | 97:ced4577552cd |
|---|---|
| 1 //========================================================================== | |
| 2 // | |
| 3 // include/sys/socket.h | |
| 4 // | |
| 5 // | |
| 6 // | |
| 7 //========================================================================== | |
| 8 //####COPYRIGHTBEGIN#### | |
| 9 // | |
| 10 // ------------------------------------------- | |
| 11 // The contents of this file are subject to the Red Hat eCos Public License | |
| 12 // Version 1.1 (the "License"); you may not use this file except in | |
| 13 // compliance with the License. You may obtain a copy of the License at | |
| 14 // http://www.redhat.com/ | |
| 15 // | |
| 16 // Software distributed under the License is distributed on an "AS IS" | |
| 17 // basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the | |
| 18 // License for the specific language governing rights and limitations under | |
| 19 // the License. | |
| 20 // | |
| 21 // The Original Code is eCos - Embedded Configurable Operating System, | |
| 22 // released September 30, 1998. | |
| 23 // | |
| 24 // The Initial Developer of the Original Code is Red Hat. | |
| 25 // Portions created by Red Hat are | |
| 26 // Copyright (C) 1998, 1999, 2000 Red Hat, Inc. | |
| 27 // All Rights Reserved. | |
| 28 // ------------------------------------------- | |
| 29 // | |
| 30 //####COPYRIGHTEND#### | |
| 31 //####BSDCOPYRIGHTBEGIN#### | |
| 32 // | |
| 33 // ------------------------------------------- | |
| 34 // | |
| 35 // Portions of this software may have been derived from OpenBSD or other sources, | |
| 36 // and are covered by the appropriate copyright disclaimers included herein. | |
| 37 // | |
| 38 // ------------------------------------------- | |
| 39 // | |
| 40 //####BSDCOPYRIGHTEND#### | |
| 41 //========================================================================== | |
| 42 //#####DESCRIPTIONBEGIN#### | |
| 43 // | |
| 44 // Author(s): gthomas | |
| 45 // Contributors: gthomas | |
| 46 // Date: 2000-01-10 | |
| 47 // Purpose: | |
| 48 // Description: | |
| 49 // | |
| 50 // | |
| 51 //####DESCRIPTIONEND#### | |
| 52 // | |
| 53 //========================================================================== | |
| 54 | |
| 55 | |
| 56 /* $OpenBSD: socket.h,v 1.30 1999/12/08 06:50:24 itojun Exp $ */ | |
| 57 /* $NetBSD: socket.h,v 1.14 1996/02/09 18:25:36 christos Exp $ */ | |
| 58 | |
| 59 /* | |
| 60 * Copyright (c) 1982, 1985, 1986, 1988, 1993, 1994 | |
| 61 * The Regents of the University of California. All rights reserved. | |
| 62 * | |
| 63 * Redistribution and use in source and binary forms, with or without | |
| 64 * modification, are permitted provided that the following conditions | |
| 65 * are met: | |
| 66 * 1. Redistributions of source code must retain the above copyright | |
| 67 * notice, this list of conditions and the following disclaimer. | |
| 68 * 2. Redistributions in binary form must reproduce the above copyright | |
| 69 * notice, this list of conditions and the following disclaimer in the | |
| 70 * documentation and/or other materials provided with the distribution. | |
| 71 * 3. All advertising materials mentioning features or use of this software | |
| 72 * must display the following acknowledgement: | |
| 73 * This product includes software developed by the University of | |
| 74 * California, Berkeley and its contributors. | |
| 75 * 4. Neither the name of the University nor the names of its contributors | |
| 76 * may be used to endorse or promote products derived from this software | |
| 77 * without specific prior written permission. | |
| 78 * | |
| 79 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | |
| 80 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
| 81 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
| 82 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
| 83 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
| 84 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
| 85 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
| 86 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
| 87 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
| 88 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
| 89 * SUCH DAMAGE. | |
| 90 * | |
| 91 * @(#)socket.h 8.4 (Berkeley) 2/21/94 | |
| 92 */ | |
| 93 | |
| 94 #ifndef _SYS_SOCKET_H_ | |
| 95 #define _SYS_SOCKET_H_ | |
| 96 | |
| 97 /* | |
| 98 * Definitions related to sockets: types, address families, options. | |
| 99 */ | |
| 100 | |
| 101 /* | |
| 102 * 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 | |
| 124 /* | |
| 125 * Additional options, not kept in so_options. | |
| 126 */ | |
| 127 #define SO_SNDBUF 0x1001 /* send buffer size */ | |
| 128 #define SO_RCVBUF 0x1002 /* receive buffer size */ | |
| 129 #define SO_SNDLOWAT 0x1003 /* send low-water mark */ | |
| 130 #define SO_RCVLOWAT 0x1004 /* receive low-water mark */ | |
| 131 #define SO_SNDTIMEO 0x1005 /* send timeout */ | |
| 132 #define SO_RCVTIMEO 0x1006 /* receive timeout */ | |
| 133 #define SO_ERROR 0x1007 /* get error status and clear */ | |
| 134 #define SO_TYPE 0x1008 /* get socket type */ | |
| 135 #define SO_NETPROC 0x1020 /* multiplex; network processing */ | |
| 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 */ | |
| 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 #define pseudo_AF_XTP 19 /* eXpress Transfer Protocol (no AF) */ | |
| 175 #define AF_COIP 20 /* connection-oriented IP, aka ST II */ | |
| 176 #define AF_CNT 21 /* Computer Network Technology */ | |
| 177 #define pseudo_AF_RTIP 22 /* Help Identify RTIP packets */ | |
| 178 #define AF_IPX 23 /* Novell Internet Protocol */ | |
| 179 #define AF_INET6 24 /* IPv6 */ | |
| 180 #define pseudo_AF_PIP 25 /* Help Identify PIP packets */ | |
| 181 #define AF_ISDN 26 /* Integrated Services Digital Network*/ | |
| 182 #define AF_E164 AF_ISDN /* CCITT E.164 recommendation */ | |
| 183 #define AF_NATM 27 /* native ATM access */ | |
| 184 #define AF_ENCAP 28 | |
| 185 #define AF_SIP 29 /* Simple Internet Protocol */ | |
| 186 #define AF_KEY 30 | |
| 187 #define AF_MAX 31 | |
| 188 | |
| 189 /* | |
| 190 * Structure used by kernel to store most | |
| 191 * addresses. | |
| 192 */ | |
| 193 struct sockaddr { | |
| 194 u_int8_t sa_len; /* total length */ | |
| 195 sa_family_t sa_family; /* address family */ | |
| 196 char sa_data[14]; /* actually longer; address value */ | |
| 197 }; | |
| 198 | |
| 199 /* | |
| 200 * Sockaddr type which can hold any sockaddr type available | |
| 201 * in the system. | |
| 202 * | |
| 203 * Note: __ss_{len,family} is defined in RFC2553. During RFC2553 discussion | |
| 204 * the field name went back and forth between ss_len and __ss_len, | |
| 205 * and RFC2553 specifies it to be __ss_len. openbsd picked ss_len. | |
| 206 * For maximum portability, userland programmer would need to | |
| 207 * (1) make the code never touch ss_len portion (cast it into sockaddr and | |
| 208 * touch sa_len), or (2) add "-Dss_len=__ss_len" into CFLAGS to unify all | |
| 209 * occurences (including header file) to __ss_len. | |
| 210 */ | |
| 211 struct sockaddr_storage { | |
| 212 u_int8_t ss_len; /* total length */ | |
| 213 sa_family_t ss_family; /* address family */ | |
| 214 u_char __ss_pad1[6]; /* align to quad */ | |
| 215 u_int64_t __ss_pad2; /* force alignment for stupid compilers */ | |
| 216 u_char __ss_pad3[240]; /* pad to a total of 256 bytes */ | |
| 217 }; | |
| 218 | |
| 219 /* | |
| 220 * Structure used by kernel to pass protocol | |
| 221 * information in raw sockets. | |
| 222 */ | |
| 223 struct sockproto { | |
| 224 u_short sp_family; /* address family */ | |
| 225 u_short sp_protocol; /* protocol */ | |
| 226 }; | |
| 227 | |
| 228 /* | |
| 229 * Protocol families, same as address families for now. | |
| 230 */ | |
| 231 #define PF_UNSPEC AF_UNSPEC | |
| 232 #define PF_LOCAL AF_LOCAL | |
| 233 #define PF_UNIX PF_LOCAL /* backward compatibility */ | |
| 234 #define PF_INET AF_INET | |
| 235 #define PF_INET6 AF_INET6 | |
| 236 #define PF_IMPLINK AF_IMPLINK | |
| 237 #define PF_PUP AF_PUP | |
| 238 #define PF_CHAOS AF_CHAOS | |
| 239 #define PF_NS AF_NS | |
| 240 #define PF_ISO AF_ISO | |
| 241 #define PF_OSI AF_ISO | |
| 242 #define PF_ECMA AF_ECMA | |
| 243 #define PF_DATAKIT AF_DATAKIT | |
| 244 #define PF_CCITT AF_CCITT | |
| 245 #define PF_SNA AF_SNA | |
| 246 #define PF_DECnet AF_DECnet | |
| 247 #define PF_DLI AF_DLI | |
| 248 #define PF_LAT AF_LAT | |
| 249 #define PF_HYLINK AF_HYLINK | |
| 250 #define PF_APPLETALK AF_APPLETALK | |
| 251 #define PF_ROUTE AF_ROUTE | |
| 252 #define PF_LINK AF_LINK | |
| 253 #define PF_XTP pseudo_AF_XTP /* really just proto family, no AF */ | |
| 254 #define PF_COIP AF_COIP | |
| 255 #define PF_CNT AF_CNT | |
| 256 #define PF_IPX AF_IPX /* same format as AF_NS */ | |
| 257 #define PF_INET6 AF_INET6 | |
| 258 #define PF_RTIP pseudo_AF_FTIP /* same format as AF_INET */ | |
| 259 #define PF_PIP pseudo_AF_PIP | |
| 260 #define PF_ISDN AF_ISDN | |
| 261 #define PF_NATM AF_NATM | |
| 262 #define PF_ENCAP AF_ENCAP | |
| 263 #define PF_SIP AF_SIP | |
| 264 #define PF_KEY AF_KEY | |
| 265 #define PF_MAX AF_MAX | |
| 266 | |
| 267 /* | |
| 268 * These are the valid values for the "how" field used by shutdown(2). | |
| 269 */ | |
| 270 #define SHUT_RD 0 | |
| 271 #define SHUT_WR 1 | |
| 272 #define SHUT_RDWR 2 | |
| 273 | |
| 274 /* | |
| 275 * Socket credentials. | |
| 276 */ | |
| 277 struct sockcred { | |
| 278 uid_t sc_uid; /* real user id */ | |
| 279 uid_t sc_euid; /* effective user id */ | |
| 280 gid_t sc_gid; /* real group id */ | |
| 281 gid_t sc_egid; /* effective group id */ | |
| 282 int sc_ngroups; /* number of supplemental groups */ | |
| 283 gid_t sc_groups[1]; /* variable length */ | |
| 284 }; | |
| 285 | |
| 286 /* | |
| 287 * Compute size of a sockcred structure with groups. | |
| 288 */ | |
| 289 #define SOCKCREDSIZE(ngrps) \ | |
| 290 (sizeof(struct sockcred) + (sizeof(gid_t) * ((ngrps) - 1))) | |
| 291 | |
| 292 /* | |
| 293 * Definitions for network related sysctl, CTL_NET. | |
| 294 * | |
| 295 * Second level is protocol family. | |
| 296 * Third level is protocol number. | |
| 297 * | |
| 298 * Further levels are defined by the individual families below. | |
| 299 */ | |
| 300 #define NET_MAXID AF_MAX | |
| 301 | |
| 302 #define CTL_NET_NAMES { \ | |
| 303 { 0, 0 }, \ | |
| 304 { "unix", CTLTYPE_NODE }, \ | |
| 305 { "inet", CTLTYPE_NODE }, \ | |
| 306 { "implink", CTLTYPE_NODE }, \ | |
| 307 { "pup", CTLTYPE_NODE }, \ | |
| 308 { "chaos", CTLTYPE_NODE }, \ | |
| 309 { "xerox_ns", CTLTYPE_NODE }, \ | |
| 310 { "iso", CTLTYPE_NODE }, \ | |
| 311 { "emca", CTLTYPE_NODE }, \ | |
| 312 { "datakit", CTLTYPE_NODE }, \ | |
| 313 { "ccitt", CTLTYPE_NODE }, \ | |
| 314 { "ibm_sna", CTLTYPE_NODE }, \ | |
| 315 { "decnet", CTLTYPE_NODE }, \ | |
| 316 { "dec_dli", CTLTYPE_NODE }, \ | |
| 317 { "lat", CTLTYPE_NODE }, \ | |
| 318 { "hylink", CTLTYPE_NODE }, \ | |
| 319 { "appletalk", CTLTYPE_NODE }, \ | |
| 320 { "route", CTLTYPE_NODE }, \ | |
| 321 { "link_layer", CTLTYPE_NODE }, \ | |
| 322 { "xtp", CTLTYPE_NODE }, \ | |
| 323 { "coip", CTLTYPE_NODE }, \ | |
| 324 { "cnt", CTLTYPE_NODE }, \ | |
| 325 { "rtip", CTLTYPE_NODE }, \ | |
| 326 { "ipx", CTLTYPE_NODE }, \ | |
| 327 { "inet6", CTLTYPE_NODE }, \ | |
| 328 { "pip", CTLTYPE_NODE }, \ | |
| 329 { "isdn", CTLTYPE_NODE }, \ | |
| 330 { "natm", CTLTYPE_NODE }, \ | |
| 331 { "encap", CTLTYPE_NODE }, \ | |
| 332 { "sip", CTLTYPE_NODE }, \ | |
| 333 { "key", CTLTYPE_NODE }, \ | |
| 334 } | |
| 335 | |
| 336 /* | |
| 337 * PF_ROUTE - Routing table | |
| 338 * | |
| 339 * Three additional levels are defined: | |
| 340 * Fourth: address family, 0 is wildcard | |
| 341 * Fifth: type of info, defined below | |
| 342 * Sixth: flag(s) to mask with for NET_RT_FLAGS | |
| 343 */ | |
| 344 #define NET_RT_DUMP 1 /* dump; may limit to a.f. */ | |
| 345 #define NET_RT_FLAGS 2 /* by flags, e.g. RESOLVING */ | |
| 346 #define NET_RT_IFLIST 3 /* survey interface list */ | |
| 347 #define NET_RT_MAXID 4 | |
| 348 | |
| 349 #define CTL_NET_RT_NAMES { \ | |
| 350 { 0, 0 }, \ | |
| 351 { "dump", CTLTYPE_STRUCT }, \ | |
| 352 { "flags", CTLTYPE_STRUCT }, \ | |
| 353 { "iflist", CTLTYPE_STRUCT }, \ | |
| 354 } | |
| 355 | |
| 356 /* | |
| 357 * Maximum queue length specifiable by listen(2). | |
| 358 */ | |
| 359 #define SOMAXCONN 128 | |
| 360 | |
| 361 /* | |
| 362 * Message header for recvmsg and sendmsg calls. | |
| 363 * Used value-result for recvmsg, value only for sendmsg. | |
| 364 */ | |
| 365 struct msghdr { | |
| 366 caddr_t msg_name; /* optional address */ | |
| 367 socklen_t msg_namelen; /* size of address */ | |
| 368 struct iovec *msg_iov; /* scatter/gather array */ | |
| 369 u_int msg_iovlen; /* # elements in msg_iov */ | |
| 370 caddr_t msg_control; /* ancillary data, see below */ | |
| 371 socklen_t msg_controllen; /* ancillary data buffer len */ | |
| 372 int msg_flags; /* flags on received message */ | |
| 373 }; | |
| 374 | |
| 375 #define MSG_OOB 0x1 /* process out-of-band data */ | |
| 376 #define MSG_PEEK 0x2 /* peek at incoming message */ | |
| 377 #define MSG_DONTROUTE 0x4 /* send without using routing tables */ | |
| 378 #define MSG_EOR 0x8 /* data completes record */ | |
| 379 #define MSG_TRUNC 0x10 /* data discarded before delivery */ | |
| 380 #define MSG_CTRUNC 0x20 /* control data lost before delivery */ | |
| 381 #define MSG_WAITALL 0x40 /* wait for full request or error */ | |
| 382 #define MSG_DONTWAIT 0x80 /* this message should be nonblocking */ | |
| 383 #define MSG_BCAST 0x100 /* this message rec'd as broadcast */ | |
| 384 #define MSG_MCAST 0x200 /* this message rec'd as multicast */ | |
| 385 | |
| 386 /* | |
| 387 * Header for ancillary data objects in msg_control buffer. | |
| 388 * Used for additional information with/about a datagram | |
| 389 * not expressible by flags. The format is a sequence | |
| 390 * of message elements headed by cmsghdr structures. | |
| 391 */ | |
| 392 struct cmsghdr { | |
| 393 socklen_t cmsg_len; /* data byte count, including hdr */ | |
| 394 int cmsg_level; /* originating protocol */ | |
| 395 int cmsg_type; /* protocol-specific type */ | |
| 396 /* followed by u_char cmsg_data[]; */ | |
| 397 }; | |
| 398 | |
| 399 /* given pointer to struct cmsghdr, return pointer to data */ | |
| 400 #define CMSG_DATA(cmsg) ((u_char *)((cmsg) + 1)) | |
| 401 | |
| 402 /* given pointer to struct cmsghdr, return pointer to next cmsghdr */ | |
| 403 #define CMSG_NXTHDR(mhdr, cmsg) \ | |
| 404 (((caddr_t)(cmsg) + (cmsg)->cmsg_len + sizeof(struct cmsghdr) > \ | |
| 405 (mhdr)->msg_control + (mhdr)->msg_controllen) ? \ | |
| 406 (struct cmsghdr *)NULL : \ | |
| 407 (struct cmsghdr *)((caddr_t)(cmsg) + CMSG_ALIGN((cmsg)->cmsg_len))) | |
| 408 | |
| 409 #define CMSG_FIRSTHDR(mhdr) ((struct cmsghdr *)(mhdr)->msg_control) | |
| 410 | |
| 411 /* Round len up to next alignment boundary */ | |
| 412 #define CMSG_ALIGN(len) (((len)+sizeof(long)-1) & ~(sizeof(long)-1)) | |
| 413 | |
| 414 /* Length of the contents of a control message of length len */ | |
| 415 #define CMSG_LEN(len) (CMSG_ALIGN(sizeof(struct cmsghdr)) + (len)) | |
| 416 | |
| 417 /* Length of the space taken up by a padded control message of length len */ | |
| 418 #define CMSG_SPACE(len) (CMSG_ALIGN(sizeof(struct cmsghdr)) + CMSG_ALIGN(len)) | |
| 419 | |
| 420 /* "Socket"-level control message types: */ | |
| 421 #define SCM_RIGHTS 0x01 /* access rights (array of int) */ | |
| 422 #define SCM_CREDS 0x02 /* credientials (struct sockcred) */ | |
| 423 | |
| 424 /* | |
| 425 * 4.3 compat sockaddr, move to compat file later | |
| 426 */ | |
| 427 struct osockaddr { | |
| 428 u_short sa_family; /* address family */ | |
| 429 char sa_data[14]; /* up to 14 bytes of direct address */ | |
| 430 }; | |
| 431 | |
| 432 /* | |
| 433 * 4.3-compat message header (move to compat file later). | |
| 434 */ | |
| 435 struct omsghdr { | |
| 436 caddr_t msg_name; /* optional address */ | |
| 437 int msg_namelen; /* size of address */ | |
| 438 struct iovec *msg_iov; /* scatter/gather array */ | |
| 439 int msg_iovlen; /* # elements in msg_iov */ | |
| 440 caddr_t msg_accrights; /* access rights sent/received */ | |
| 441 int msg_accrightslen; | |
| 442 }; | |
| 443 | |
| 444 #define SA_LEN(x) ((x)->sa_len) | |
| 445 | |
| 446 #ifndef _KERNEL | |
| 447 | |
| 448 #include <sys/cdefs.h> | |
| 449 | |
| 450 __BEGIN_DECLS | |
| 451 int accept __P((int, struct sockaddr *, socklen_t *)); | |
| 452 int bind __P((int, const struct sockaddr *, socklen_t)); | |
| 453 int connect __P((int, const struct sockaddr *, socklen_t)); | |
| 454 int getpeername __P((int, struct sockaddr *, socklen_t *)); | |
| 455 int getsockname __P((int, struct sockaddr *, socklen_t *)); | |
| 456 int getsockopt __P((int, int, int, void *, socklen_t *)); | |
| 457 int listen __P((int, int)); | |
| 458 ssize_t recv __P((int, void *, size_t, int)); | |
| 459 ssize_t recvfrom __P((int, void *, size_t, int, struct sockaddr *, socklen_t *)); | |
| 460 ssize_t recvmsg __P((int, struct msghdr *, int)); | |
| 461 ssize_t send __P((int, const void *, size_t, int)); | |
| 462 ssize_t sendto __P((int, const void *, | |
| 463 size_t, int, const struct sockaddr *, socklen_t)); | |
| 464 ssize_t sendmsg __P((int, const struct msghdr *, int)); | |
| 465 int setsockopt __P((int, int, int, const void *, socklen_t)); | |
| 466 int shutdown __P((int, int)); | |
| 467 int socket __P((int, int, int)); | |
| 468 int socketpair __P((int, int, int, int *)); | |
| 469 __END_DECLS | |
| 470 #else | |
| 471 # if defined(COMPAT_43) || defined(COMPAT_SUNOS) || defined(COMPAT_LINUX) || \ | |
| 472 defined(COMPAT_HPUX) || defined(COMPAT_FREEBSD) | |
| 473 # define COMPAT_OLDSOCK | |
| 474 # define MSG_COMPAT 0x8000 | |
| 475 # endif | |
| 476 | |
| 477 void pfctlinput __P((int, struct sockaddr *)); | |
| 478 #endif /* !_KERNEL */ | |
| 479 | |
| 480 #endif /* !_SYS_SOCKET_H_ */ |
