AuroraRPC/Source/AuRPCPipe.hpp
Jamie Reece Wilson aa7591967a [+] Broadcasts and client/server messages
[+] Async responses
[+] AuRPC::SetRecommendedPipeLength
2023-12-16 18:16:32 +00:00

51 lines
1.2 KiB
C++

/***
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<AuIPC::IPCPipe> pipe;
AuSPtr<AuIO::IIOPipeWork> work;
AuSPtr<AuIO::IIOProcessorItem> 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<AuUInt32> optLength);
bool WaitForOtherEnd();
void Deinit();
private:
bool errored_{};
};