2022-08-28 19:02:06 +00:00
|
|
|
/***
|
|
|
|
Copyright (C) 2022 J Reece Wilson (a/k/a "Reece"). All rights reserved.
|
|
|
|
|
|
|
|
File: ProtocolStack.hpp
|
|
|
|
Date: 2022-8-24
|
|
|
|
Author: Reece
|
|
|
|
***/
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
namespace Aurora::IO::Protocol
|
|
|
|
{
|
|
|
|
struct ProtocolPiece;
|
|
|
|
|
|
|
|
struct ProtocolStack : IProtocolStack
|
|
|
|
{
|
|
|
|
~ProtocolStack();
|
|
|
|
|
|
|
|
void DoTick() override;
|
|
|
|
bool DoTick(const AuSPtr<AuByteBuffer> &read, const AuSPtr<ProtocolPiece> &pPiece);
|
|
|
|
|
2022-09-29 10:45:08 +00:00
|
|
|
AuSPtr<IProtocolPiece> AppendInterceptor(const AuSPtr<IProtocolInterceptor> &pInterceptor, AuUInt uOutputBufferSize) override;
|
|
|
|
AuSPtr<IProtocolPiece> AppendInterceptorEx(const AuSPtr<IProtocolInterceptorEx> &pInterceptor, AuUInt uOutputBufferSize) override;
|
2022-11-08 19:24:08 +00:00
|
|
|
AuSPtr<IProtocolPiece> AppendSingleFrameProcessor(const AuSPtr<IProtocolInterceptorEx> &pInterceptorEx) override;
|
|
|
|
AuSPtr<IProtocolPiece> AppendSingleFrameProcessorEx(const AuSPtr<IProtocolInterceptorEx> &pInterceptorEx, AuUInt uOutputBufferSize) override;
|
2022-09-29 10:45:08 +00:00
|
|
|
AuSPtr<IProtocolPiece> PrependInterceptor(const AuSPtr<IProtocolInterceptor> &pInterceptor, AuUInt uOutputBufferSize) override;
|
|
|
|
AuSPtr<IProtocolPiece> PrependInterceptorEx(const AuSPtr<IProtocolInterceptorEx> &pInterceptor, AuUInt uOutputBufferSize) override;
|
|
|
|
AuSPtr<IProtocolPiece> AddEndInterceptor(const AuSPtr<IProtocolInterceptorEx> &pInterceptor) override;
|
2022-08-28 19:02:06 +00:00
|
|
|
|
|
|
|
void Destroy() override;
|
|
|
|
|
2022-09-29 10:45:08 +00:00
|
|
|
AuSPtr<IProtocolPiece> AddInterceptorWhere(bool prepend, const AuSPtr<IProtocolInterceptor> &pInterceptor, AuUInt uOutputBufferSize);
|
2022-11-08 19:24:08 +00:00
|
|
|
AuSPtr<IProtocolPiece> AddInterceptorWhereEx(bool prepend, const AuSPtr<IProtocolInterceptorEx> &pInterceptor, AuUInt uOutputBufferSize, bool bMultipleTick);
|
2022-09-04 00:16:49 +00:00
|
|
|
|
2022-08-28 19:02:06 +00:00
|
|
|
AuSPtr<IStreamWriter> AsStreamWriter() override;
|
|
|
|
AuSPtr<Memory::ByteBuffer> AsWritableByteBuffer() override;
|
|
|
|
|
|
|
|
AuSPtr<IStreamReader> AsStreamReader() override;
|
|
|
|
AuSPtr<Memory::ByteBuffer> AsReadableByteBuffer() override;
|
|
|
|
|
|
|
|
AuSPtr<AuByteBuffer> pSourceBufer;
|
|
|
|
bool bOwnsSource {};
|
|
|
|
|
|
|
|
AuSPtr<AuByteBuffer> pDrainBuffer;
|
|
|
|
|
|
|
|
AuSPtr<ProtocolPiece> pBottomPiece;
|
|
|
|
AuSPtr<ProtocolPiece> pTopPiece;
|
2022-09-02 19:53:25 +00:00
|
|
|
|
|
|
|
bool bWrittenEnd {};
|
2022-08-28 19:02:06 +00:00
|
|
|
};
|
|
|
|
}
|