Annotation of parser3/src/main/pa_socks.C, revision 1.1

1.1     ! paf         1: /*
        !             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: 
        !             8:        $Id: pa_pool.C,v 1.5 2001/03/23 19:25:17 paf Exp $
        !             9: */
        !            10: 
        !            11: #ifdef WIN32
        !            12: #include <winsock.h>
        !            13: #else
        !            14: //#include <netinet/tcp.h>
        !            15: //#include <arpa/nameser.h>
        !            16: //#include <netdb.h>
        !            17: //#include <signal.h>
        !            18: #endif
        !            19: 
        !            20: #include "pa_socks.h"
        !            21: #include "pa_exception.h"
        !            22: 
        !            23: 
        !            24: /* ************************ Common stuff *********************** */
        !            25: 
        !            26: #ifdef WIN32
        !            27: 
        !            28: WSADATA wsaData;
        !            29: 
        !            30: void init_socks(Pool& pool) {
        !            31:        WORD wVersionRequested;
        !            32:        int err; 
        !            33:        wVersionRequested = MAKEWORD( 1, 1 ); 
        !            34:        //wVersionRequested = MAKEWORD( 2, 2 ); 
        !            35:        err = WSAStartup( wVersionRequested, &wsaData );
        !            36:        if ( err != 0 ) {
        !            37:            /* Tell the user that we could not find a usable */
        !            38:                /* WinSock DLL.                                  */    
        !            39:                PTHROW(0, 0,
        !            40:                        0,
        !            41:                        "can not WSAStartup, err=%d", 
        !            42:                                err);
        !            43:        } 
        !            44: }
        !            45: 
        !            46: void done_socks() {
        !            47:        /* Confirm that the WinSock DLL supports 2.2.*/
        !            48:        /* Note that if the DLL supports versions greater    */
        !            49:        /* than 2.2 in addition to 2.2, it will still return */
        !            50:        /* 2.2 in wVersion since that is the version we      */
        !            51:        /* requested.                                        */ 
        !            52:        if ( LOBYTE( wsaData.wVersion ) == 2 ||
        !            53:         HIBYTE( wsaData.wVersion ) == 2 ) {
        !            54:                WSACleanup( );
        !            55:                return; 
        !            56:        } 
        !            57: }
        !            58: 
        !            59: #else
        !            60: 
        !            61: void init_socks(Pool& pool) {}
        !            62: void done_socks() {}
        !            63: 
        !            64: #endif

E-mail: