Cuberite
A lightweight, fast and extensible game server for Minecraft
Public Member Functions | Private Attributes | List of all members
cTCPLinkImpl::cLinkTlsContext Class Reference

Wrapper around cSslContext that is used when this link is being encrypted by SSL. More...

#include <TCPLinkImpl.h>

Inheritance diagram for cTCPLinkImpl::cLinkTlsContext:
Inheritance graph
[legend]
Collaboration diagram for cTCPLinkImpl::cLinkTlsContext:
Collaboration graph
[legend]

Public Member Functions

 cLinkTlsContext (cTCPLinkImpl &a_Link)
 
void FlushBuffers (void)
 Tries to read any cleartext data available through the SSL, reports it in the link. More...
 
bool IsLink (cTCPLinkImpl *a_Link)
 Returns true if the context's associated TCP link is the same link as a_Link. More...
 
virtual int ReceiveEncrypted (unsigned char *a_Buffer, size_t a_NumBytes) override
 
void ResetSelf (void)
 Removes the self ownership so that we can detect the SSL closure. More...
 
void Send (const void *a_Data, size_t a_Length)
 Sends the specified cleartext data over the SSL to the remote peer. More...
 
virtual int SendEncrypted (const unsigned char *a_Buffer, size_t a_NumBytes) override
 
void SetSelf (cLinkTlsContextWPtr a_Self)
 Shares ownership of self, so that this object can keep itself alive for as long as it needs. More...
 
void StoreReceivedData (const char *a_Data, size_t a_NumBytes)
 Stores the specified block of data into the buffer of the data to be decrypted (incoming from remote). More...
 
void TryFinishHandshaking (void)
 Tries to finish handshaking the SSL. More...
 

Private Attributes

AString m_CleartextData
 Buffer for storing the outgoing cleartext data until the link has finished handshaking. More...
 
AString m_EncryptedData
 Buffer for storing the incoming encrypted data until it is requested by the SSL decryptor. More...
 
cTCPLinkImplm_Link
 
cLinkTlsContextWPtr m_Self
 Shared ownership of self, so that this object can keep itself alive for as long as it needs. More...
 

Detailed Description

Wrapper around cSslContext that is used when this link is being encrypted by SSL.

Definition at line 95 of file TCPLinkImpl.h.

Constructor & Destructor Documentation

◆ cLinkTlsContext()

cTCPLinkImpl::cLinkTlsContext::cLinkTlsContext ( cTCPLinkImpl a_Link)

Definition at line 566 of file TCPLinkImpl.cpp.

Member Function Documentation

◆ FlushBuffers()

void cTCPLinkImpl::cLinkTlsContext::FlushBuffers ( void  )

Tries to read any cleartext data available through the SSL, reports it in the link.

Definition at line 611 of file TCPLinkImpl.cpp.

◆ IsLink()

bool cTCPLinkImpl::cLinkTlsContext::IsLink ( cTCPLinkImpl a_Link)
inline

Returns true if the context's associated TCP link is the same link as a_Link.

Definition at line 137 of file TCPLinkImpl.h.

◆ ReceiveEncrypted()

int cTCPLinkImpl::cLinkTlsContext::ReceiveEncrypted ( unsigned char *  a_Buffer,
size_t  a_NumBytes 
)
overridevirtual

Definition at line 684 of file TCPLinkImpl.cpp.

◆ ResetSelf()

void cTCPLinkImpl::cLinkTlsContext::ResetSelf ( void  )

Removes the self ownership so that we can detect the SSL closure.

Definition at line 584 of file TCPLinkImpl.cpp.

◆ Send()

void cTCPLinkImpl::cLinkTlsContext::Send ( const void *  a_Data,
size_t  a_Length 
)

Sends the specified cleartext data over the SSL to the remote peer.

If the handshake hasn't been completed yet, queues the data for sending when it completes.

Definition at line 662 of file TCPLinkImpl.cpp.

◆ SendEncrypted()

int cTCPLinkImpl::cLinkTlsContext::SendEncrypted ( const unsigned char *  a_Buffer,
size_t  a_NumBytes 
)
overridevirtual

Definition at line 706 of file TCPLinkImpl.cpp.

◆ SetSelf()

void cTCPLinkImpl::cLinkTlsContext::SetSelf ( cLinkTlsContextWPtr  a_Self)

Shares ownership of self, so that this object can keep itself alive for as long as it needs.

Definition at line 575 of file TCPLinkImpl.cpp.

◆ StoreReceivedData()

void cTCPLinkImpl::cLinkTlsContext::StoreReceivedData ( const char *  a_Data,
size_t  a_NumBytes 
)

Stores the specified block of data into the buffer of the data to be decrypted (incoming from remote).

Also flushes the SSL buffers by attempting to read any data through the SSL context.

Definition at line 593 of file TCPLinkImpl.cpp.

◆ TryFinishHandshaking()

void cTCPLinkImpl::cLinkTlsContext::TryFinishHandshaking ( void  )

Tries to finish handshaking the SSL.

Definition at line 639 of file TCPLinkImpl.cpp.

Member Data Documentation

◆ m_CleartextData

AString cTCPLinkImpl::cLinkTlsContext::m_CleartextData
private

Buffer for storing the outgoing cleartext data until the link has finished handshaking.

Definition at line 104 of file TCPLinkImpl.h.

◆ m_EncryptedData

AString cTCPLinkImpl::cLinkTlsContext::m_EncryptedData
private

Buffer for storing the incoming encrypted data until it is requested by the SSL decryptor.

Definition at line 101 of file TCPLinkImpl.h.

◆ m_Link

cTCPLinkImpl& cTCPLinkImpl::cLinkTlsContext::m_Link
private

Definition at line 98 of file TCPLinkImpl.h.

◆ m_Self

cLinkTlsContextWPtr cTCPLinkImpl::cLinkTlsContext::m_Self
private

Shared ownership of self, so that this object can keep itself alive for as long as it needs.

Definition at line 107 of file TCPLinkImpl.h.


The documentation for this class was generated from the following files: