socket.h, socket - Internet Protocol family
#include <sys/socket.h>
The <sys/socket.h> header defines the unsigned integral type sa_family_t through typedef.
The <sys/socket.h> header defines the sockaddr structure that includes the following members:
sa_family_t sa_family /* address family */ char sa_data[] /* socket address (variable-length data) */
The <sys/socket.h> header defines the msghdr structure for libxnet interfaces that includes the following members:
void *msg_name /* optional address */ socklen_t msg_namelen /* size of address */ struct iovec *msg_iov /* scatter/gather array */ int msg_iovlen /* members in msg_iov */ void *msg_control /* ancillary data, see below */ socklen_t msg_controllen /* ancillary data buffer len */ int msg_flags /* flags on received message */
The <sys/socket.h> header defines the cmsghdr structure for libxnet that includes the following members:
socklen_t cmsg_len /* data byte count, including hdr */ int cmsg_level /* originating protocol */ int cmsg_type /* protocol-specific type */
Ancillary data consists of a sequence of pairs, each consisting of a cmsghdr structure followed by a data array. The data array contains the ancillary data message, and the cmsghdr structure contains descriptive information that allows an application to correctly parse the data.
The values for cmsg_level will be legal values for the level argument to the getsockopt() and setsockopt() functions. The SCM_RIGHTS type is supported for level SOL_SOCKET.
Ancillary data is also possible at the socket level. The <sys/socket.h> header defines the following macros for use as the cmsg_type values when cmsg_level is SOL_SOCKET.
SCM_RIGHTS
SCM_UCRED
The IPv4 data formats generally use the same values for data passed back in cmsghdr as for setsockopt() to enable the feature. The IPv4 data formats are listed below with the assocated payload for each.
IPPROTO_IP
IP_RECVDSTADDR
IPPROTO_IP
IP_RECVOPTS
IPPROTO_IP
IP_RECVIF
IPPROTO_IP
IP_RECVSLLA
IPPROTO_IP
IP_RECVTTL
SOL_SOCKET
SO_RECVUCRED
The IPv6 data formats use different values for enabling the option and for passing the value back to the application. The IPv6 data formats are listed below with the assocated payload for each.
IPPROTO_IPV6
IPV6_RECVPKTINFO
IPPROTO_IPV6
IPV6_RECVTCLASS
IPPROTO_IPV6
IPV6_RECVPATHMTU
IPPROTO_IPV6
IPV6_RECVHOPLIMIT
IPPROTO_IPV6
IPV6_RECVHOPOPTS
IPPROTO_IPV6
IPV6_RECVDSTOPTS
IPPROTO_IPV6
IPV6_RECVRTHDR
IPPROTO_IPV6
IPV6_RECVRTHDRDSTOPTS
The <sys/socket.h> header defines the following macros to gain access to the data arrays in the ancillary data associated with a message header:
CMSG_DATA(cmsg)
CMSG_NXTHDR(mhdr, cmsg)
CMSG_FIRSTHDR(mhdr)
CMSG_SPACE(len)
CMSG_LEN(len)
The <sys/socket.h> header defines the linger structure that includes the following members:
int l_onoff /* indicates whether linger option is enabled */ int l_linger /* linger time, in seconds */
The <sys/socket.h> header defines the following macros:
SOCK_DGRAM
SOCK_STREAM
SOCK_SEQPACKET
The <sys/socket.h> header defines the following macro for use as the level argument of setsockopt() and getsockopt().
SOL_SOCKET
The <sys/socket.h> header defines the following macros for use as the option_name argument in getsockopt() or setsockopt() calls:
SO_DEBUG
SO_ACCEPTCONN
SO_BROADCAST
SO_REUSEADDR
SO_KEEPALIVE
SO_LINGER
SO_OOBINLINE
SO_SNDBUF
SO_RCVBUF
SO_ERROR
SO_TYPE
SO_RECVUCRED
SO_MAC_EXEMPT
SO_ALLZONES
The <sys/socket.h> header defines the following macros for use as the valid values for the msg_flags field in the msghdr structure, or the flags parameter in recvfrom(), recvmsg(), sendto(), or sendmsg() calls:
MSG_CTRUNC
MSG_EOR
MSG_OOB
MSG_PEEK
MSG_TRUNC
MSG_WAITALL
The <sys/socket.h> header defines the following macros:
AF_UNIX
AF_INET
The <sys/socket.h> header defines the following macros:
SHUT_RD
SHUT_WR
SHUT_RDWR
The <sys/socket.h> header defines the msghdr structure for libsocket interfaces that includes the following members:
void *msg_name /* optional address */ socklen_t msg_namelen /* size of address */ struct iovec *msg_iov /* scatter/gather array */ int msg_iovlen /* # elements in msg_iov */ caddr_t msg_accrights /* access rights sent/received */
The msg_name and msg_namelen parameters specify the destination address when the socket is unconnected The msg_name can be specified as a NULL pointer if no names are desired or required. The msg_iov and msg_iovlen parameters describe the scatter-gather locations, as described in read(2). The msg_accrights parameter specifies the buffer in which access rights sent along with the message are received. The msg_accrightslen specifies the length of the buffer.
See attributes(5) for descriptions of the following attributes:
|
accept(3SOCKET), accept(3XNET), bind(3SOCKET), bind(3XNET), connect(3SOCKET), connect(3XNET), getpeername(3SOCKET), getpeername(3XNET), getpeerucred(3C), getsockname(3SOCKET), getsockname(3XNET), getsockopt(3SOCKET), getsockopt(3XNET), libsocket(3LIB), listen(3SOCKET), listen(3XNET), recv(3SOCKET), recv(3XNET), recvfrom(3SOCKET), recvfrom(3XNET), recvmsg(3SOCKET), recvmsg(3XNET), send(3SOCKET), send(3XNET), sendmsg(3SOCKET), sendmsg(3XNET), sendto(3SOCKET), sendto(3XNET), setsockopt(3SOCKET), setsockopt(3XNET), shutdown(3SOCKET), shutdown(3XNET), socket(3SOCKET), socket(3XNET), socketpair(3SOCKET) socketpair(3XNET), ucred_get(3C)attributes(5), standards(5)
Закладки на сайте Проследить за страницей |
Created 1996-2024 by Maxim Chirkov Добавить, Поддержать, Вебмастеру |