2 +--------------------------------------------------------------------+
3 | libmemcached - C/C++ Client Library for memcached |
4 +--------------------------------------------------------------------+
5 | Redistribution and use in source and binary forms, with or without |
6 | modification, are permitted under the terms of the BSD license. |
7 | You should have received a copy of the license in a bundled file |
8 | named LICENSE; in case you did not receive a copy you can review |
9 | the terms online at: https://opensource.org/licenses/BSD-3-Clause |
10 +--------------------------------------------------------------------+
11 | Copyright (c) 2006-2014 Brian Aker https://datadifferential.com/ |
12 | Copyright (c) 2020 Michael Wallner <mike@php.net> |
13 +--------------------------------------------------------------------+
24 #ifndef WIN32_LEAN_AND_MEAN
25 # define WIN32_LEAN_AND_MEAN
29 # define _WIN32_WINNT 0x0501
33 # if (_WIN32_WINNT >= 0x0501)
36 # define _WIN32_WINNT 0x0501
37 # endif /* _WIN32_WINNT >= 0x0501 */
38 #endif /* __MINGW32__ */
40 #if defined(HAVE_WINSOCK2_H) && HAVE_WINSOCK2_H
41 # include <winsock2.h>
44 #if defined(HAVE_WS2TCPIP_H) && HAVE_WS2TCPIP_H
45 # include <ws2tcpip.h>
48 #if defined(HAVE_IO_H) && HAVE_IO_H
57 static inline int translate_windows_error() {
58 int local_errno = WSAGetLastError();
60 switch (local_errno) {
61 case WSAEINVAL: local_errno = EINPROGRESS; break;
63 case WSAEWOULDBLOCK: local_errno = EAGAIN; break;
65 case WSAECONNREFUSED: local_errno = ECONNREFUSED; break;
67 case WSAENETUNREACH: local_errno = ENETUNREACH; break;
69 case WSAETIMEDOUT: local_errno = ETIMEDOUT; break;
71 case WSAECONNRESET: local_errno = ECONNRESET; break;
73 case WSAEADDRINUSE: local_errno = EADDRINUSE; break;
75 case WSAEOPNOTSUPP: local_errno = EOPNOTSUPP; break;
77 case WSAENOPROTOOPT: local_errno = ENOPROTOOPT; break;