1
0
mirror of https://github.com/MariaDB/server.git synced 2025-10-28 17:15:19 +03:00
Files
mariadb/extra/yassl/include/socket_wrapper.hpp
unknown b3d646e6f8 WL#2286 - Compile MySQL w/YASSL support
merge with latest yaSSL, move templates instantiation into separate file where it is possible


extra/yassl/include/buffer.hpp:
  merge with latest yaSSL
extra/yassl/include/crypto_wrapper.hpp:
  merge with latest yaSSL
extra/yassl/include/socket_wrapper.hpp:
  merge with latest yaSSL
extra/yassl/include/yassl_imp.hpp:
  merge with latest yaSSL
extra/yassl/include/yassl_types.hpp:
  merge with latest yaSSL
extra/yassl/mySTL/helpers.hpp:
  merge with latest yaSSL
extra/yassl/mySTL/list.hpp:
  merge with latest yaSSL
extra/yassl/mySTL/memory.hpp:
  merge with latest yaSSL
extra/yassl/mySTL/vector.hpp:
  merge with latest yaSSL
extra/yassl/src/Makefile.am:
  Include template_instnt.cpp into libyassl_a_SOURCES.
extra/yassl/src/buffer.cpp:
  merge with latest yaSSL
extra/yassl/src/cert_wrapper.cpp:
  merge with latest yaSSL
extra/yassl/src/crypto_wrapper.cpp:
  merge with latest yaSSL
extra/yassl/src/handshake.cpp:
  merge with latest yaSSL
extra/yassl/src/lock.cpp:
  merge with latest yaSSL
extra/yassl/src/log.cpp:
  merge with latest yaSSL
extra/yassl/src/socket_wrapper.cpp:
  merge with latest yaSSL
extra/yassl/src/ssl.cpp:
  merge with latest yaSSL
extra/yassl/src/timer.cpp:
  merge with latest yaSSL
extra/yassl/src/yassl_error.cpp:
  merge with latest yaSSL
extra/yassl/src/yassl_imp.cpp:
  merge with latest yaSSL
extra/yassl/src/yassl_int.cpp:
  merge with latest yaSSL
extra/yassl/taocrypt/include/algebra.hpp:
  merge with latest yaSSL
extra/yassl/taocrypt/include/asn.hpp:
  merge with latest yaSSL
extra/yassl/taocrypt/include/block.hpp:
  merge with latest yaSSL
extra/yassl/taocrypt/include/hash.hpp:
  merge with latest yaSSL
extra/yassl/taocrypt/include/integer.hpp:
  merge with latest yaSSL
extra/yassl/taocrypt/include/misc.hpp:
  merge with latest yaSSL
extra/yassl/taocrypt/include/modes.hpp:
  merge with latest yaSSL
extra/yassl/taocrypt/include/runtime.hpp:
  merge with latest yaSSL
extra/yassl/taocrypt/src/Makefile.am:
  Include template_instnt.cpp into libtaocrypt_a_SOURCES.
extra/yassl/taocrypt/src/aestables.cpp:
  merge with latest yaSSL
extra/yassl/taocrypt/src/algebra.cpp:
  merge with latest yaSSL
extra/yassl/taocrypt/src/arc4.cpp:
  merge with latest yaSSL
extra/yassl/taocrypt/src/asn.cpp:
  merge with latest yaSSL
extra/yassl/taocrypt/src/coding.cpp:
  merge with latest yaSSL
extra/yassl/taocrypt/src/dh.cpp:
  merge with latest yaSSL
extra/yassl/taocrypt/src/dsa.cpp:
  merge with latest yaSSL
extra/yassl/taocrypt/src/file.cpp:
  merge with latest yaSSL
extra/yassl/taocrypt/src/integer.cpp:
  merge with latest yaSSL
extra/yassl/taocrypt/src/misc.cpp:
  merge with latest yaSSL
extra/yassl/taocrypt/src/random.cpp:
  merge with latest yaSSL
extra/yassl/taocrypt/src/rsa.cpp:
  merge with latest yaSSL
2005-05-31 20:56:32 +05:00

96 lines
2.4 KiB
C++

/* socket_wrapper.hpp
*
* Copyright (C) 2003 Sawtooth Consulting Ltd.
*
* This file is part of yaSSL.
*
* yaSSL is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* yaSSL is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
/* The socket wrapper header defines a Socket class that hides the differences
* between Berkely style sockets and Windows sockets, allowing transparent TCP
* access.
*/
#ifndef yaSSL_SOCKET_WRAPPER_HPP
#define yaSSL_SOCKET_WRAPPER_HPP
#include <assert.h>
#ifdef WIN32
#include <winsock2.h>
#else
#include <sys/time.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <unistd.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#endif
namespace yaSSL {
typedef unsigned int uint;
#ifdef WIN32
typedef SOCKET socket_t;
#else
typedef int socket_t;
const socket_t INVALID_SOCKET = -1;
const int SD_RECEIVE = 0;
const int SD_SEND = 1;
const int SD_BOTH = 2;
const int SOCKET_ERROR = -1;
#endif
typedef unsigned char byte;
// Wraps Windows Sockets and BSD Sockets
class Socket {
socket_t socket_; // underlying socket descriptor
public:
explicit Socket(socket_t s = INVALID_SOCKET);
~Socket();
void set_fd(socket_t s);
uint get_ready() const;
socket_t get_fd() const;
uint send(const byte* buf, unsigned int len, int flags = 0) const;
uint receive(byte* buf, unsigned int len, int flags = 0) const;
void wait() const;
void closeSocket();
void shutDown(int how = SD_SEND);
static int get_lastError();
static void set_lastError(int error);
private:
Socket(const Socket&); // hide copy
Socket& operator= (const Socket&); // and assign
};
} // naemspace
#endif // yaSSL_SOCKET_WRAPPER_HPP