Annotation of parser3/src/main/pa_socks.C, revision 1.7
1.3 paf 1: /** @file
1.1 paf 2: Parser: socks initialization/finalization.
3:
4: Copyright (c) 2001 ArtLebedev Group (http://www.artlebedev.com)
1.6 parser 5: Author: Alexander Petrosyan <paf@design.ru> (http://design.ru/paf)
1.1 paf 6:
1.7 ! parser 7: $Id: pa_socks.C,v 1.6 2001/09/26 10:32:26 parser Exp $
1.1 paf 8: */
1.2 paf 9:
10: #define NO_UNISTD_H
11: #include "pa_config_includes.h"
1.1 paf 12:
13: #ifdef WIN32
14: #include <winsock.h>
15: #else
16: //#include <netinet/tcp.h>
17: //#include <arpa/nameser.h>
18: //#include <netdb.h>
19: //#include <signal.h>
20: #endif
21:
22: #include "pa_socks.h"
23: #include "pa_exception.h"
24:
25:
26: /* ************************ Common stuff *********************** */
27:
28: #ifdef WIN32
29:
30: WSADATA wsaData;
31:
32: void init_socks(Pool& pool) {
33: WORD wVersionRequested;
34: int err;
35: wVersionRequested = MAKEWORD( 1, 1 );
36: //wVersionRequested = MAKEWORD( 2, 2 );
37: err = WSAStartup( wVersionRequested, &wsaData );
38: if ( err != 0 ) {
39: /* Tell the user that we could not find a usable */
40: /* WinSock DLL. */
1.7 ! parser 41: throw Exception(0, 0,
1.1 paf 42: 0,
43: "can not WSAStartup, err=%d",
44: err);
45: }
46: }
47:
48: void done_socks() {
49: /* Confirm that the WinSock DLL supports 2.2.*/
50: /* Note that if the DLL supports versions greater */
51: /* than 2.2 in addition to 2.2, it will still return */
52: /* 2.2 in wVersion since that is the version we */
53: /* requested. */
54: if ( LOBYTE( wsaData.wVersion ) == 2 ||
55: HIBYTE( wsaData.wVersion ) == 2 ) {
56: WSACleanup( );
57: return;
58: }
59: }
60:
61: #else
62:
63: void init_socks(Pool& pool) {}
64: void done_socks() {}
65:
66: #endif
E-mail: