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

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

E-mail: