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

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.8       paf         5:        Author: Alexander Petrosyan <paf@design.ru> (http://paf.design.ru)
1.1       paf         6: 
1.9     ! paf         7:        $Id: pa_socks.C,v 1.8 2001/11/05 11:46:28 paf Exp $
1.1       paf         8: */
1.2       paf         9: 
                     10: #define NO_UNISTD_H
                     11: #include "pa_config_includes.h"
1.1       paf        12: 
1.9     ! paf        13: #include "pa_exception.h"
        !            14: #include "pa_socks.h"
        !            15: 
1.1       paf        16: #ifdef WIN32
                     17: #include <winsock.h>
                     18: #else
                     19: //#include <netinet/tcp.h>
                     20: //#include <arpa/nameser.h>
                     21: //#include <netdb.h>
                     22: //#include <signal.h>
                     23: #endif
                     24: 
                     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.                                  */    
1.7       parser     42:                throw Exception(0, 0,
1.1       paf        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: