AuroraRPC/Source/AuRPCPipe.hpp

51 lines
1.2 KiB
C++
Raw Normal View History

2022-07-02 22:08:52 +00:00
/***
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;
2023-10-16 00:54:34 +00:00
void OnPipeReallocEvent(bool bSuccess) override;
2022-07-02 22:08:52 +00:00
// 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);
2022-07-02 22:08:52 +00:00
bool WaitForOtherEnd();
void Deinit();
private:
bool errored_{};
};