Gray C++ Libraries  0.0.2
A set of C++ libraries for MSVC, GNU on Windows, WinCE, Linux
cSSLChannel.h
Go to the documentation of this file.
1 //
5 //
6 #ifndef _INC_cSSLChannel_H
7 #define _INC_cSSLChannel_H
8 #ifndef NO_PRAGMA_ONCE
9 #pragma once
10 #endif
11 
12 #include "cSSLMsg.h"
13 #include "cSSLSession.h"
14 #include "../Net/cProtocol.h"
15 #include "../Cipher/cCipherBase.h"
21 
22 namespace GrayLib
23 {
25 
26  //***************************************************
27  //** TODO
28 
30  {
33 
34  public:
40 
41  public:
42  cSSLChannel();
43  virtual ~cSSLChannel();
44 
45  void ChangeCipherSpec();
46 
48  };
49 
51  {
55  public:
57 
58  public:
59  CSSLClient(cStream* pStream);
60  virtual ~CSSLClient();
61 
62  HRESULT SendClientHello(int iVerBest, void* pRandomNumber, cArrayVal<SSL_CipherSuite_t>* pSupport, void* pSessionIdResume);
64  HRESULT SendClientKeyExchange(bool bCertificateVerify);
66 
72 
75  };
76 
78 
80  {
83 
84  public:
86 
87  protected:
88 
89  HRESULT OnHand_ClientHello(const BYTE* pHandshakeData, DWORD dwDataLength);
90 
91  HRESULT OnAlert(const cSSLMsgX& msg);
92  HRESULT OnChangeCipherSpec(const cSSLMsgX& msg);
93  HRESULT OnHandshake(const cSSLMsgX& msg);
94  HRESULT OnApplication(const cSSLMsgX& msg);
95 
96  virtual HRESULT ProcessStreamPacket() override;
97 
98  public:
99  cSSLServerStream(cSSLServerFactory* pFactory, IUnkObject* pServerConnection, cStreamInput* pStreamInp, cStreamOutput* pStreamOut);
100  virtual ~cSSLServerStream();
101 
103  };
104 
106 
108  {
111 
112  protected:
114 
115  public:
117  cSSLServerFactory(IProtocolFactory* pProtocol2);
118 
119  virtual const char* get_ProtocolName() const override
120  {
121  return "SSL";
122  }
123  virtual HRESULT TestProtocol(const BYTE* pszPrefixData, size_t iPrefixLen) const override;
124  virtual cProtocolStreamPtr CreateProtocolStream(IUnkObject* pServerConnection, cStreamInput* pStreamInp, cStreamOutput* pStreamOut) override
125  {
126  return new cSSLServerStream(this, pServerConnection, pStreamInp, pStreamOut);
127  }
128  };
129 }
130 #endif
#define GRAYLIB_LINK
Definition: GrayLibBase.h:35
INT32 HRESULT
_WIN32 style error codes. INT32
Definition: SysTypes.h:465
Definition: cSSLChannel.h:51
HRESULT SendClientKeyExchange(bool bCertificateVerify)
HRESULT OnServerHelloDone()
HRESULT OnChangeCipherSpec()
cStreamOutput * get_SSLOut() const
HRESULT OnServerHello()
cStream * m_pStream
the data stream to/from the cNetSocket
Definition: cSSLChannel.h:56
cStreamInput * get_SSLInp() const
HRESULT SendCertificate()
HRESULT OnCertificate()
HRESULT SendChangeCipherSpec()
Definition: cProtocol.h:147
Definition: cProtocol.h:24
Definition: cSSLChannel.h:30
cSSLMsgHandHello m_Hello
last set of hello params.
Definition: cSSLChannel.h:36
bool m_bFinished
Definition: cSSLChannel.h:35
cSSLSession m_Cur
the current active selected encryption of the channel.
Definition: cSSLChannel.h:38
cSSLSession m_Neg
the encryption we are negotiating. not active til Cont_ChangeCipherSpec.
Definition: cSSLChannel.h:37
UNITTEST2_PREDEF(cSSLChannel)
cNewPtr< cCipherBase > m_pCrypt
the current active encryption.
Definition: cSSLChannel.h:39
Definition: cSSLMsg.h:357
Definition: cSSLMsg.h:255
Definition: cSSLChannel.h:108
virtual cProtocolStreamPtr CreateProtocolStream(IUnkObject *pServerConnection, cStreamInput *pStreamInp, cStreamOutput *pStreamOut) override
Definition: cSSLChannel.h:124
virtual const char * get_ProtocolName() const override
Definition: cSSLChannel.h:119
cProtocolFactories m_Factories
What protocols are we wrapping?
Definition: cSSLChannel.h:113
Definition: cSSLChannel.h:80
cProtocolStreamPtr m_pProtocol2
The protocol wrapped by this cSSLServerStream.
Definition: cSSLChannel.h:85
Definition: cSSLSession.h:175
Definition: cNewPtr.h:18
Definition: cRefPtr.h:22
Definition: cStream.h:306
Definition: cStream.h:126
Definition: cStream.h:456
Definition: cMesh.h:22
cRefPtr< cSSLServerStream > cSSLServerStreamPtr
Definition: cSSLChannel.h:105
UNITTEST2_PREDEF(cQuadtree)
class __DECL_IMPORT cSSLServerFactory
Definition: cSSLChannel.h:77
Definition: cProtocol.h:125