#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 <windows.h>
+# 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)
+# define O_BINARY 0
+#endif
+
#include <sys/types.h>
#ifdef HAVE_SYS_BITYPES_H
# include <sys/bitypes.h>
# include <strings.h>
#endif
+#ifndef _WIN32
#include <sys/uio.h>
+#endif
#ifndef _P
#ifndef NO_PROTOTYPES
#endif
#endif
+#ifndef _WIN32
#include <netinet/in.h>
#include <arpa/inet.h>
+#endif
#ifdef GETTIMEOFDAY_ONE_ARG
#define gettimeofday(x, y) gettimeofday(x)
#ifdef HAVE_SYS_SIGNAL_H
# include <sys/signal.h>
#endif
+#ifndef _WIN32
#include <sys/socket.h>
-
-#if defined(WANT_SYS_IOCTL_H) && defined(HAVE_SYS_IOCTL_H)
-# include <sys/ioctl.h>
-#else
-# define WANT_SYS_TERMIOS_H
#endif
-#ifdef WANT_SYS_TERMIOS_H
-# ifndef INCLUDED_TERMIOS_H
-# ifdef HAVE_TERMIOS_H
-# include <termios.h>
-# else
-# include <termio.h>
-# endif
-# define INCLUDED_TERMIOS_H
-# endif
+#if defined(HAVE_SYS_IOCTL_H)
+# include <sys/ioctl.h>
#endif
-
-
#ifdef HAVE_SYS_SELECT_H
# include <sys/select.h>
#endif
#endif
#include "bootp.h"
+#include "tftp.h"
#include "libslirp.h"
extern struct ttys *ttys_unit[MAX_INTERFACES];
inline void remque_32 _P((void *));
#endif
-#include <pwd.h>
+#ifndef _WIN32
#include <netdb.h>
+#endif
#define DEFAULT_BAUD 115200
#define MAX_MRU 16384
#endif
+#ifndef _WIN32
+#define min(x,y) ((x) < (y) ? (x) : (y))
+#define max(x,y) ((x) > (y) ? (x) : (y))
+#endif
+
+#ifdef _WIN32
+#undef errno
+#define errno (WSAGetLastError())
+#endif
+
#endif