--- parser3/src/main/pa_socks.C 2001/06/28 07:41:59 1.4 +++ parser3/src/main/pa_socks.C 2004/04/01 11:43:54 1.22 @@ -1,37 +1,46 @@ /** @file Parser: socks initialization/finalization. - Copyright (c) 2001 ArtLebedev Group (http://www.artlebedev.com) - - Author: Alexander Petrosyan (http://design.ru/paf) - - $Id: pa_socks.C,v 1.4 2001/06/28 07:41:59 parser Exp $ + Copyright (c) 2001-2004 ArtLebedev Group (http://www.artlebedev.com) + Author: Alexandr Petrosian (http://paf.design.ru) */ -static char *RCSId="$Id: pa_socks.C,v 1.4 2001/06/28 07:41:59 parser Exp $"; + +static const char * const IDENT_SOCKS_C="$Date: 2004/04/01 11:43:54 $"; #define NO_UNISTD_H #include "pa_config_includes.h" #ifdef WIN32 -#include -#else -//#include -//#include -//#include -//#include -#endif - -#include "pa_socks.h" #include "pa_exception.h" +#include "pa_socks.h" +#include "pa_string.h" +// in cygwin: for pascal +// in MSVC: for everything +#include + +#ifdef CYGWIN +// WSADATA +#define WSADESCRIPTION_LEN 256 +#define WSASYS_STATUS_LEN 128 +typedef struct WSAData { + WORD wVersion; + WORD wHighVersion; + char szDescription[WSADESCRIPTION_LEN+1]; + char szSystemStatus[WSASYS_STATUS_LEN+1]; + unsigned short iMaxSockets; + unsigned short iMaxUdpDg; + char * lpVendorInfo; +} WSADATA; +typedef WSADATA *LPWSADATA; -/* ************************ Common stuff *********************** */ - -#ifdef WIN32 +int PASCAL WSAStartup(WORD,LPWSADATA); +int PASCAL WSACleanup(void); +#endif WSADATA wsaData; -void init_socks(Pool& pool) { +void pa_socks_init() { WORD wVersionRequested; int err; wVersionRequested = MAKEWORD( 1, 1 ); @@ -40,14 +49,14 @@ void init_socks(Pool& pool) { if ( err != 0 ) { /* Tell the user that we could not find a usable */ /* WinSock DLL. */ - PTHROW(0, 0, + throw Exception(0, 0, "can not WSAStartup, err=%d", err); } } -void done_socks() { +void pa_socks_done() { /* Confirm that the WinSock DLL supports 2.2.*/ /* Note that if the DLL supports versions greater */ /* than 2.2 in addition to 2.2, it will still return */ @@ -62,7 +71,7 @@ void done_socks() { #else -void init_socks(Pool& pool) {} -void done_socks() {} +void pa_socks_init() {} +void pa_socks_done() {} #endif