summaryrefslogtreecommitdiffstats
path: root/src/PolarSSL++
diff options
context:
space:
mode:
authormadmaxoft <github@xoft.cz>2014-05-01 00:27:42 +0200
committermadmaxoft <github@xoft.cz>2014-05-01 00:27:42 +0200
commite6786074d58d81a230a6d5d01a5d89fa2f5ab16e (patch)
tree893f061d29bb5afe42a1a9554724ef4359353a99 /src/PolarSSL++
parentIf webadmin.ini doesn't exist, example one is written immediately. (diff)
downloadcuberite-e6786074d58d81a230a6d5d01a5d89fa2f5ab16e.tar
cuberite-e6786074d58d81a230a6d5d01a5d89fa2f5ab16e.tar.gz
cuberite-e6786074d58d81a230a6d5d01a5d89fa2f5ab16e.tar.bz2
cuberite-e6786074d58d81a230a6d5d01a5d89fa2f5ab16e.tar.lz
cuberite-e6786074d58d81a230a6d5d01a5d89fa2f5ab16e.tar.xz
cuberite-e6786074d58d81a230a6d5d01a5d89fa2f5ab16e.tar.zst
cuberite-e6786074d58d81a230a6d5d01a5d89fa2f5ab16e.zip
Diffstat (limited to 'src/PolarSSL++')
-rw-r--r--src/PolarSSL++/BufferedSslContext.cpp31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/PolarSSL++/BufferedSslContext.cpp b/src/PolarSSL++/BufferedSslContext.cpp
index 885b30c68..2455d5781 100644
--- a/src/PolarSSL++/BufferedSslContext.cpp
+++ b/src/PolarSSL++/BufferedSslContext.cpp
@@ -20,6 +20,37 @@ cBufferedSslContext::cBufferedSslContext(size_t a_BufferSize):
+size_t cBufferedSslContext::WriteIncoming(const void * a_Data, size_t a_NumBytes)
+{
+ size_t NumBytes = std::min(m_IncomingData.GetFreeSpace(), a_NumBytes);
+ if (NumBytes > 0)
+ {
+ m_IncomingData.Write(a_Data, NumBytes);
+ return a_NumBytes - NumBytes;
+ }
+ return 0;
+}
+
+
+
+
+
+size_t cBufferedSslContext::ReadOutgoing(void * a_Data, size_t a_DataMaxSize)
+{
+ size_t NumBytes = std::min(m_OutgoingData.GetReadableSpace(), a_DataMaxSize);
+ if (NumBytes > 0)
+ {
+ m_OutgoingData.ReadBuf(a_Data, NumBytes);
+ m_OutgoingData.CommitRead();
+ return a_DataMaxSize - NumBytes;
+ }
+ return 0;
+}
+
+
+
+
+
int cBufferedSslContext::ReceiveEncrypted(unsigned char * a_Buffer, size_t a_NumBytes)
{
// Called when PolarSSL wants to read encrypted data from the SSL peer