Reece Wilson
2a3bd735ac
(prepend makes sense for outbound stacks, where you might register the compression/crypto stages first, then return an object to the caller who may wish to prepend the input processors. http might need it.)
49 lines
1.7 KiB
C++
49 lines
1.7 KiB
C++
/***
|
|
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);
|
|
|
|
bool AppendInterceptor(const AuSPtr<IProtocolInterceptor> &pInterceptor, AuUInt uOutputBufferSize) override;
|
|
bool AppendInterceptorEx(const AuSPtr<IProtocolInterceptorEx> &pInterceptor, AuUInt uOutputBufferSize) override;
|
|
bool PrependInterceptor(const AuSPtr<IProtocolInterceptor> &pInterceptor, AuUInt uOutputBufferSize) override;
|
|
bool PrependInterceptorEx(const AuSPtr<IProtocolInterceptorEx> &pInterceptor, AuUInt uOutputBufferSize) override;
|
|
bool AddEndInterceptor(const AuSPtr<IProtocolInterceptorEx> &pInterceptor) override;
|
|
|
|
void Destroy() override;
|
|
|
|
bool AddInterceptorWhere(bool prepend, const AuSPtr<IProtocolInterceptor> &pInterceptor, AuUInt uOutputBufferSize);
|
|
bool AddInterceptorWhereEx(bool prepend, const AuSPtr<IProtocolInterceptorEx> &pInterceptor, AuUInt uOutputBufferSize);
|
|
|
|
|
|
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;
|
|
|
|
bool bWrittenEnd {};
|
|
};
|
|
} |