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

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.1! paf         8: static const char* IDENT_SOCKS_C="$Date: 2003/01/21 15:51:15 $";
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.11      paf        16: 
                     17: #include <winsock.h>
1.9       paf        18: 
1.1       paf        19: WSADATA wsaData;
                     20: 
1.18.2.1! paf        21: void pa_init_socks() {
1.1       paf        22:        WORD wVersionRequested;
                     23:        int err; 
                     24:        wVersionRequested = MAKEWORD( 1, 1 ); 
                     25:        //wVersionRequested = MAKEWORD( 2, 2 ); 
                     26:        err = WSAStartup( wVersionRequested, &wsaData );
                     27:        if ( err != 0 ) {
                     28:            /* Tell the user that we could not find a usable */
                     29:                /* WinSock DLL.                                  */    
1.14      paf        30:                throw Exception(0,
1.18.2.1! paf        31:                        Exception::undefined_source,
1.1       paf        32:                        "can not WSAStartup, err=%d", 
                     33:                                err);
                     34:        } 
                     35: }
                     36: 
1.18.2.1! paf        37: void pa_done_socks() {
1.1       paf        38:        /* Confirm that the WinSock DLL supports 2.2.*/
                     39:        /* Note that if the DLL supports versions greater    */
                     40:        /* than 2.2 in addition to 2.2, it will still return */
                     41:        /* 2.2 in wVersion since that is the version we      */
                     42:        /* requested.                                        */ 
                     43:        if ( LOBYTE( wsaData.wVersion ) == 2 ||
                     44:         HIBYTE( wsaData.wVersion ) == 2 ) {
                     45:                WSACleanup( );
                     46:                return; 
                     47:        } 
                     48: }
                     49: 
                     50: #else
1.10      paf        51: 
1.18.2.1! paf        52: void pa_init_socks() {}
        !            53: void pa_done_socks() {}
1.1       paf        54: 
                     55: #endif

E-mail: