123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285 |
- #ifndef _SYS_SOCKET_H
- #define _SYS_SOCKET_H 1
- #include <features.h>
- __BEGIN_DECLS
- #include <sys/uio.h>
- #define __need_size_t
- #include <stddef.h>
- #ifdef __USE_GNU
- # include <bits/sigset.h>
- #endif
- #include <bits/socket.h>
- #ifdef __USE_MISC
- struct osockaddr
- {
- unsigned short int sa_family;
- unsigned char sa_data[14];
- };
- #endif
- enum
- {
- SHUT_RD = 0,
- #define SHUT_RD SHUT_RD
- SHUT_WR,
- #define SHUT_WR SHUT_WR
- SHUT_RDWR
- #define SHUT_RDWR SHUT_RDWR
- };
- #if defined __cplusplus || !__GNUC_PREREQ (2, 7) || !defined __USE_GNU
- # define __SOCKADDR_ARG struct sockaddr *__restrict
- # define __CONST_SOCKADDR_ARG const struct sockaddr *
- #else
- # define __SOCKADDR_ALLTYPES \
- __SOCKADDR_ONETYPE (sockaddr) \
- __SOCKADDR_ONETYPE (sockaddr_at) \
- __SOCKADDR_ONETYPE (sockaddr_ax25) \
- __SOCKADDR_ONETYPE (sockaddr_dl) \
- __SOCKADDR_ONETYPE (sockaddr_eon) \
- __SOCKADDR_ONETYPE (sockaddr_in) \
- __SOCKADDR_ONETYPE (sockaddr_in6) \
- __SOCKADDR_ONETYPE (sockaddr_inarp) \
- __SOCKADDR_ONETYPE (sockaddr_ipx) \
- __SOCKADDR_ONETYPE (sockaddr_iso) \
- __SOCKADDR_ONETYPE (sockaddr_ns) \
- __SOCKADDR_ONETYPE (sockaddr_un) \
- __SOCKADDR_ONETYPE (sockaddr_x25)
- # define __SOCKADDR_ONETYPE(type) struct type *__restrict __##type##__;
- typedef union { __SOCKADDR_ALLTYPES
- } __SOCKADDR_ARG __attribute__ ((__transparent_union__));
- # undef __SOCKADDR_ONETYPE
- # define __SOCKADDR_ONETYPE(type) const struct type *__restrict __##type##__;
- typedef union { __SOCKADDR_ALLTYPES
- } __CONST_SOCKADDR_ARG __attribute__ ((__transparent_union__));
- # undef __SOCKADDR_ONETYPE
- #endif
- #ifdef __USE_GNU
- struct mmsghdr
- {
- struct msghdr msg_hdr;
- unsigned int msg_len;
- };
- #endif
- extern int socket (int __domain, int __type, int __protocol) __THROW;
- extern int socketpair (int __domain, int __type, int __protocol,
- int __fds[2]) __THROW;
- extern int bind (int __fd, __CONST_SOCKADDR_ARG __addr, socklen_t __len)
- __THROW;
- extern int getsockname (int __fd, __SOCKADDR_ARG __addr,
- socklen_t *__restrict __len) __THROW;
- extern int connect (int __fd, __CONST_SOCKADDR_ARG __addr, socklen_t __len);
- extern int getpeername (int __fd, __SOCKADDR_ARG __addr,
- socklen_t *__restrict __len) __THROW;
- extern ssize_t send (int __fd, const void *__buf, size_t __n, int __flags);
- extern ssize_t recv (int __fd, void *__buf, size_t __n, int __flags);
- extern ssize_t sendto (int __fd, const void *__buf, size_t __n,
- int __flags, __CONST_SOCKADDR_ARG __addr,
- socklen_t __addr_len);
- extern ssize_t recvfrom (int __fd, void *__restrict __buf, size_t __n,
- int __flags, __SOCKADDR_ARG __addr,
- socklen_t *__restrict __addr_len);
- extern ssize_t sendmsg (int __fd, const struct msghdr *__message,
- int __flags);
- #ifdef __USE_GNU
- extern int sendmmsg (int __fd, struct mmsghdr *__vmessages,
- unsigned int __vlen, int __flags);
- #endif
- extern ssize_t recvmsg (int __fd, struct msghdr *__message, int __flags);
- #ifdef __USE_GNU
- extern int recvmmsg (int __fd, struct mmsghdr *__vmessages,
- unsigned int __vlen, int __flags,
- struct timespec *__tmo);
- #endif
- extern int getsockopt (int __fd, int __level, int __optname,
- void *__restrict __optval,
- socklen_t *__restrict __optlen) __THROW;
- extern int setsockopt (int __fd, int __level, int __optname,
- const void *__optval, socklen_t __optlen) __THROW;
- extern int listen (int __fd, int __n) __THROW;
- extern int accept (int __fd, __SOCKADDR_ARG __addr,
- socklen_t *__restrict __addr_len);
- #ifdef __USE_GNU
- extern int accept4 (int __fd, __SOCKADDR_ARG __addr,
- socklen_t *__restrict __addr_len, int __flags);
- #endif
- extern int shutdown (int __fd, int __how) __THROW;
- #ifdef __USE_XOPEN2K
- extern int sockatmark (int __fd) __THROW;
- #endif
- #ifdef __USE_MISC
- extern int isfdtype (int __fd, int __fdtype) __THROW;
- #endif
- #if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function
- # include <bits/socket2.h>
- #endif
- __END_DECLS
- #endif
|