source: box/trunk/lib/server/SocketStreamTLS.h @ 2429

Revision 2429, 1.5 KB checked in by chris, 3 years ago (diff)

Change socket type from int to Socket::Type enum.

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