From f6272dd9b8ae8d188068aeb0df2af496a964e407 Mon Sep 17 00:00:00 2001 From: Yang Tse Date: Fri, 5 Aug 2011 15:42:05 +0200 Subject: BSD-style lwIP TCP/IP stack support - followup --- include/curl/curl.h | 6 +----- lib/config-win32.h | 2 +- lib/connect.c | 2 +- lib/setup_once.h | 16 ++++++++++++++++ 4 files changed, 19 insertions(+), 7 deletions(-) diff --git a/include/curl/curl.h b/include/curl/curl.h index b4330a8be..c31918728 100644 --- a/include/curl/curl.h +++ b/include/curl/curl.h @@ -78,10 +78,6 @@ #include #endif -#if defined(__LWIP_OPT_H__) -#include -#endif - #if !defined(WIN32) && !defined(__WATCOMC__) && !defined(__VXWORKS__) #include #endif @@ -124,7 +120,7 @@ typedef void CURL; #ifndef curl_socket_typedef /* socket typedef */ -#ifdef WIN32 +#if defined(WIN32) && !defined(__LWIP_OPT_H__) typedef SOCKET curl_socket_t; #define CURL_SOCKET_BAD INVALID_SOCKET #else diff --git a/lib/config-win32.h b/lib/config-win32.h index 8c4719745..1179b1588 100644 --- a/lib/config-win32.h +++ b/lib/config-win32.h @@ -407,7 +407,7 @@ /* BSD-style lwIP TCP/IP stack SPECIFIC */ /* ---------------------------------------------------------------- */ -/* Define this to use BSD-style lwIP TCP/IP stack */ +/* Define this to use BSD-style lwIP TCP/IP stack */ /* #define USE_LWIPSOCK 1 */ #ifdef USE_LWIPSOCK diff --git a/lib/connect.c b/lib/connect.c index 1f802bda8..9301f0108 100644 --- a/lib/connect.c +++ b/lib/connect.c @@ -792,7 +792,7 @@ static void nosigpipe(struct connectdata *conn, #define nosigpipe(x,y) #endif -#ifdef WIN32 +#ifdef USE_WINSOCK /* When you run a program that uses the Windows Sockets API, you may experience slow performance when you copy data to a TCP server. diff --git a/lib/setup_once.h b/lib/setup_once.h index 751102bed..4f7d0d791 100644 --- a/lib/setup_once.h +++ b/lib/setup_once.h @@ -490,5 +490,21 @@ typedef int sig_atomic_t; #define ZERO_NULL 0 + +/* + * Ensure that Winsock and lwIP TCP/IP stacks are not mixed. + */ + +#if defined(__LWIP_OPT_H__) +# if defined(SOCKET) || \ + defined(USE_WINSOCK) || \ + defined(HAVE_ERRNO_H) || \ + defined(HAVE_WINSOCK_H) || \ + defined(HAVE_WINSOCK2_H) || \ + defined(HAVE_WS2TCPIP_H) +# error "Winsock and lwIP TCP/IP stack definitions shall not coexist!" +# endif +#endif + #endif /* __SETUP_ONCE_H */ -- cgit v1.2.3