#ifndef __SOCKET_LOADED #define __SOCKET_LOADED 1 /**************************************************************************** ** ** - TCP/IP socket definitions ** ***************************************************************************** ** Header introduced by the X/Open CAE Specification, Issue 4, Version 2 ***************************************************************************** ** ** Copyright (c) 1982 Regents of the University of California. ** All rights reserved. The Berkeley software License Agreement ** specifies the terms and conditions for redistribution. ** ** socket.h 6.6 (Berkeley) 6/8/85 ** ***************************************************************************** ** * ** HPE CONFIDENTIAL. This software is confidential proprietary software * ** licensed by Hewlett Packard Enterprise Development, LP, and is not * ** authorized to be used, duplicated or disclosed to anyone without the * ** prior written permission of HPE. * ** Copyright 2005 Hewlett Packard Enterprise Development, LP * ** * ** VMS SOFTWARE, INC. CONFIDENTIAL. This software is confidential * ** proprietary software licensed by VMS Software, Inc., and is not * ** authorized to be used, duplicated or disclosed to anyone without * ** the prior written permission of VMS Software, Inc. * ** Copyright 2017-2022 VMS Software, Inc. * ** * ***************************************************************************** ** ** Copyright (c) 1982 Regents of the University of California. ** All rights reserved. The Berkeley software License Agreement ** specifies the terms and conditions for redistribution. ** ** socket.h 6.6 (Berkeley) 6/8/85 ** ***************************************************************************** */ #pragma __nostandard #include #ifdef __cplusplus extern "C" { #endif #include #include #if __INITIAL_POINTER_SIZE # pragma __pointer_size __save # pragma __pointer_size 32 #endif /* ** Strict XPG4 V2 compliance requires the BSD 4.4 socket interfaces */ #if defined _XOPEN_SOURCE_EXTENDED && !defined _SOCKADDR_LEN && __CRTL_VER >= 70000000 # define _SOCKADDR_LEN 1 #endif /* ** The OpenVMS V7.0 release added a second implementation of the socket ** functions which is compatible with BSD 4.4. ** ** An application program enables this support by defining _SOCKADDR_LEN ** prior to including this header file. */ #ifdef _SOCKADDR_LEN # if (__CRTL_VER < 70000000) # error " BSD 4.4 Socket package not available before OpenVMS V7.0" # undef _SOCKADDR_LEN # endif #endif /* ** Set __nomember_alignment to avoid internal and tail ** padding in structures; default base alignment. ** Required for consistency across programming languages. */ #pragma __member_alignment __save #pragma __nomember_alignment /* ** Public typedefs (32-bit mode) */ #if !defined(__CADDR_T) && !defined(CADDR_T) && !defined _XOPEN_SOURCE_EXTENDED # define __CADDR_T 1 # ifndef __HIDE_FORBIDDEN_NAMES # define CADDR_T 1 # endif typedef __caddr_t caddr_t; #endif #if !defined __SIZE_T && !defined _DECC_V4_SOURCE # define __SIZE_T 1 #ifdef __NAMESPACE_STD namespace std { #endif typedef __size_t size_t; #ifdef __NAMESPACE_STD } /* namespace std */ using std::size_t; #endif #endif #if !defined __SSIZE_T && !defined _DECC_V4_SOURCE # define __SSIZE_T 1 typedef __ssize_t ssize_t; #endif #if !defined __TIME_T && !defined _DECC_V4_SOURCE # define __TIME_T 1 #ifdef __NAMESPACE_STD namespace std { #endif typedef __time_t time_t; #ifdef __NAMESPACE_STD } /* namespace std */ using std::time_t; #endif #endif /* ** is a header defined by XPG4 V2. That specification ** puts struct timeval, the FD* macros and select in . ** We define select here for compatibility with DEC C V4, unless ** the program is in XPG4 V2 mode. */ #if !defined __TIMEVAL && !defined _XOPEN_SOURCE_EXTENDED # define __TIMEVAL 1 # if !defined _DECC_V4_SOURCE struct timeval { __time_t tv_sec; /* seconds since Jan. 1, 1970 */ long tv_usec; /* microseconds */ }; # else struct timeval { long tv_sec; /* seconds since Jan. 1, 1970 */ long tv_usec; /* microseconds */ }; # endif #endif /* FD_SETSIZE may be defined by the user. It is normally ** equal to the maximum number of descriptors supported by ** the system. Here it is set to the minimum maximum supported ** by the system. In order to accomodate programs which use ** a larger number of open files with select, increase this size ** within a program by providing a larger definition of FD_SETSIZE ** before including or */ #if !defined __FD_SET && !defined _XOPEN_SOURCE_EXTENDED && !defined _DECC_V4_SOURCE # define __FD_SET 1 # ifndef FD_SETSIZE # define FD_SETSIZE 1024 # endif typedef long fd_mask; # define NBBY 8 /* bits per byte */ # define NFDBITS (sizeof(fd_mask) * NBBY) /* bits per mask */ # define FD_SET(__n, __p) ((__p)->fds_bits[(__n)/NFDBITS] |= (1 << ((__n) % NFDBITS))) # define FD_CLR(__n, __p) ((__p)->fds_bits[(__n)/NFDBITS] &= ~(1 << ((__n) % NFDBITS))) # define FD_ISSET(__n, __p) ((__p)->fds_bits[(__n)/NFDBITS] & (1 << ((__n) % NFDBITS))) # define __howmany(__x, __y) (((__x)+((__y)-1))/(__y)) typedef struct fd_set { /* descriptor set */ fd_mask fds_bits[__howmany(FD_SETSIZE, NFDBITS)]; } fd_set; # if __INITIAL_POINTER_SIZE == 64 # pragma __pointer_size 64 # endif # if defined(__clang__) void *memset(void *__s, int __c, __size_t __n); # define FD_ZERO(__p) memset((__p), 0, sizeof(*(__p))) # else void *__MEMSET(void *__s, int __c, __size_t __n); # define FD_ZERO(__p) __MEMSET((__p), 0, sizeof(*(__p))) # endif # if __INITIAL_POINTER_SIZE == 64 # pragma __pointer_size 32 # endif #endif /* ** Define non-standard BSD socket compatible typedefs */ #if !defined __SOCKET_TYPEDEFS && !defined _XOPEN_SOURCE_EXTENDED # define __SOCKET_TYPEDEFS 1 typedef unsigned char u_char; typedef unsigned short u_short; typedef unsigned long u_long; #endif /* ** Defined XPG4 typedefs */ #if !defined __SOCKLEN_T && !defined _DECC_V4_SOURCE # define __SOCKLEN_T typedef unsigned int socklen_t; #endif #if !defined __SA_FAMILY_T && !defined _DECC_V4_SOURCE # define __SA_FAMILY_T typedef __sa_family_t sa_family_t; #endif /* * Definitions related to sockets: types, address families, options. */ /* * Types */ #define SOCK_STREAM 1 /* stream socket */ #define SOCK_DGRAM 2 /* datagram socket */ #define SOCK_RAW 3 /* raw-protocol interface */ #define SOCK_RDM 4 /* reliably-delivered message */ #define SOCK_SEQPACKET 5 /* sequenced packet stream */ /* * Option flags per-socket. */ #define SO_DEBUG 0x0001 /* turn on debugging info recording */ #define SO_ACCEPTCONN 0x0002 /* socket has had listen() */ #define SO_REUSEADDR 0x0004 /* allow local address reuse */ #define SO_KEEPALIVE 0x0008 /* keep connections alive */ #define SO_DONTROUTE 0x0010 /* just use interface addresses */ #define SO_BROADCAST 0x0020 /* permit sending of broadcast msgs */ #define SO_USELOOPBACK 0x0040 /* bypass hardware when possible */ #define SO_LINGER 0x0080 /* linger on close if data present */ #define SO_OOBINLINE 0x0100 /* leave received OOB data in line */ #define SO_REUSEPORT 0x0200 /* allow local addr and port reuse */ #define SO_OPTIONS_VMS SO_DEBUG+SO_ACCEPTCONN+SO_REUSEADDR+SO_KEEPALIVE+ \ SO_DONTROUTE+SO_BROADCAST+SO_USELOOPBACK+ \ SO_LINGER+SO_OOBINLINE+SO_REUSEPORT #if SEC_BASE #if SEC_NET #define SO_EXPANDED_RIGHTS 0x1016 /* return expanded rights on recv */ #define SO_DEFAULT_ATTR 0x1017 /* set def. socket attr. */ #define SO_RCV_ATTR 0x1018 /* set socket rcv mask. */ #define SO_AUTHENTICATION 0x1019 /* set socket authentication data. */ #define SO_ACCESS_ERROR 0x1020 /* record security violation. */ #define SO_SEC_ATTRIBUTES 0x1021 /* get sec. attrs. for last byte read */ #define SO_REMOTE_KEY 0x1022 /* get auth. data for remote process. */ #define SO_NEW_ATTRS_ONLY 0x1023 /* Only return attrs if they change. */ #define SO_SET_TNET_TCB 0x1024 /* Set/reset ALLOWNETACCESS on socket.*/ #define SO_GET_TNET_TCB 0x1025 /* Return ALLOWNETACC. flag on socket.*/ #else #define SO_EXPANDED_RIGHTS 0x0400 /* return expanded rights on recv */ #endif /*SEC_NET*/ #endif #define SO_PAIRABLE 0x0800 /* pairable socket unix domain */ #define SO_UMC 0x01000 /* umc socket */ #define SO_RESVPORT 0x100000 /* process wants a reserved port */ /* * Additional options, not kept in so_options. */ #define SO_SNDBUF 0x1001 /* send buffer size */ #define SO_RCVBUF 0x1002 /* receive buffer size */ #define SO_SNDLOWAT 0x1003 /* send low-water mark */ #define SO_RCVLOWAT 0x1004 /* receive low-water mark */ #define SO_SNDTIMEO 0x1005 /* send timeout */ #define SO_RCVTIMEO 0x1006 /* receive timeout */ #define SO_ERROR 0x1007 /* get error status and clear */ #define SO_TYPE 0x1008 /* get socket type */ #define SO_SHARE 0x1009 /* ovms Share between processes */ #define SO_CCL 0x100a /* ovms Carriage Control socket */ #define SO_STATE 0x100b /* get socket state bits */ #define SO_FAMILY 0x100c /* get socket address family*/ #define SO_XSE 0x100d /* _XOPEN_SOURCE_EXTENDED socket */ /* ** Full duplex code socket option */ #define SO_FULL_DUPLEX_CLOSE 0x2000 /* full duplex close option */ /* ** Linger Structure: Used for manipulating linger options. ** ** This structure specifies the setting or resetting of the ** socket opt for the time interval that the socket will ** linger for data. linger is supported only by STREAM ** type sockets. */ struct linger { int l_onoff; /* Linger option; 1 sets linger and 0 resets linger. */ int l_linger; /* Number of seconds to linger; defaulted to ** 120 seconds. */ }; /* ** Level number for (get/set)sockopt() to apply to socket itself. */ #define SOL_SOCKET 0xffff /* options for socket level */ /* ** Address families. */ #define AF_UNSPEC 0 /* unspecified */ #define AF_UNIX 1 /* local to host (pipes, portals) */ #define AF_INET 2 /* internetwork: UDP, TCP, etc. */ #define AF_IMPLINK 3 /* arpanet imp addresses */ #define AF_PUP 4 /* pup protocols: e.g. BSP */ #define AF_CHAOS 5 /* mit CHAOS protocols */ #define AF_NS 6 /* XEROX NS protocols */ #define AF_ISO 7 /* ISO protocols */ #define AF_OSI AF_ISO #define AF_ECMA 8 /* european computer manufacturers */ #define AF_DATAKIT 9 /* datakit protocols */ #define AF_CCITT 10 /* CCITT protocols, X.25 etc */ #define AF_SNA 11 /* IBM SNA */ #define AF_DECnet 12 /* DECnet */ #define AF_DLI 13 /* DEC Direct data link interface */ #define AF_LAT 14 /* LAT */ #define AF_HYLINK 15 /* NSC Hyperchannel */ #define AF_APPLETALK 16 /* Apple Talk */ #define AF_ROUTE 17 /* Internal Routing Protocol */ #define AF_LINK 18 /* Link layer interface */ #ifdef _XOPEN_SOURCE_EXTENDED #define _pseudo_AF_XTP 19 /* eXpress Transfer Protocol (no AF) */ #else #define pseudo_AF_XTP 19 /* eXpress Transfer Protocol (no AF) */ #endif #define AF_NETMAN 20 /* DNA Network Management */ #define AF_X25 21 /* X25 protocol */ #define AF_CTF 22 /* Common Trace Facility */ #define AF_WAN 23 /* Wide Area Network protocols */ #define AF_USER 24 /* Wild card (user defined) protocol */ #define AF_LAST 25 /* Local Area System Transport protocol */ #define AF_INET6 26 /* IPV6: UDP, TCP, etc. */ #define AF_AAL 27 /* Native AAL ATM */ #define AF_KEY 28 /* IPSEC key management */ #define AF_MAX 35 /* leave some space for future growth */ #define SHUT_RD 0 /* Disables further receive operations */ #define SHUT_WR 1 /* Disables further send operations */ #define SHUT_RDWR 2 /* Disables further send and receive operations */ /* definitions for sockaddr_storage structure */ #define _SS_MAXSIZE 128 /* Implementation specific max size. Set to * be large enough to take a sockaddr_un. */ #define _SS_ALIGNSIZE (sizeof (long)) /* ** sockaddr structure used by kernel to store most addresses. */ #ifdef _SOCKADDR_LEN /* ** BSD 4.4 sockaddr */ struct sockaddr { unsigned char sa_len; /* total length */ __sa_family_t sa_family; /* address family */ char sa_data[14]; /* up to 14 bytes of direct address */ }; # if !defined _XOPEN_SOURCE_EXTENDED /* ** BSD 4.3 sockaddr (for compatibility) */ struct osockaddr { unsigned short sa_family; /* address family */ char sa_data[14]; /* up to 14 bytes of direct address */ }; # endif #define _SS_PAD1SIZE (_SS_ALIGNSIZE - (sizeof (unsigned char) + sizeof(__sa_family_t))) #define _SS_PAD2SIZE (_SS_MAXSIZE - ( 2 * _SS_ALIGNSIZE)) struct sockaddr_storage { unsigned char ss_len; /* address length */ __sa_family_t ss_family; /* address family */ #define __ss_len ss_len #define __ss_family ss_family char __ss_pad1[_SS_PAD1SIZE]; /* pad to allignment field */ unsigned long __ss_align; /* force structure allignment */ char __ss_pad2[_SS_PAD2SIZE]; /* pad to desired size */ }; #else /* ** BSD 4.3 sockaddr */ struct sockaddr { unsigned short sa_family; /* address family */ char sa_data[14]; /* up to 14 bytes of direct address */ }; #define _SS_PAD1SIZE (_SS_ALIGNSIZE - sizeof (unsigned short)) #define _SS_PAD2SIZE (_SS_MAXSIZE - ( 2 * _SS_ALIGNSIZE)) struct sockaddr_storage { unsigned short ss_family; /* address family 4.3 BSD */ #define __ss_family ss_family char __ss_pad1[_SS_PAD1SIZE]; /* pad to allignment field */ unsigned long __ss_align; /* force structure allignment */ char __ss_pad2[_SS_PAD2SIZE]; /* pad to desired size */ }; #endif #if !defined _XOPEN_SOURCE_EXTENDED /* ** Structure used by kernel to pass protocol information in raw sockets */ struct sockproto { u_short sp_family; /* address family */ u_short sp_protocol; /* protocol */ }; /* ** Protocol families, same as address families for now */ #define PF_UNSPEC AF_UNSPEC #define PF_UNIX AF_UNIX #define PF_INET AF_INET #define PF_IMPLINK AF_IMPLINK #define PF_PUP AF_PUP #define PF_CHAOS AF_CHAOS #define PF_NS AF_NS #define PF_ISO AF_ISO #define PF_OSI AF_ISO #define PF_ECMA AF_ECMA #define PF_DATAKIT AF_DATAKIT #define PF_CCITT AF_CCITT #define PF_SNA AF_SNA #define PF_DECnet AF_DECnet #define PF_DLI AF_DLI #define PF_LAT AF_LAT #define PF_HYLINK AF_HYLINK #define PF_APPLETALK AF_APPLETALK #define PF_ROUTE AF_ROUTE #define PF_LINK AF_LINK #ifdef _XOPEN_SOURCE_EXTENDED #define PF_XTP _pseudo_AF_XTP /* really just proto family, no AF */ #else #define PF_XTP pseudo_AF_XTP /* really just proto family, no AF */ #endif #define PF_NETMAN AF_NETMAN #define PF_X25 AF_X25 #define PF_CTF AF_CTF #define PF_WAN AF_WAN #define PF_USER AF_USER #define PF_LAST AF_LAST #define PF_INET6 AF_INET6 #define PF_AAL AF_AAL #define PF_KEY AF_KEY #define PF_MAX AF_MAX /* * Maximum queue length specifiable by listen. */ #define SOMAXCONN 1024 #endif /* ** */ #if !defined _XOPEN_SOURCE_EXTENDED #define MSG_MAXIOVLEN 16 #endif #define MSG_OOB 0x1 /* process out-of-band data */ #define MSG_PEEK 0x2 /* peek at incoming message */ #define MSG_DONTROUTE 0x4 /* send without using routing tables */ #define MSG_EOR 0x8 /* data completes record */ #define MSG_TRUNC 0x10 /* data discarded before delivery */ #define MSG_CTRUNC 0x20 /* control data lost before delivery */ #define MSG_WIRE 0x40 /* toggle socket wire flag (send only)*/ #define MSG_WAITALL 0x80 /* wait for full request or error */ /* MSG_AIO must not be set by the user */ #define MSG_AIO 0x2000 /* Asynchronous IO request */ /* Following used within kernel */ #define MSG_NONBLOCK 0x4000 /* nonblocking request */ #define MSG_COMPAT 0x8000 /* 4.3-format sockaddr */ #define MSG_SENDFILE 0x10000 /* from sendfile; bypass space checks */ #if !defined _XOPEN_SOURCE_EXTENDED # define MSG_DONTWAIT 0x40 /* this message should be nonblocking */ # define MSG_DONTROUTE 0x4 /* send without using routing tables */ #endif /* ** Header for ancillary data objects in msg_control buffer. Used for ** additional information with/about a datagram not expressible by ** flags. The format is a sequence of message elements headed by ** cmsghdr structures. */ #ifdef _XOPEN_SOURCE_EXTENDED /* ** The CMSG_NXTHDR macro uses the _ALIGN macro and therefore ** the assumption exists that we are longword base aligned. ** Consequently, the cmsghdr struct must have longword base alignment. */ #pragma __nomember_alignment __longword struct cmsghdr { socklen_t cmsg_len; /* data byte count, including hdr. */ int cmsg_level; /* originating protocol, values ** will be legal values for level ** arg to getsockopt(),setsockopt(). */ int cmsg_type; /* protocol-specific type. */ /* followed by u_char cmsg_data[]; */ }; #endif #ifdef _XOPEN_SOURCE_EXTENDED struct __Ocmsghdr { #else struct cmsghdr { #endif unsigned int cmsg_len; /* data byte count, including hdr */ int cmsg_level; /* originating protocol; see above*/ int cmsg_type; /* protocol-specific type */ /* followed by u_char cmsg_data[]; */ }; /* ** Restore default base alignment. */ #pragma __nomember_alignment /* ** Macro for checking and aligning a pointer to the machines native word size. */ #define _ALIGN(p) \ (void *)((__caddr_t)(p) + sizeof(void *) - 1UL - \ ((unsigned int)((__caddr_t)(p) + sizeof(void *) - 1UL) % \ sizeof(void *))) /* given pointer to struct cmsghdr, return pointer to data */ #define CMSG_DATA(cmsg) ((unsigned char *)(cmsg) + _CMSG_LEN(0)) /* given length of data, return space required for cmsghdr and data, * plus any padding needed to satisfy alignment requirements */ #define _CMSG_SPACE(length) ((unsigned int)_ALIGN(sizeof(struct cmsghdr)) + \ (unsigned int)_ALIGN(length)) /* given length of data, return value to store in cmsg_len field, taking * into account any padding needed to satisfy alignment requirements. */ #define _CMSG_LEN(length) ((unsigned int)_ALIGN(sizeof(struct cmsghdr)) \ + length) /* given pointer to struct cmsghdr, return length of data */ #define _CMSG_DATALEN(cmsg) ((cmsg)->cmsg_len - _CMSG_LEN(0)) /* given pointer to struct msghdr, return pointer to first cmsghdr */ #define CMSG_FIRSTHDR(mhdr) \ ( (mhdr)->msg_controllen >= _CMSG_LEN(0) ? \ (struct cmsghdr *)(mhdr)->msg_control : \ (struct cmsghdr *)__NULL ) /* given pointer to struct msghdr and cmsghdr, return pointer to next cmsghdr */ #define CMSG_NXTHDR(mhdr, cmsg) \ ( ((cmsg) == __NULL) ? CMSG_FIRSTHDR(mhdr) : \ ( ((__caddr_t)(cmsg) + _CMSG_SPACE(_CMSG_DATALEN(cmsg)) + _CMSG_LEN(0)) > \ ((__caddr_t)(mhdr)->msg_control + (mhdr)->msg_controllen) ? \ (struct cmsghdr *)__NULL : \ (struct cmsghdr *)((__caddr_t)(cmsg) + _CMSG_SPACE(_CMSG_DATALEN(cmsg)) ))) /* ** "Socket"-level control message types: */ #define SCM_RIGHTS 0x01 /* access rights (array of int) */ #if __INITIAL_POINTER_SIZE # pragma __pointer_size 64 /* ** 64-bit Msghdr Structure ** ** This structure specifies the message buffer parameter for ** recvmsg and sendmsg calls. It allows you to specify an array ** of scatter/gather buffers. Recvmsg scatters the data to several ** user receive buffers. Sendmsg gathers data from several user ** transmit buffers before transmitting. ** */ #ifdef _SOCKADDR_LEN # ifdef _XOPEN_SOURCE_EXTENDED struct __msghdr64 { __void_ptr64 msg_name; /* The address of the destina- ** tion socket, if the socket is ** connected. If no address is ** required, this field can be ** set to NULL. */ socklen_t msg_namelen; /* Len of msg_name field. */ struct __iovec64 *msg_iov; /* scatter/gather array. */ int msg_iovlen; /* # elements in msg_iov. */ __void_ptr64 msg_control; /* Ancillary data consisting ** of a sequence of pairs, each ** consisting of a cmsghdr ** structure followed by a data ** array. The data array con- ** tains the ancillary data ** message, and the cmsghdr ** struct contains info allowing ** applications to parse the data. */ socklen_t msg_controllen; /* Ancillary data buffer len. */ int msg_flags; /* Flags on received message. */ }; # else struct __msghdr64 { __char_ptr64 msg_name; /* The address of the destina- ** tion socket, if the socket is ** connected. If no address is ** required, this field can be ** set to NULL. */ unsigned int msg_namelen; /* Len of msg_name field. */ struct __iovec64 *msg_iov; /* scatter/gather array. */ unsigned int msg_iovlen; /* # elements in msg_iov. */ __char_ptr64 msg_control; /* Ancillary data, see above. */ unsigned int msg_controllen;/* Ancillary data buffer len. */ int msg_flags; /* Flags on received message. */ }; # endif #else /* ** BSD 4.3 message header */ struct __msghdr64 { __char_ptr64 msg_name; /* The address of the destina- ** tion socket, if the socket is ** connected. If no address is ** required, this field can be ** set to NULL. */ int msg_namelen; /* Len of msg_name field. */ struct __iovec64 *msg_iov; /* Scatter/Gather array. */ int msg_iovlen; /* # elements in msg_iov. */ __char_ptr64 msg_accrights; /* Points to a buffer containing ** access rights sent with message. */ int msg_accrightslen;/* Len of the msg_accrights buffer. */ }; #endif typedef struct msghdr *__msghdr_ptr64; typedef const struct msghdr *__const_msghdr_ptr64; typedef struct __msghdr64 *__msghdr64_ptr64; typedef const struct __msghdr64 *__const_msghdr64_ptr64; # pragma __pointer_size 32 /* ** 32-bit Msghdr Structure ** ** This structure specifies the message buffer parameter for ** recvmsg and sendmsg calls. It allows you to specify an array ** of scatter/gather buffers. Recvmsg scatters the data to several ** user receive buffers. Sendmsg gathers data from several user ** transmit buffers before transmitting. ** */ #ifdef _SOCKADDR_LEN # ifdef _XOPEN_SOURCE_EXTENDED struct __msghdr32 { __void_ptr32 msg_name; /* The address of the destina- ** tion socket, if the socket is ** connected. If no address is ** required, this field can be ** set to NULL. */ socklen_t msg_namelen; /* Len of msg_name field. */ struct __iovec32 *msg_iov; /* scatter/gather array. */ int msg_iovlen; /* # elements in msg_iov. */ __void_ptr32 msg_control; /* Ancillary data consisting ** of a sequence of pairs, each ** consisting of a cmsghdr ** structure followed by a data ** array. The data array con- ** tains the ancillary data ** message, and the cmsghdr ** struct contains info allowing ** applications to parse the data. */ socklen_t msg_controllen; /* Ancillary data buffer len. */ int msg_flags; /* Flags on received message. */ }; # else struct __msghdr32 { __char_ptr32 msg_name; /* The address of the destina- ** tion socket, if the socket is ** connected. If no address is ** required, this field can be ** set to NULL. */ unsigned int msg_namelen; /* Len of msg_name field. */ struct __iovec32 *msg_iov; /* scatter/gather array. */ unsigned int msg_iovlen; /* # elements in msg_iov. */ __char_ptr32 msg_control; /* Ancillary data, see above. */ unsigned int msg_controllen;/* Ancillary data buffer len. */ int msg_flags; /* Flags on received message. */ }; # endif #else /* ** BSD 4.3 message header */ struct __msghdr32 { __char_ptr32 msg_name; /* The address of the destina- ** tion socket, if the socket is ** connected. If no address is ** required, this field can be ** set to NULL. */ int msg_namelen; /* Len of msg_name field. */ struct __iovec32 *msg_iov; /* Scatter/Gather array. */ int msg_iovlen; /* # elements in msg_iov. */ __char_ptr32 msg_accrights; /* Points to a buffer containing ** access rights sent with message. */ int msg_accrightslen; /* Len of the msg_accrights buffer. */ }; #endif typedef struct msghdr *__msghdr_ptr32; typedef struct __msghdr32 *__msghdr32_ptr32; typedef struct __msghdr64 *__msghdr64_ptr32; typedef const struct __msghdr32 *__const_msghdr32_ptr32; #endif /* __INITIAL_POINTER_SIZE */ /* ** Msghdr Structure ** ** This structure specifies the message buffer parameter for ** recvmsg and sendmsg calls. It allows you to specify an array ** of scatter/gather buffers. Recvmsg scatters the data to several ** user receive buffers. Sendmsg gathers data from several user ** transmit buffers before transmitting. ** */ #ifdef _SOCKADDR_LEN # ifdef _XOPEN_SOURCE_EXTENDED struct msghdr { void *msg_name; /* The address of the destina- ** tion socket, if the socket is ** connected. If no address is ** required, this field can be ** set to NULL. */ socklen_t msg_namelen; /* Len of msg_name field. */ struct iovec *msg_iov; /* scatter/gather array. */ int msg_iovlen; /* # elements in msg_iov. */ void *msg_control; /* Ancillary data consisting ** of a sequence of pairs, each ** consisting of a cmsghdr ** structure followed by a data ** array. The data array con- ** tains the ancillary data ** message, and the cmsghdr ** struct contains info allowing ** applications to parse the ** data. */ socklen_t msg_controllen; /* Ancillary data buffer len. */ int msg_flags; /* Flags on received message. */ }; # endif # ifdef _XOPEN_SOURCE_EXTENDED struct __Omsghdr { # else struct msghdr { # endif char *msg_name; /* The address of the destina- ** tion socket, if the socket is ** connected. If no address is ** required, this field can be ** set to NULL. */ unsigned int msg_namelen; /* Len of msg_name field. */ # ifdef _XOPEN_SOURCE_EXTENDED struct __Oiovec *msg_iov; /* scatter/gather array. */ # else struct iovec *msg_iov; /* scatter/gather array. */ # endif unsigned int msg_iovlen; /* # elements in msg_iov. */ char *msg_control; /* Ancillary data, see above. */ unsigned int msg_controllen; /* Ancillary data buffer len. */ int msg_flags; /* Flags on received message. */ }; # if !defined _XOPEN_SOURCE_EXTENDED /* ** BSD 4.3 message header (for compatibility) */ struct omsghdr { char *msg_name; /* The address of the destina- ** tion socket, if the socket is ** connected. If no address is ** required, this field can be ** set to NULL. */ int msg_namelen; /* Len of msg_name field. */ struct iovec *msg_iov; /* scatter/gather array. */ int msg_iovlen; /* # elements in msg_iov. */ char *msg_accrights; /* Points to a buffer containing ** access rights sent with message. */ int msg_accrightslen;/* Len of the msg_accrights buffer. */ }; # endif #else /* ** BSD 4.3 message header */ struct msghdr { char *msg_name; /* The address of the destina- ** tion socket, if the socket is ** connected. If no address is ** required, this field can be ** set to NULL. */ int msg_namelen; /* Len of msg_name field. */ struct iovec *msg_iov; /* Scatter/Gather array. */ int msg_iovlen; /* # elements in msg_iov. */ char *msg_accrights; /* Points to a buffer containing ** access rights sent with message. */ int msg_accrightslen;/* Len of the msg_accrights buffer. */ }; #endif typedef struct msghdr *__msghdr_ptr; typedef const struct msghdr *__const_msghdr_ptr; /* ** This section is for functions and declarations which do support 64 bit ** pointers being passed (or returned). The socket interface is different ** from other 64 bit interfaces in that only a select set of functions ** accept 64 bit pointers. The DEC C RTL is a thin layer between the user ** application and a vendors tcp/ip interface. */ #if __CAN_USE_EXTERN_PREFIX # pragma __extern_prefix __save #endif #ifdef _SOCKADDR_LEN # if __CAN_USE_EXTERN_PREFIX # pragma __extern_prefix "__bsd44_" # else # define recvmsg(__p1,__p2,__p3) __bsd44_recvmsg(__p1,__p2,__p3) # define sendmsg(__p1,__p2,__p3) __bsd44_sendmsg(__p1,__p2,__p3) # endif #endif __ssize_t recvmsg(int __sd, __msghdr_ptr __msg, int __flags); __ssize_t sendmsg(int __sd, __const_msghdr_ptr __msg, int __flags); #if __CAN_USE_EXTERN_PREFIX # pragma __extern_prefix __restore #endif /* ** New pointer-size specific entry points for sendmsg and recvmsg were added in ** OpenVMS V7.3-2 to support pointer-size specific struct msghdr. These are ** new pointer-size specific entry points and hence are not available on VAX. */ #if __INITIAL_POINTER_SIZE && __CRTL_VER >= 70311000 # if __CAN_USE_EXTERN_PREFIX # pragma __extern_prefix __save # endif # ifdef _SOCKADDR_LEN # if __CAN_USE_EXTERN_PREFIX # pragma __extern_prefix "__bsd44_" # else # define __recvmsg32(__p1,__p2,__p3) __bsd44___recvmsg32(__p1,__p2,__p3) # define __sendmsg32(__p1,__p2,__p3) __bsd44___sendmsg32(__p1,__p2,__p3) # define __recvmsg64(__p1,__p2,__p3) __bsd44___recvmsg64(__p1,__p2,__p3) # define __sendmsg64(__p1,__p2,__p3) __bsd44___sendmsg64(__p1,__p2,__p3) # endif # endif __ssize_t __recvmsg32(int __sd, __msghdr32_ptr32 __msg, int __flags); __ssize_t __sendmsg32(int __sd, __const_msghdr32_ptr32 __msg, int __flags); __ssize_t __recvmsg64(int __sd, __msghdr64_ptr64 __msg, int __flags); __ssize_t __sendmsg64(int __sd, __const_msghdr64_ptr64 __msg, int __flags); # if __CAN_USE_EXTERN_PREFIX # pragma __extern_prefix __restore # endif #endif #if __INITIAL_POINTER_SIZE == 64 && __CRTL_VER >= 70311000 # define recvmsg(__p1,__p2,__p3) __recvmsg64(__p1,__p2,__p3) # define sendmsg(__p1,__p2,__p3) __sendmsg64(__p1,__p2,__p3) # define __bsd44_recvmsg(__p1,__p2,__p3) __bsd44___recvmsg64(__p1,__p2,__p3) # define __bsd44_sendmsg(__p1,__p2,__p3) __bsd44___sendmsg64(__p1,__p2,__p3) #endif /* ** If the user has used /pointer_size=32 or /pointer_size=64, we will allow 64 ** bit pointers to be used in function calls. */ #if __INITIAL_POINTER_SIZE # pragma __pointer_size 64 #endif /* ** Functions which will always accept 32 or 64 bit pointers. If the ** underlying tcp/ip layer has 64 bit support, then the addresses will be ** passed as they are. If the underlying layer does not have 64 bit ** address support, then the data will be copied to a malloced area and ** then passed on to the underlying layer. */ #ifdef _SOCKADDR_LEN # if __CAN_USE_EXTERN_PREFIX # pragma __extern_prefix __save # pragma __extern_prefix "__bsd44_" # else # define accept(__p1,__p2,__p3) __bsd44_accept(__p1,__p2,__p3) # define bind(__p1,__p2,__p3) __bsd44_bind(__p1,__p2,__p3) # define connect(__p1,__p2,__p3) __bsd44_connect(__p1,__p2,__p3) # define getpeername(__p1,__p2,__p3) __bsd44_getpeername(__p1,__p2,__p3) # define getsockname(__p1,__p2,__p3) __bsd44_getsockname(__p1,__p2,__p3) # define recvfrom(__p1,__p2,__p3,__p4,__p5,__p6) __bsd44_recvfrom(__p1,__p2,__p3,__p4,__p5,__p6) # define sendto(__p1,__p2,__p3,__p4,__p5,__p6) __bsd44_sendto(__p1,__p2,__p3,__p4,__p5,__p6) # endif #endif /* ** In DEC C V4.0, the following routines used int or int * ** for the length parameters. X/Open specifies that these ** are size_t. */ #if !defined _DECC_V4_SOURCE int accept (int __sd, struct sockaddr *__S_addr, __size_t *__len); int bind (int __sd, const struct sockaddr *__s_name, __size_t __len); int connect (int __sd, const struct sockaddr *__name, __size_t __len); int getpeername (int __sd, struct sockaddr *__name, __size_t *__len); int getsockname (int __sd, struct sockaddr *__name, __size_t *__len); __ssize_t recvfrom (int __sd, void *__buf, __size_t __buflen, int __flags, struct sockaddr *__from, __size_t *__fromlen); __ssize_t sendto (int __sd, const void *__msg, __size_t __msglen, int __flags, const struct sockaddr *__to, __size_t __tolen); #else int accept (int __sd, struct sockaddr *__S_addr, int *__addrlen); int bind (int __sd, struct sockaddr *__s_name, int __namelen); int connect (int __sd, struct sockaddr *__name, int __namelen); int getpeername (int __sd, struct sockaddr *__name, int *__namelen); int getsockname (int __sd, struct sockaddr *__name, int *__namelen); int recvfrom (int __sd, char *__buf, int __length, int __flags, struct sockaddr *__from, int *__fromlen); int sendto (int __sd, char *__msg, int __length, int __flags, struct sockaddr *__to, int __tolen); #endif #ifdef _SOCKADDR_LEN # if __CAN_USE_EXTERN_PREFIX # pragma __extern_prefix __restore # endif #endif /* ** In DEC C V4.0, the following routines used int or int * ** for the length parameters and char * for the option ** value. X/Open specifies that these are size_t and void *. */ #if !defined _DECC_V4_SOURCE int getsockopt (int __sd, int __level, int __optname, void *__optval, __size_t *__optlen); int setsockopt (int __sd, int __level, int __optname, const void *__optval, __size_t __optlen); __ssize_t recv (int __sd, void *__buf, __size_t __length, int __flags); __ssize_t send (int __sd, const void *__msg, __size_t __length, int __flags); #else int getsockopt (int __sd, int __level, int __optname, char *__optval, int *__optlen); int setsockopt (int __sd, int __level, int __optname, char *__optval, int __optlen); int send (int __sd, char *__msg, int __length, int __flags); int recv (int __sd, char *__buf, int __length, int __flags); #endif int listen (int __sd, int __backlog); int shutdown (int __sd, int __mode); int socket (int __af, int __mess_type, int __prot_type); /* ** DEC C Extensions (64-bit) */ #ifndef _XOPEN_SOURCE_EXTENDED # if __CRTL_VER >= 70000000 int decc$socket_fd (int __channel); # if !defined(__DECC) || (__DECC_VER < 60400000) int socket_fd (int __channel); # endif # endif int decc$get_sdc (int __descrip_no); # define vaxc$get_sdc(x) decc$get_sdc(x) int gethostaddr (char *__addr); # ifdef _DECC_V4_SOURCE int gethostname (char *__name, int __namelen); int select (int __nfds, int *__readfds, int *__writefds, int *__exceptfds, struct timeval *__timeout); # else int gethostname (char *__name, __size_t __namelen); int select (int __nfds, fd_set *__readfds, fd_set *__writefds, fd_set *__exceptfds, struct timeval *__timeout); # endif #endif #if (__CRTL_VER >= 80200000) int socketpair (int af, int mess_type, int prot_type, int sd[2] ); #endif /* ** Restore the users pointer context */ #if __INITIAL_POINTER_SIZE # pragma __pointer_size __restore #endif #ifdef __cplusplus } #endif #pragma __member_alignment __restore #pragma __standard #endif /* __SOCKET_LOADED */