27 #pragma GCC system_header 31 #if defined _GL_ALREADY_INCLUDING_SYS_SOCKET_H 38 #include_next <sys/socket.h> 43 #ifndef _GL_SYS_SOCKET_H 47 # define _GL_ALREADY_INCLUDING_SYS_SOCKET_H 58 # include_next <sys/socket.h> 60 # undef _GL_ALREADY_INCLUDING_SYS_SOCKET_H 64 #ifndef _GL_SYS_SOCKET_H 65 #define _GL_SYS_SOCKET_H 67 #ifndef _GL_INLINE_HEADER_BEGIN 68 #error "Please include config.h first." 71 #ifndef _GL_SYS_SOCKET_INLINE 72 # define _GL_SYS_SOCKET_INLINE _GL_INLINE 96 #if defined __cplusplus && defined GNULIB_NAMESPACE 97 # define _GL_BEGIN_NAMESPACE namespace GNULIB_NAMESPACE { 98 # define _GL_END_NAMESPACE } 100 # define _GL_BEGIN_NAMESPACE 101 # define _GL_END_NAMESPACE 165 #if defined __cplusplus 166 # define _GL_EXTERN_C extern "C" 168 # define _GL_EXTERN_C extern 178 #define _GL_FUNCDECL_RPL(func,rettype,parameters_and_attributes) \ 179 _GL_FUNCDECL_RPL_1 (rpl_##func, rettype, parameters_and_attributes) 180 #define _GL_FUNCDECL_RPL_1(rpl_func,rettype,parameters_and_attributes) \ 181 _GL_EXTERN_C rettype rpl_func parameters_and_attributes 190 #define _GL_FUNCDECL_SYS(func,rettype,parameters_and_attributes) \ 191 _GL_EXTERN_C rettype func parameters_and_attributes 202 #define _GL_CXXALIAS_RPL(func,rettype,parameters) \ 203 _GL_CXXALIAS_RPL_1 (func, rpl_##func, rettype, parameters) 204 #if defined __cplusplus && defined GNULIB_NAMESPACE 205 # define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \ 206 namespace GNULIB_NAMESPACE \ 208 static const struct _gl_ ## func ## _wrapper \ 210 typedef rettype (*type) parameters; \ 212 inline operator type () const \ 218 _GL_EXTERN_C int _gl_cxxalias_dummy 220 # define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \ 221 _GL_EXTERN_C int _gl_cxxalias_dummy 229 #if defined __cplusplus && defined GNULIB_NAMESPACE 230 # define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \ 231 namespace GNULIB_NAMESPACE \ 233 static const struct _gl_ ## func ## _wrapper \ 235 typedef rettype (*type) parameters; \ 237 inline operator type () const \ 239 return reinterpret_cast<type>(::rpl_func); \ 243 _GL_EXTERN_C int _gl_cxxalias_dummy 245 # define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \ 246 _GL_EXTERN_C int _gl_cxxalias_dummy 259 #if defined __cplusplus && defined GNULIB_NAMESPACE 260 # define _GL_CXXALIAS_SYS(func,rettype,parameters) \ 261 namespace GNULIB_NAMESPACE \ 263 static const struct _gl_ ## func ## _wrapper \ 265 typedef rettype (*type) parameters; \ 267 inline operator type () const \ 273 _GL_EXTERN_C int _gl_cxxalias_dummy 275 # define _GL_CXXALIAS_SYS(func,rettype,parameters) \ 276 _GL_EXTERN_C int _gl_cxxalias_dummy 284 #if defined __cplusplus && defined GNULIB_NAMESPACE 285 # define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \ 286 namespace GNULIB_NAMESPACE \ 288 static const struct _gl_ ## func ## _wrapper \ 290 typedef rettype (*type) parameters; \ 292 inline operator type () const \ 294 return reinterpret_cast<type>(::func); \ 298 _GL_EXTERN_C int _gl_cxxalias_dummy 300 # define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \ 301 _GL_EXTERN_C int _gl_cxxalias_dummy 310 #if defined __cplusplus && defined GNULIB_NAMESPACE 316 # define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \ 317 namespace GNULIB_NAMESPACE \ 319 static const struct _gl_ ## func ## _wrapper \ 321 typedef rettype (*type) parameters; \ 323 inline operator type () const \ 325 return reinterpret_cast<type>((rettype2 (*) parameters2)(::func)); \ 329 _GL_EXTERN_C int _gl_cxxalias_dummy 331 # define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \ 332 _GL_EXTERN_C int _gl_cxxalias_dummy 339 #if defined __cplusplus && defined GNULIB_NAMESPACE 340 # define _GL_CXXALIASWARN(func) \ 341 _GL_CXXALIASWARN_1 (func, GNULIB_NAMESPACE) 342 # define _GL_CXXALIASWARN_1(func,namespace) \ 343 _GL_CXXALIASWARN_2 (func, namespace) 347 # define _GL_CXXALIASWARN_2(func,namespace) \ 348 _GL_WARN_ON_USE (func, \ 349 "The symbol ::" #func " refers to the system function. " \ 350 "Use " #namespace "::" #func " instead.") 351 # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING 352 # define _GL_CXXALIASWARN_2(func,namespace) \ 353 extern __typeof__ (func) func 355 # define _GL_CXXALIASWARN_2(func,namespace) \ 356 _GL_EXTERN_C int _gl_cxxalias_dummy 359 # define _GL_CXXALIASWARN(func) \ 360 _GL_EXTERN_C int _gl_cxxalias_dummy 366 #if defined __cplusplus && defined GNULIB_NAMESPACE 367 # define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \ 368 _GL_CXXALIASWARN1_1 (func, rettype, parameters_and_attributes, \ 370 # define _GL_CXXALIASWARN1_1(func,rettype,parameters_and_attributes,namespace) \ 371 _GL_CXXALIASWARN1_2 (func, rettype, parameters_and_attributes, namespace) 375 # define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \ 376 _GL_WARN_ON_USE_CXX (func, rettype, parameters_and_attributes, \ 377 "The symbol ::" #func " refers to the system function. " \ 378 "Use " #namespace "::" #func " instead.") 379 # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING 380 # define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \ 381 extern __typeof__ (func) func 383 # define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \ 384 _GL_EXTERN_C int _gl_cxxalias_dummy 387 # define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \ 388 _GL_EXTERN_C int _gl_cxxalias_dummy 413 #ifndef _GL_ARG_NONNULL 414 # if (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || __GNUC__ > 3 415 # define _GL_ARG_NONNULL(params) __attribute__ ((__nonnull__ params)) 417 # define _GL_ARG_NONNULL(params) 485 #ifndef _GL_WARN_ON_USE 487 # if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__) 489 # define _GL_WARN_ON_USE(function, message) \ 490 extern __typeof__ (function) function __attribute__ ((__warning__ (message))) 491 # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING 493 # define _GL_WARN_ON_USE(function, message) \ 494 extern __typeof__ (function) function 496 # define _GL_WARN_ON_USE(function, message) \ 497 _GL_WARN_EXTERN_C int _gl_warn_on_use 507 #ifndef _GL_WARN_ON_USE_CXX 508 # if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__) 509 # define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \ 510 extern rettype function parameters_and_attributes \ 511 __attribute__ ((__warning__ (msg))) 512 # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING 514 # define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \ 515 extern rettype function parameters_and_attributes 517 # define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \ 518 _GL_WARN_EXTERN_C int _gl_warn_on_use 524 #ifndef _GL_WARN_EXTERN_C 525 # if defined __cplusplus 526 # define _GL_WARN_EXTERN_C extern "C" 528 # define _GL_WARN_EXTERN_C extern 533 # if !GNULIB_defined_sa_family_t 535 # if !defined __KLIBC__ || defined TCPV40HDRS 540 # define GNULIB_defined_sa_family_t 1 548 # define ss_family __ss_family 552 # include <stdalign.h> 555 # define __ss_aligntype unsigned long int 556 # define _SS_SIZE 256 557 # define _SS_PADSIZE \ 558 (_SS_SIZE - ((sizeof (sa_family_t) >= alignof (__ss_aligntype) \ 559 ? sizeof (sa_family_t) \ 560 : alignof (__ss_aligntype)) \ 561 + sizeof (__ss_aligntype))) 563 # if !GNULIB_defined_struct_sockaddr_storage 570 # define GNULIB_defined_struct_sockaddr_storage 1 577 #if ! defined __GLIBC__ 586 # if !defined SHUT_RD 589 # if !defined SHUT_WR 592 # if !defined SHUT_RDWR 598 # define CMSG_SPACE(length) _CMSG_SPACE(length) 601 # define CMSG_LEN(length) _CMSG_LEN(length) 608 # error "Cygwin does have a sys/socket.h, doesn't it?!?" 629 # include <winsock2.h> 632 # include <ws2tcpip.h> 636 # if !defined SHUT_RD && defined SD_RECEIVE 637 # define SHUT_RD SD_RECEIVE 639 # if !defined SHUT_WR && defined SD_SEND 640 # define SHUT_WR SD_SEND 642 # if !defined SHUT_RDWR && defined SD_BOTH 643 # define SHUT_RDWR SD_BOTH 651 # if !GNULIB_defined_socklen_t 652 typedef int socklen_t;
653 # define GNULIB_defined_socklen_t 1 662 socklen_t msg_namelen;
663 struct iovec *msg_iov;
674 # if !GNULIB_defined_rpl_fd_isset 679 rpl_fd_isset (SOCKET fd, fd_set *
set)
685 for (i = 0; i <
set->fd_count; i++)
686 if (set->fd_array[i] == fd)
692 # define GNULIB_defined_rpl_fd_isset 1 696 # define FD_ISSET(fd, set) rpl_fd_isset(fd, set) 703 # if !defined _GL_UNISTD_H 704 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 706 # define close close_used_without_including_unistd_h 709 "close() used without including <unistd.h>");
711 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 713 # define gethostname gethostname_used_without_including_unistd_h 716 "gethostname() used without including <unistd.h>");
719 # if !defined _GL_SYS_SELECT_H 720 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 722 # define select select_used_without_including_sys_select_h 725 "select() used without including <sys/select.h>");
734 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 736 # define socket rpl_socket 746 # define socket socket_used_without_requesting_gnulib_module_socket 747 #elif defined GNULIB_POSIXCHECK 749 # if HAVE_RAW_DECL_SOCKET 751 "use gnulib module socket for portability");
757 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 759 # define connect rpl_connect 762 (
int fd,
const struct sockaddr *addr, socklen_t addrlen)
765 (
int fd,
const struct sockaddr *addr, socklen_t addrlen));
771 const struct sockaddr *addr, socklen_t addrlen));
776 # define connect socket_used_without_requesting_gnulib_module_connect 777 #elif defined GNULIB_POSIXCHECK 779 # if HAVE_RAW_DECL_CONNECT 781 "use gnulib module connect for portability");
787 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 789 # define accept rpl_accept 792 (
int fd,
struct sockaddr *addr, socklen_t *addrlen));
794 (
int fd,
struct sockaddr *addr, socklen_t *addrlen));
799 (
int fd,
struct sockaddr *addr, socklen_t *addrlen));
804 # define accept accept_used_without_requesting_gnulib_module_accept 805 #elif defined GNULIB_POSIXCHECK 807 # if HAVE_RAW_DECL_ACCEPT 809 "use gnulib module accept for portability");
815 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 817 # define bind rpl_bind 820 (
int fd,
const struct sockaddr *addr, socklen_t addrlen)
823 (
int fd,
const struct sockaddr *addr, socklen_t addrlen));
829 const struct sockaddr *addr, socklen_t addrlen));
834 # define bind bind_used_without_requesting_gnulib_module_bind 835 #elif defined GNULIB_POSIXCHECK 837 # if HAVE_RAW_DECL_BIND 839 "use gnulib module bind for portability");
845 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 847 # define getpeername rpl_getpeername 850 (
int fd,
struct sockaddr *addr, socklen_t *addrlen)
853 (
int fd,
struct sockaddr *addr, socklen_t *addrlen));
858 (
int fd,
struct sockaddr *addr, socklen_t *addrlen));
863 # define getpeername getpeername_used_without_requesting_gnulib_module_getpeername 864 #elif defined GNULIB_POSIXCHECK 866 # if HAVE_RAW_DECL_GETPEERNAME 867 _GL_WARN_ON_USE (getpeername,
"getpeername is not always POSIX compliant - " 868 "use gnulib module getpeername for portability");
874 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 876 # define getsockname rpl_getsockname 879 (
int fd,
struct sockaddr *addr, socklen_t *addrlen)
882 (
int fd,
struct sockaddr *addr, socklen_t *addrlen));
887 (
int fd,
struct sockaddr *addr, socklen_t *addrlen));
892 # define getsockname getsockname_used_without_requesting_gnulib_module_getsockname 893 #elif defined GNULIB_POSIXCHECK 895 # if HAVE_RAW_DECL_GETSOCKNAME 896 _GL_WARN_ON_USE (getsockname,
"getsockname is not always POSIX compliant - " 897 "use gnulib module getsockname for portability");
903 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 905 # define getsockopt rpl_getsockopt 908 void *optval, socklen_t *optlen)
911 void *optval, socklen_t *optlen));
916 void *optval, socklen_t *optlen));
921 # define getsockopt getsockopt_used_without_requesting_gnulib_module_getsockopt 922 #elif defined GNULIB_POSIXCHECK 924 # if HAVE_RAW_DECL_GETSOCKOPT 925 _GL_WARN_ON_USE (getsockopt,
"getsockopt is not always POSIX compliant - " 926 "use gnulib module getsockopt for portability");
932 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 934 # define listen rpl_listen 944 # define listen listen_used_without_requesting_gnulib_module_listen 945 #elif defined GNULIB_POSIXCHECK 947 # if HAVE_RAW_DECL_LISTEN 949 "use gnulib module listen for portability");
955 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 957 # define recv rpl_recv 961 _GL_CXXALIAS_RPL (recv, ssize_t, (
int fd,
void *buf,
size_t len,
int flags));
963 _GL_CXXALIAS_SYS (recv, ssize_t, (
int fd,
void *buf,
size_t len,
int flags));
968 # define recv recv_used_without_requesting_gnulib_module_recv 969 #elif defined GNULIB_POSIXCHECK 971 # if HAVE_RAW_DECL_RECV 973 "use gnulib module recv for portability");
979 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 981 # define send rpl_send 984 (
int fd,
const void *buf,
size_t len,
int flags)
987 (
int fd,
const void *buf,
size_t len,
int flags));
990 (
int fd,
const void *buf,
size_t len,
int flags));
995 # define send send_used_without_requesting_gnulib_module_send 996 #elif defined GNULIB_POSIXCHECK 998 # if HAVE_RAW_DECL_SEND 1000 "use gnulib module send for portability");
1006 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1008 # define recvfrom rpl_recvfrom 1011 (
int fd,
void *buf,
size_t len,
int flags,
1012 struct sockaddr *from, socklen_t *fromlen)
1015 (
int fd,
void *buf,
size_t len,
int flags,
1016 struct sockaddr *from, socklen_t *fromlen));
1021 (
int fd,
void *buf,
size_t len,
int flags,
1022 struct sockaddr *from, socklen_t *fromlen));
1027 # define recvfrom recvfrom_used_without_requesting_gnulib_module_recvfrom 1028 #elif defined GNULIB_POSIXCHECK 1030 # if HAVE_RAW_DECL_RECVFROM 1031 _GL_WARN_ON_USE (recvfrom,
"recvfrom is not always POSIX compliant - " 1032 "use gnulib module recvfrom for portability");
1038 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1040 # define sendto rpl_sendto 1043 (
int fd,
const void *buf,
size_t len,
int flags,
1044 const struct sockaddr *to, socklen_t tolen)
1047 (
int fd,
const void *buf,
size_t len,
int flags,
1048 const struct sockaddr *to, socklen_t tolen));
1053 (
int fd,
const void *buf,
size_t len,
int flags,
1054 const struct sockaddr *to, socklen_t tolen));
1059 # define sendto sendto_used_without_requesting_gnulib_module_sendto 1060 #elif defined GNULIB_POSIXCHECK 1062 # if HAVE_RAW_DECL_SENDTO 1064 "use gnulib module sendto for portability");
1070 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1072 # define setsockopt rpl_setsockopt 1075 const void * optval, socklen_t optlen)
1078 const void * optval, socklen_t optlen));
1083 (
int fd,
int level,
int optname,
1084 const void * optval, socklen_t optlen));
1089 # define setsockopt setsockopt_used_without_requesting_gnulib_module_setsockopt 1090 #elif defined GNULIB_POSIXCHECK 1092 # if HAVE_RAW_DECL_SETSOCKOPT 1093 _GL_WARN_ON_USE (setsockopt,
"setsockopt is not always POSIX compliant - " 1094 "use gnulib module setsockopt for portability");
1100 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1102 # define shutdown rpl_shutdown 1112 # define shutdown shutdown_used_without_requesting_gnulib_module_shutdown 1113 #elif defined GNULIB_POSIXCHECK 1115 # if HAVE_RAW_DECL_SHUTDOWN 1116 _GL_WARN_ON_USE (shutdown,
"shutdown is not always POSIX compliant - " 1117 "use gnulib module shutdown for portability");
1128 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1129 # define accept4 rpl_accept4 1132 (
int sockfd,
struct sockaddr *addr, socklen_t *addrlen,
1135 (
int sockfd,
struct sockaddr *addr, socklen_t *addrlen,
1139 (
int sockfd,
struct sockaddr *addr, socklen_t *addrlen,
1142 (
int sockfd,
struct sockaddr *addr, socklen_t *addrlen,
1146 #elif defined GNULIB_POSIXCHECK 1148 # if HAVE_RAW_DECL_ACCEPT4 1150 "use gnulib module accept4 for portability");
unsigned short sa_family_t
Definition: sys_socket.in.h:84
Definition: sys_socket.in.h:208
#define _GL_FUNCDECL_SYS(func, rettype, parameters_and_attributes)
Definition: socket.h:190
#define _GL_ARG_NONNULL(params)
Definition: socket.h:417
#define _SS_PADSIZE
Definition: sys_socket.in.h:105
#define _GL_CXXALIAS_SYS_CAST(func, rettype, parameters)
Definition: socket.h:300
#define _GL_CXXALIAS_SYS(func, rettype, parameters)
Definition: socket.h:275
__ss_aligntype __ss_align
Definition: sys_socket.in.h:115
sa_family_t ss_family
Definition: sys_socket.in.h:114
Definition: sys_socket.in.h:112
#define NULL
Definition: stddef.in.h:72
Definition: sys_uio.in.h:49
#define _GL_CXXALIAS_RPL(func, rettype, parameters)
Definition: socket.h:202
#define __ss_aligntype
Definition: sys_socket.in.h:103
#define _GL_SYS_SOCKET_INLINE
Definition: socket.h:72
#define _GL_INLINE_HEADER_BEGIN
Definition: config.h:1817
#define _GL_FUNCDECL_RPL(func, rettype, parameters_and_attributes)
Definition: socket.h:178
char __ss_padding[_SS_PADSIZE]
Definition: sys_socket.in.h:116
#define _GL_INLINE_HEADER_END
Definition: config.h:1818
#define _GL_WARN_ON_USE(function, message)
Definition: socket.h:496
#define _GL_CXXALIASWARN(func)
Definition: socket.h:359