/*** Copyright (C) 2022 J Reece Wilson (a/k/a "Reece"). All rights reserved. File: AuRPCPipe.hpp Date: 2022-6-29 Author: Reece ***/ #pragma once struct AuRPCPipePacket; struct AuRPCChannel; struct AuRPCPipe : AuIO::IIOBufferedStreamAvailable, AuIO::IIOSimpleEventListener, AuIO::IIOPipeEventListener { AuRPCPipe(AuRPCChannel* channel); ~AuRPCPipe(); AuRPCChannel* channel; AuSPtr pipe; AuSPtr work; AuSPtr isOpenWork; bool isClient_{}; // IIOEventListenerFunctional void OnIOTick() override; void OnIOFailure() override; void OnIOComplete() override; // Pipe callbacks void OnPipePartialEvent(AuUInt trasnferred) override; void OnPipeSuccessEvent() override; void OnPipeFailureEvent() override; void OnPipeReallocEvent(bool bSuccess) override; // IIOBufferedStreamAvailable bool OnDataAvailable(AuByteBuffer& view) override; void OnFatalError(); void OnError(bool fatal); void OnConnect(); bool SendPacket(const AuRPCPipePacket& packet); bool Init(const AuString& str); bool Init(AuOptional optLength); bool WaitForOtherEnd(); void Deinit(); private: bool errored_{}; };