AuroraRuntime/Source/IO/TLS/TLSProtocolRecv.hpp

39 lines
1.1 KiB
C++

/***
Copyright (C) 2022 J Reece Wilson (a/k/a "Reece"). All rights reserved.
File: TLSProtocolRecv.hpp
Date: 2022-8-24
Author: Reece
***/
#pragma once
namespace Aurora::IO::TLS
{
struct TLSContext;
struct TLSProtocolRecv : Protocol::IProtocolInterceptorEx
{
TLSProtocolRecv(TLSContext *pParent);
virtual bool OnDataAvailable(const AuSPtr<Memory::ByteBuffer> &pReadInByteBuffer,
const AuSPtr<Memory::ByteBuffer> &pWriteOutByteBuffer,
const AuSPtr<Protocol::IProtocolPiece> &pProtocolPiece) override;
bool TryHandshake();
bool DoHandshake(bool &bComplete);
bool DoOneTick(const AuSPtr<Memory::ByteBuffer> &pWriteOutByteBuffer);
bool bHasRead {};
AuUInt32 uBytesRead {};
AuUInt32 uBytesReadAvail {};
AuWPtr<Memory::ByteBuffer> pReadInByteBuffer;
bool &HasCompletedHandshake();
private:
TLSContext *pParent_;
bool bHasCompletedHandshake_ {};
bool bHasFailedOnce {};
};
}