2005-11-29 13:12:45 +00:00
# ifdef _WIN32
2005-11-30 01:20:53 +00:00
# ifdef _MSC_VER
# define USEIPX
# endif
# include "winquake.h"
# ifdef USEIPX
# include "wsipx.h"
# endif
2010-11-10 02:02:56 +00:00
# include <ws2tcpip.h>
2010-12-18 21:30:16 +00:00
# include <errno.h>
2010-11-10 02:02:56 +00:00
# ifndef IPPROTO_IPV6
/*for msvc6*/
2008-05-25 01:11:20 +00:00
# define IPPROTO_IPV6
2010-11-11 09:06:36 +00:00
# ifndef EAI_NONAME
# define EAI_NONAME 8
# endif
2008-05-25 01:11:20 +00:00
struct ip6_scope_id
{
union
{
struct
{
u_long Zone : 28 ;
u_long Level : 4 ;
} ;
u_long Value ;
} ;
} ;
2010-11-11 09:06:36 +00:00
# if !(_MSC_VER >= 1500)
2008-05-25 01:11:20 +00:00
struct in6_addr
{
u_char s6_addr [ 16 ] ; /* IPv6 address */
} ;
2011-01-04 02:56:16 +00:00
# define sockaddr_in6 sockaddr_in6_fixed /*earlier versions of msvc have a sockaddr_in6 which does _not_ match windows, so this *must* be redefined for any non-final msvc releases or it won't work at all*/
2008-05-25 01:11:20 +00:00
typedef struct sockaddr_in6
{
short sin6_family ;
u_short sin6_port ;
u_long sin6_flowinfo ;
struct in6_addr sin6_addr ;
union
{
u_long sin6_scope_id ;
struct ip6_scope_id sin6_scope_struct ;
} ;
} ;
struct addrinfo
{
int ai_flags ;
int ai_family ;
int ai_socktype ;
int ai_protocol ;
size_t ai_addrlen ;
char * ai_canonname ;
struct sockaddr * ai_addr ;
struct addrinfo * ai_next ;
} ;
2010-11-11 09:06:36 +00:00
# endif
2005-11-30 01:20:53 +00:00
# endif
2008-05-25 01:11:20 +00:00
2010-12-18 21:30:16 +00:00
# if (_MSC_VER >= 1600)
# undef EADDRNOTAVAIL
# undef EAFNOSUPPORT
# undef ECONNABORTED
# undef ECONNREFUSED
# undef ECONNRESET
# undef EMSGSIZE
# undef EWOULDBLOCK
# endif
# define EWOULDBLOCK WSAEWOULDBLOCK
# define EMSGSIZE WSAEMSGSIZE
# define ECONNRESET WSAECONNRESET
# define ECONNABORTED WSAECONNABORTED
# define ECONNREFUSED WSAECONNREFUSED
# define EADDRNOTAVAIL WSAEADDRNOTAVAIL
# define EAFNOSUPPORT WSAEAFNOSUPPORT
2005-11-29 13:12:45 +00:00
# else
2005-11-30 01:20:53 +00:00
# include <sys/types.h>
# include <sys/socket.h>
# include <netinet/in.h>
2005-12-02 01:14:20 +00:00
# include <netinet/tcp.h>
2005-11-30 01:20:53 +00:00
# include <netdb.h>
# include <sys/ioctl.h>
# include <sys/uio.h>
# include <arpa/inet.h>
# include <errno.h>
2005-11-29 13:12:45 +00:00
2005-11-30 01:20:53 +00:00
# include <unistd.h>
2005-11-29 13:12:45 +00:00
2005-11-30 01:20:53 +00:00
# ifdef sun
# include <sys/filio.h>
# endif
# ifdef NeXT
# include <libc.h>
# endif
# if defined(__MORPHOS__) && !defined(ixemul)
# define closesocket CloseSocket
# define ioctlsocket IoctlSocket
# else
# define closesocket close
# define ioctlsocket ioctl
# endif
2005-11-29 13:12:45 +00:00
2010-03-19 03:45:11 +00:00
# define SOCKET int
2005-11-29 13:12:45 +00:00
# endif
# if defined(_WIN32)
2005-11-30 01:20:53 +00:00
# define qerrno WSAGetLastError()
2005-11-29 13:12:45 +00:00
# elif defined(__MORPHOS__) && !defined(ixemul)
2005-11-30 01:20:53 +00:00
# define qerrno Errno()
2005-11-29 13:12:45 +00:00
# else
2005-11-30 01:20:53 +00:00
# define qerrno errno
2005-11-29 13:12:45 +00:00
# endif
# ifndef INVALID_SOCKET
2005-11-30 01:20:53 +00:00
# define INVALID_SOCKET -1
2005-11-29 13:12:45 +00:00
# endif
2005-12-31 13:33:10 +00:00
# ifndef INADDR_LOOPBACK
# define INADDR_LOOPBACK 0x7f000001
# endif