#pragma once
#include <folly/net/NetOps.h>
#include <folly/Portability.h>
namespace folly {
namespace portability {
namespace sockets {
#ifdef _WIN32
bool is_fh_socket(int fh);
SOCKET fd_to_socket(int fd);
int socket_to_fd(SOCKET s);
int accept(int s, struct sockaddr* addr, socklen_t* addrlen);
int inet_aton(const char* cp, struct in_addr* inp);
int socketpair(int domain, int type, int protocol, int sv[2]);
int bind(int s, const struct sockaddr* name, socklen_t namelen);
int connect(int s, const struct sockaddr* name, socklen_t namelen);
int getpeername(int s, struct sockaddr* name, socklen_t* namelen);
int getsockname(int s, struct sockaddr* name, socklen_t* namelen);
int getsockopt(int s, int level, int optname, void* optval, socklen_t* optlen);
const char* inet_ntop(int af, const void* src, char* dst, socklen_t size);
int listen(int s, int backlog);
int poll(struct pollfd fds[], nfds_t nfds, int timeout);
ssize_t recv(int s, void* buf, size_t len, int flags);
ssize_t recvfrom(
int s,
void* buf,
size_t len,
int flags,
struct sockaddr* from,
socklen_t* fromlen);
ssize_t send(int s, const void* buf, size_t len, int flags);
ssize_t sendto(
int s,
const void* buf,
size_t len,
int flags,
const sockaddr* to,
socklen_t tolen);
ssize_t sendmsg(int socket, const struct msghdr* message, int flags);
int setsockopt(
int s, int level, int optname, const void* optval, socklen_t optlen);
int shutdown(int s, int how);
int socket(int af, int type, int protocol);
int getsockopt(int s, int level, int optname, char* optval, socklen_t* optlen);
ssize_t recv(int s, char* buf, int len, int flags);
ssize_t recv(int s, void* buf, int len, int flags);
ssize_t recvfrom(
int s,
char* buf,
int len,
int flags,
struct sockaddr* from,
socklen_t* fromlen);
ssize_t recvfrom(
int s,
void* buf,
int len,
int flags,
struct sockaddr* from,
socklen_t* fromlen);
ssize_t recvmsg(int s, struct msghdr* message, int fl);
ssize_t send(int s, const char* buf, int len, int flags);
ssize_t send(int s, const void* buf, int len, int flags);
ssize_t sendto(
int s,
const char* buf,
int len,
int flags,
const sockaddr* to,
socklen_t tolen);
ssize_t sendto(
int s,
const void* buf,
int len,
int flags,
const sockaddr* to,
socklen_t tolen);
int setsockopt(
int s, int level, int optname, const char* optval, socklen_t optlen);
#elif defined(__EMSCRIPTEN__)
#else
accept;
bind;
connect;
getpeername;
getsockname;
getsockopt;
inet_ntop;
listen;
poll;
recv;
recvfrom;
send;
sendmsg;
sendto;
setsockopt;
shutdown;
socket;
#endif
}
}
}
#ifdef _WIN32
FOLLY_PUSH_WARNING
FOLLY_CLANG_DISABLE_WARNING("-Wheader-hygiene")
using namespace folly::portability::sockets;
FOLLY_POP_WARNING
#endif