aboutsummaryrefslogtreecommitdiff
path: root/slirp/slirp.h
diff options
context:
space:
mode:
Diffstat (limited to 'slirp/slirp.h')
-rw-r--r--slirp/slirp.h38
1 files changed, 37 insertions, 1 deletions
diff --git a/slirp/slirp.h b/slirp/slirp.h
index eecef59165..f5c93c5ee5 100644
--- a/slirp/slirp.h
+++ b/slirp/slirp.h
@@ -11,6 +11,30 @@
#include "config.h"
#include "slirp_config.h"
+#ifdef _WIN32
+# include <inttypes.h>
+
+typedef uint8_t u_int8_t;
+typedef uint16_t u_int16_t;
+typedef uint32_t u_int32_t;
+typedef uint64_t u_int64_t;
+typedef char *caddr_t;
+
+# include <winsock2.h>
+# include <sys/timeb.h>
+# include <iphlpapi.h>
+
+# define EWOULDBLOCK WSAEWOULDBLOCK
+# define EINPROGRESS WSAEINPROGRESS
+# define ENOTCONN WSAENOTCONN
+# define EHOSTUNREACH WSAEHOSTUNREACH
+# define ENETUNREACH WSAENETUNREACH
+# define ECONNREFUSED WSAECONNREFUSED
+#else
+# define ioctlsocket ioctl
+# define closesocket(s) close(s)
+#endif
+
#include <sys/types.h>
#ifdef HAVE_SYS_BITYPES_H
# include <sys/bitypes.h>
@@ -79,7 +103,9 @@ typedef unsigned char u_int8_t;
# include <strings.h>
#endif
+#ifndef _WIN32
#include <sys/uio.h>
+#endif
#ifndef _P
#ifndef NO_PROTOTYPES
@@ -89,8 +115,10 @@ typedef unsigned char u_int8_t;
#endif
#endif
+#ifndef _WIN32
#include <netinet/in.h>
#include <arpa/inet.h>
+#endif
#ifdef GETTIMEOFDAY_ONE_ARG
#define gettimeofday(x, y) gettimeofday(x)
@@ -119,7 +147,9 @@ int inet_aton _P((const char *cp, struct in_addr *ia));
#ifdef HAVE_SYS_SIGNAL_H
# include <sys/signal.h>
#endif
+#ifndef _WIN32
#include <sys/socket.h>
+#endif
#if defined(HAVE_SYS_IOCTL_H)
# include <sys/ioctl.h>
@@ -232,8 +262,9 @@ extern int do_echo;
inline void remque_32 _P((void *));
#endif
-#include <pwd.h>
+#ifndef _WIN32
#include <netdb.h>
+#endif
#define DEFAULT_BAUD 115200
@@ -292,4 +323,9 @@ struct tcpcb *tcp_drop(struct tcpcb *tp, int err);
#define MAX_MRU 16384
#endif
+#ifndef _WIN32
+#define min(x,y) ((x) < (y) ? (x) : (y))
+#define max(x,y) ((x) > (y) ? (x) : (y))
+#endif
+
#endif