Cuberite
A lightweight, fast and extensible game server for Minecraft
BufferedSslContext.h
Go to the documentation of this file.
1 
2 // BufferedSslContext.h
3 
4 // Declares the cBufferedSslContext class representing a SSL context with the SSL peer data backed by a cByteBuffer
5 
6 
7 
8 
9 
10 #pragma once
11 
12 #include "SslContext.h"
13 #include "ErrorCodes.h"
14 
15 
16 
17 
18 
20  public cSslContext
21 {
22  using Super = cSslContext;
23 
24 public:
25 
27  cBufferedSslContext(size_t a_BufferSize = 64000);
28 
32  size_t WriteIncoming(const void * a_Data, size_t a_NumBytes);
33 
37  size_t ReadOutgoing(void * a_Data, size_t a_DataMaxSize);
38 
39 protected:
42 
45 
46 
47  // cSslContext overrides:
48  virtual int ReceiveEncrypted(unsigned char * a_Buffer, size_t a_NumBytes) override;
49  virtual int SendEncrypted(const unsigned char * a_Buffer, size_t a_NumBytes) override;
50 } ;
51 
52 
53 
54 
An object that can store incoming bytes and lets its clients read the bytes sequentially The bytes ar...
Definition: ByteBuffer.h:32
cByteBuffer m_IncomingData
Buffer for the data that has come in and needs to be decrypted from the SSL stream.
size_t WriteIncoming(const void *a_Data, size_t a_NumBytes)
Stores the specified data in the "incoming" buffer, to be process by the SSL decryptor.
virtual int SendEncrypted(const unsigned char *a_Buffer, size_t a_NumBytes) override
cBufferedSslContext(size_t a_BufferSize=64000)
Creates a new context with the buffers of specified size for the encrypted / decrypted data.
virtual int ReceiveEncrypted(unsigned char *a_Buffer, size_t a_NumBytes) override
cByteBuffer m_OutgoingData
Buffer for the data that has been encrypted into the SSL stream and should be sent out.
size_t ReadOutgoing(void *a_Data, size_t a_DataMaxSize)
Retrieves data from the "outgoing" buffer, after being processed by the SSL encryptor.