| 1 |
. |
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
#ifndef __SOCKET_SHIM_H |
| 7 |
#define __SOCKET_SHIM_H |
| 8 |
|
| 9 |
#ifndef SOL_IP |
| 10 |
#define SOL_IP 0x0 |
| 11 |
#define SOL_IPV6 0x29 |
| 12 |
#endif |
| 13 |
|
| 14 |
#ifdef _WIN32 |
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
#if !defined(_WIN32_WINNT) || _WIN32_WINNT < 0x0600 |
| 20 |
# undef _WIN32_WINNT |
| 21 |
# define _WIN32_WINNT 0x0600 |
| 22 |
#endif |
| 23 |
#include <winsock2.h> |
| 24 |
#define _WINSOCKAPI_ |
| 25 |
#include <windows.h> |
| 26 |
#include <ws2tcpip.h> |
| 27 |
#include <stdlib.h> |
| 28 |
#define AF_LOCAL AF_UNSPEC |
| 29 |
#define MSG_DONTWAIT (0) |
| 30 |
|
| 31 |
typedef int socklen_t; |
| 32 |
#ifndef __MINGW32__ |
| 33 |
#include <io.h> |
| 34 |
#define dup(s) _dup(s) |
| 35 |
#define write(fd, buf, size) _write(fd, buf, size) |
| 36 |
#endif |
| 37 |
|
| 38 |
#ifndef SHUT_RDWR |
| 39 |
#define SHUT_RDWR SD_BOTH |
| 40 |
#endif |
| 41 |
|
| 42 |
#else |
| 43 |
|
| 44 |
#include <sys/types.h> |
| 45 |
#include <sys/socket.h> |
| 46 |
#include <netdb.h> |
| 47 |
#include <unistd.h> |
| 48 |
#include <arpa/inet.h> |
| 49 |
#include <netinet/in.h> |
| 50 |
#include <netinet/ip.h> |
| 51 |
#include <netinet/ip6.h> |
| 52 |
#include <net/if.h> |
| 53 |
|
| 54 |
#endif |
| 55 |
|
| 56 |
#endif |