semver: 1.0 -> 1
[m6w6/libmemcached] / src / p9y / socket.hpp
1 #pragma once
2
3 #include "libmemcached-1/platform.h"
4
5 #if defined __cplusplus
6 # include <cerrno>
7 #else
8 # include <errno.h>
9 #endif
10
11 #include <fcntl.h>
12
13 #if defined HAVE_ARPA_INET_H
14 # include <arpa/inet.h>
15 #endif
16
17 #if defined HAVE_SYS_SOCKET_H
18 # include <sys/socket.h>
19 #endif
20
21 #if defined HAVE_NETINET_IN_H
22 # include <netinet/in.h>
23 #endif
24
25 #if defined HAVE_NETINET_TCP_H
26 # include <netinet/tcp.h>
27 #endif
28
29 #if defined HAVE_SYS_UN_H
30 # include <sys/un.h>
31 #endif
32
33 #if defined HAVE_UNISTD_H
34 # include <unistd.h>
35 #endif
36
37 #if defined __cplusplus
38 extern "C" {
39 #endif
40
41 # if defined _WIN32
42 int get_socket_errno();
43 # define SHUT_WR SD_SEND
44 # define SHUT_RD SD_RECEIVE
45 # define SHUT_RDWR SD_BOTH
46 # else
47 # define closesocket close
48 # define get_socket_errno() errno
49 # define INVALID_SOCKET (-1)
50 # define SOCKET_ERROR (-1)
51 # endif
52
53 #if defined __cplusplus
54 }
55 #endif
56
57 #if !defined SOCK_CLOEXEC
58 # define SOCK_CLOEXEC 0
59 #endif
60
61 #if !defined SOCK_NONBLOCK
62 # define SOCK_NONBLOCK 0
63 #endif
64
65 #if !defined FD_CLOEXEC
66 # define FD_CLOEXEC 0
67 #endif
68
69 #if !defined SO_NOSIGPIPE
70 # define SO_NOSIGPIPE 0
71 #endif
72
73 #if !defined TCP_NODELAY
74 # define TCP_NODELAY 0
75 #endif
76
77 #if !defined TCP_KEEPIDLE
78 # define TCP_KEEPIDLE 0
79 #endif
80
81 #if !defined EAI_SYSTEM
82 # define EAI_SYSTEM (-1)
83 #endif
84
85 #if !defined HAVE_MSG_NOSIGNAL
86 # define MSG_NOSIGNAL 0
87 #endif
88
89 #if !defined HAVE_MSG_MORE
90 # define MSG_MORE 0
91 #endif