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