1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
|
// --------------------------------------------------------------------------
//
// File
// Name: SocketStreamTLS.h
// Purpose: Socket stream encrpyted and authenticated by TLS
// Created: 2003/08/06
//
// --------------------------------------------------------------------------
#ifndef SOCKETSTREAMTLS__H
#define SOCKETSTREAMTLS__H
#include <string>
#include "SocketStream.h"
class TLSContext;
#ifndef TLS_CLASS_IMPLEMENTATION_CPP
class SSL;
class BIO;
#endif
// --------------------------------------------------------------------------
//
// Class
// Name: SocketStreamTLS
// Purpose: Socket stream encrpyted and authenticated by TLS
// Created: 2003/08/06
//
// --------------------------------------------------------------------------
class SocketStreamTLS : public SocketStream
{
public:
SocketStreamTLS();
SocketStreamTLS(int socket);
~SocketStreamTLS();
private:
SocketStreamTLS(const SocketStreamTLS &rToCopy);
public:
void Open(const TLSContext &rContext, Socket::Type Type,
const std::string& rName, int Port = 0);
void Handshake(const TLSContext &rContext, bool IsServer = false);
virtual int Read(void *pBuffer, int NBytes, int Timeout = IOStream::TimeOutInfinite);
virtual void Write(const void *pBuffer, int NBytes,
int Timeout = IOStream::TimeOutInfinite);
virtual void Close();
virtual void Shutdown(bool Read = true, bool Write = true);
std::string GetPeerCommonName();
private:
bool WaitWhenRetryRequired(int SSLErrorCode, int Timeout);
private:
SSL *mpSSL;
BIO *mpBIO;
};
#endif // SOCKETSTREAMTLS__H
|