44 lines
980 B
C++
44 lines
980 B
C++
|
/***
|
||
|
Copyright (C) 2022 J Reece Wilson (a/k/a "Reece"). All rights reserved.
|
||
|
|
||
|
File: AuRPCServerChannel.hpp
|
||
|
Date: 2022-6-29
|
||
|
Author: Reece
|
||
|
***/
|
||
|
#pragma once
|
||
|
|
||
|
#include "AuRPCChannel.hpp"
|
||
|
#include "AuRPCPipe.hpp"
|
||
|
|
||
|
struct AuRPCServerChannel : AuRPCChannel
|
||
|
{
|
||
|
AuRPCServerChannel(AuSPtr<AuRPC> parent, AuSPtr<AuRPCServer> server);
|
||
|
|
||
|
bool Init();
|
||
|
AuString ExportString();
|
||
|
|
||
|
void SendResponse(AuSPtr<AuRPCResponse> response);
|
||
|
|
||
|
virtual AuSPtr<AuRPC> ToContext() override;
|
||
|
virtual bool OnConnect() override;
|
||
|
virtual void OnDisconnect(bool error) override;
|
||
|
virtual bool OnDataAvailable(AuByteBuffer& view) override;
|
||
|
|
||
|
void FatalError();
|
||
|
|
||
|
void SendToNewChannel();
|
||
|
void SendConnectOK();
|
||
|
|
||
|
inline void MakeTemp()
|
||
|
{
|
||
|
this->isTempChannel_ = true;
|
||
|
}
|
||
|
private:
|
||
|
|
||
|
AuList<AuSPtr<AuRPCServerChannel>> subchannels_;
|
||
|
AuSPtr<AuRPCServer> server_;
|
||
|
bool isTempChannel_ {};
|
||
|
AuRPCPipe pipe;
|
||
|
AuSPtr<AuRPC> parent;
|
||
|
};
|