aboutsummaryrefslogtreecommitdiffstats
path: root/util/network/init.h
diff options
context:
space:
mode:
authorDevtools Arcadia <arcadia-devtools@yandex-team.ru>2022-02-07 18:08:42 +0300
committerDevtools Arcadia <arcadia-devtools@mous.vla.yp-c.yandex.net>2022-02-07 18:08:42 +0300
commit1110808a9d39d4b808aef724c861a2e1a38d2a69 (patch)
treee26c9fed0de5d9873cce7e00bc214573dc2195b7 /util/network/init.h
downloadydb-1110808a9d39d4b808aef724c861a2e1a38d2a69.tar.gz
intermediate changes
ref:cde9a383711a11544ce7e107a78147fb96cc4029
Diffstat (limited to 'util/network/init.h')
-rw-r--r--util/network/init.h60
1 files changed, 60 insertions, 0 deletions
diff --git a/util/network/init.h b/util/network/init.h
new file mode 100644
index 0000000000..08a79c0fca
--- /dev/null
+++ b/util/network/init.h
@@ -0,0 +1,60 @@
+#pragma once
+
+#include <util/system/error.h>
+
+#if defined(_unix_)
+ #include <fcntl.h>
+ #include <netdb.h>
+ #include <time.h>
+ #include <unistd.h>
+ #include <poll.h>
+
+ #include <sys/uio.h>
+ #include <sys/time.h>
+ #include <sys/types.h>
+ #include <sys/socket.h>
+
+ #include <netinet/in.h>
+ #include <netinet/tcp.h>
+ #include <arpa/inet.h>
+
+using SOCKET = int;
+
+ #define closesocket(s) close(s)
+ #define SOCKET_ERROR -1
+ #define INVALID_SOCKET -1
+ #define WSAGetLastError() errno
+#elif defined(_win_)
+ #include <util/system/winint.h>
+ #include <io.h>
+ #include <winsock2.h>
+ #include <ws2tcpip.h>
+
+using nfds_t = ULONG;
+
+ #undef Yield
+
+struct sockaddr_un {
+ short sun_family;
+ char sun_path[108];
+};
+
+ #define PF_LOCAL AF_UNIX
+ #define NETDB_INTERNAL -1
+ #define NETDB_SUCCESS 0
+
+#endif
+
+#if defined(_win_) || defined(_darwin_)
+ #ifndef MSG_NOSIGNAL
+ #define MSG_NOSIGNAL 0
+ #endif
+#endif // _win_ or _darwin_
+
+void InitNetworkSubSystem();
+
+static struct TNetworkInitializer {
+ inline TNetworkInitializer() {
+ InitNetworkSubSystem();
+ }
+} NetworkInitializerObject;