diff options
author | Mattes D <github@xoft.cz> | 2014-04-30 17:05:13 +0200 |
---|---|---|
committer | Mattes D <github@xoft.cz> | 2014-04-30 17:05:13 +0200 |
commit | 014fab58e6eafce87a092aa859c5008dbdaa5c7b (patch) | |
tree | ac4ea8515e0461483714e18cef7bbb961f0fbec3 /src/PolarSSL++/BufferedSslContext.h | |
parent | Delayed sending the KeepAlive packet for 3 seconds after login. (diff) | |
parent | Removed unneeded #includes. (diff) | |
download | cuberite-014fab58e6eafce87a092aa859c5008dbdaa5c7b.tar cuberite-014fab58e6eafce87a092aa859c5008dbdaa5c7b.tar.gz cuberite-014fab58e6eafce87a092aa859c5008dbdaa5c7b.tar.bz2 cuberite-014fab58e6eafce87a092aa859c5008dbdaa5c7b.tar.lz cuberite-014fab58e6eafce87a092aa859c5008dbdaa5c7b.tar.xz cuberite-014fab58e6eafce87a092aa859c5008dbdaa5c7b.tar.zst cuberite-014fab58e6eafce87a092aa859c5008dbdaa5c7b.zip |
Diffstat (limited to '')
-rw-r--r-- | src/PolarSSL++/BufferedSslContext.h | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/src/PolarSSL++/BufferedSslContext.h b/src/PolarSSL++/BufferedSslContext.h new file mode 100644 index 000000000..1b7e1af46 --- /dev/null +++ b/src/PolarSSL++/BufferedSslContext.h @@ -0,0 +1,52 @@ + +// BufferedSslContext.h + +// Declares the cBufferedSslContext class representing a SSL context with the SSL peer data backed by a cByteBuffer + + + + + +#pragma once + +#include "SslContext.h" + + + + + +class cBufferedSslContext : + public cSslContext +{ + typedef cSslContext super; + +public: + /** Creates a new context with the buffers of specified size for the encrypted / decrypted data. */ + cBufferedSslContext(size_t a_BufferSize = 64000); + + /** Stores the specified data in the "incoming" buffer, to be process by the SSL decryptor. + This is the data received from the SSL peer. + Returns the number of bytes actually stored. If 0 is returned, owner should check the error state. */ + size_t WriteIncoming(const void * a_Data, size_t a_NumBytes); + + /** Retrieves data from the "outgoing" buffer, after being processed by the SSL encryptor. + This is the data to be sent to the SSL peer. + Returns the number of bytes actually retrieved. */ + size_t ReadOutgoing(void * a_Data, size_t a_DataMaxSize); + +protected: + /** Buffer for the data that has been encrypted into the SSL stream and should be sent out. */ + cByteBuffer m_OutgoingData; + + /** Buffer for the data that has come in and needs to be decrypted from the SSL stream. */ + cByteBuffer m_IncomingData; + + + // cSslContext overrides: + virtual int ReceiveEncrypted(unsigned char * a_Buffer, size_t a_NumBytes) override; + virtual int SendEncrypted(const unsigned char * a_Buffer, size_t a_NumBytes) override; +} ; + + + + |