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

1.3       paf         1: /**    @file
1.1       paf         2:        Parser: socks initialization/finalization.
                      3: 
1.18      paf         4:        Copyright (c) 2001, 2003 ArtLebedev Group (http://www.artlebedev.com)
1.13      paf         5:        Author: Alexandr Petrosian <paf@design.ru> (http://paf.design.ru)
1.15      paf         6: */
1.1       paf         7: 
1.18.2.2! paf         8: static const char* IDENT_SOCKS_C="$Date: 2003/01/28 12:11:50 $";
1.2       paf         9: 
                     10: #define NO_UNISTD_H
                     11: #include "pa_config_includes.h"
1.1       paf        12: 
1.17      paf        13: #ifdef HAVE_WINSOCK_H
1.9       paf        14: #include "pa_exception.h"
                     15: #include "pa_socks.h"
1.18.2.2! paf        16: #include "pa_string.h"
1.11      paf        17: 
                     18: #include <winsock.h>
1.9       paf        19: 
1.1       paf        20: WSADATA wsaData;
                     21: 
1.18.2.1  paf        22: void pa_init_socks() {
1.1       paf        23:        WORD wVersionRequested;
                     24:        int err; 
                     25:        wVersionRequested = MAKEWORD( 1, 1 ); 
                     26:        //wVersionRequested = MAKEWORD( 2, 2 ); 
                     27:        err = WSAStartup( wVersionRequested, &wsaData );
                     28:        if ( err != 0 ) {
                     29:            /* Tell the user that we could not find a usable */
                     30:                /* WinSock DLL.                                  */    
1.14      paf        31:                throw Exception(0,
1.18.2.1  paf        32:                        Exception::undefined_source,
1.1       paf        33:                        "can not WSAStartup, err=%d", 
                     34:                                err);
                     35:        } 
                     36: }
                     37: 
1.18.2.1  paf        38: void pa_done_socks() {
1.1       paf        39:        /* Confirm that the WinSock DLL supports 2.2.*/
                     40:        /* Note that if the DLL supports versions greater    */
                     41:        /* than 2.2 in addition to 2.2, it will still return */
                     42:        /* 2.2 in wVersion since that is the version we      */
                     43:        /* requested.                                        */ 
                     44:        if ( LOBYTE( wsaData.wVersion ) == 2 ||
                     45:         HIBYTE( wsaData.wVersion ) == 2 ) {
                     46:                WSACleanup( );
                     47:                return; 
                     48:        } 
                     49: }
                     50: 
                     51: #else
1.10      paf        52: 
1.18.2.1  paf        53: void pa_init_socks() {}
                     54: void pa_done_socks() {}
1.1       paf        55: 
                     56: #endif

E-mail: