about summary refs log tree commit diff stats
path: root/WWW/Library/Implementation/www_tcp.h
diff options
context:
space:
mode:
authorThomas E. Dickey <dickey@invisible-island.net>2000-09-22 02:33:30 -0400
committerThomas E. Dickey <dickey@invisible-island.net>2000-09-22 02:33:30 -0400
commitcdccafb64b871f95ed58d79aa83bb438140f5e57 (patch)
tree6de7d063f2140c9fb4066445f0d01c1a42727165 /WWW/Library/Implementation/www_tcp.h
parent703882dc69524a895907880c45cfa74ca8e761e4 (diff)
downloadlynx-snapshots-cdccafb64b871f95ed58d79aa83bb438140f5e57.tar.gz
snapshot of project "lynx", label v2-8-4dev_10
Diffstat (limited to 'WWW/Library/Implementation/www_tcp.h')
-rw-r--r--WWW/Library/Implementation/www_tcp.h71
1 files changed, 46 insertions, 25 deletions
diff --git a/WWW/Library/Implementation/www_tcp.h b/WWW/Library/Implementation/www_tcp.h
index d0ed557f..e808919b 100644
--- a/WWW/Library/Implementation/www_tcp.h
+++ b/WWW/Library/Implementation/www_tcp.h
@@ -56,29 +56,6 @@ Default values
 #define INVSOC (-1)             /* Unix invalid socket */
 		/* NB: newer libwww has something different for Windows */
 
-/* IPv6 support */
-#if defined(HAVE_GETADDRINFO) && defined(HAVE_GAI_STRERROR) && defined(ENABLE_IPV6)
-#	define INET6
-#endif /* HAVE_GETADDRINFO && HAVE_GAI_STRERROR && ENABLE_IPV6 */
-
-#if !defined(__MINGW32__)
-#ifdef INET6
-typedef struct sockaddr_storage SockA;  /* See netinet/in.h */
-#else
-typedef struct sockaddr_in SockA;  /* See netinet/in.h */
-#endif /* INET6 */
-#endif
-
-#ifdef INET6
-#ifdef SIN6_LEN
-#define SOCKADDR_LEN(soc_address) ((struct sockaddr *)&soc_address)->sa_len
-#else
-#define SOCKADDR_LEN(soc_address) SA_LEN((struct sockaddr *)&soc_address)
-#endif /* SIN6_LEN */
-#else
-#define SOCKADDR_LEN(soc_address) sizeof(soc_address)
-#endif /* INET6 */
-
 #ifndef VMS
 
 #include <sys/types.h>
@@ -208,9 +185,29 @@ extern int ws_netread(int fd, char *buf, int len);
 #include <direct.h>
 
 /* FIXME: someone might consider porting to winsock2.h */
-#define USE_WINSOCK_H
+#ifdef USE_WINSOCK2_H
+#include <winsock.h>
+
+#undef EINPROGRESS
+#undef EALREADY
+#undef EISCONN
+#undef EINTR
+#undef EAGAIN
+#undef ENOTCONN
+#undef ECONNRESET
+#undef ETIMEDOUT
+
+#define EINPROGRESS  WSAEINPROGRESS
+#define EALREADY     WSAEALREADY
+#define EISCONN      WSAEISCONN
+#define EINTR        WSAEINTR
+/* fine EAGAIN       WSAEAGAIN */
+#define ENOTCONN     WSAENOTCONN
+#define ECONNRESET   WSAECONNRESET
+#define ETIMEDOUT    WSAETIMEDOUT
+
+#else /* USE_WINSOCK_H */
 
-#ifdef USE_WINSOCK_H
 #include <winsock.h>
 typedef struct sockaddr_in SockA;  /* See netinet/in.h */
 
@@ -230,6 +227,7 @@ typedef struct sockaddr_in SockA;  /* See netinet/in.h */
 
 #undef  SOCKET_ERRNO	/* 1997/10/19 (Sun) 18:01:46 */
 #define SOCKET_ERRNO          WSAGetLastError()
+
 #endif	/* USE_WINSOCK_H */
 
 #define INCLUDES_DONE
@@ -804,4 +802,27 @@ typedef unsigned int fd_set;
 #define set_errno(value) /* we do not know how */
 #endif
 
+/* IPv6 support */
+#if defined(HAVE_GETADDRINFO) && defined(HAVE_GAI_STRERROR) && defined(ENABLE_IPV6)
+#	define INET6
+#endif /* HAVE_GETADDRINFO && HAVE_GAI_STRERROR && ENABLE_IPV6 */
+
+#if !defined(__MINGW32__)
+#ifdef INET6
+typedef struct sockaddr_storage SockA;  /* See netinet/in.h */
+#else
+typedef struct sockaddr_in SockA;  /* See netinet/in.h */
+#endif /* INET6 */
+#endif
+
+#ifdef INET6
+#ifdef SIN6_LEN
+#define SOCKADDR_LEN(soc_address) ((struct sockaddr *)&soc_address)->sa_len
+#else
+#define SOCKADDR_LEN(soc_address) SA_LEN((struct sockaddr *)&soc_address)
+#endif /* SIN6_LEN */
+#else
+#define SOCKADDR_LEN(soc_address) sizeof(soc_address)
+#endif /* INET6 */
+
 #endif /* TCP_H */