60 lines
1.7 KiB
C++
60 lines
1.7 KiB
C++
|
/***
|
||
|
Copyright (C) 2022 J Reece Wilson (a/k/a "Reece"). All rights reserved.
|
||
|
|
||
|
File: AuNetSocketOverlappedOperation.Unix.hpp
|
||
|
Date: 2022-8-26
|
||
|
Author: Reece
|
||
|
***/
|
||
|
#pragma once
|
||
|
|
||
|
namespace Aurora::IO::Net
|
||
|
{
|
||
|
struct NetInterface;
|
||
|
struct NetWorker;
|
||
|
struct Socket;
|
||
|
|
||
|
struct SocketOverlappedOperation : AuIO::IIOSimpleEventListener
|
||
|
{
|
||
|
SocketOverlappedOperation(bool bMultipleTrigger = false);
|
||
|
SocketOverlappedOperation(const AuSPtr<AuLoop::ILoopSource> &pTrigger);
|
||
|
|
||
|
AuSPtr<void> pSocket {};
|
||
|
AuSPtr<AuLoop::ILoopSource> pEvent;
|
||
|
AuUInt uOsError {};
|
||
|
bool bMultipleTrigger {};
|
||
|
|
||
|
bool FinishOperation(const AuSPtr<void> &pThat,
|
||
|
const AuSPtr<INetWorker> &pWorker,
|
||
|
bool bReturnCode);
|
||
|
|
||
|
bool FinishOperationEx(const AuSPtr<void> &pThat,
|
||
|
const AuSPtr<INetWorker> &pWorker,
|
||
|
bool bReturnCode,
|
||
|
AuUInt32 dwCode);
|
||
|
|
||
|
void UpdateTrigger(const AuSPtr<AuLoop::ILoopSource> &pTrigger);
|
||
|
|
||
|
bool BeginOperation(const AuSPtr<void> &pThat,
|
||
|
const AuSPtr<INetWorker> &pWorker);
|
||
|
|
||
|
NetError ToError();
|
||
|
|
||
|
virtual void OnIOTick() override;
|
||
|
|
||
|
virtual void OnIOComplete() override;
|
||
|
virtual void OnIOFailure() override;
|
||
|
|
||
|
virtual void OnOverlappedComplete() = 0;
|
||
|
virtual void OnOverlappedFailure(const NetError &error) = 0;
|
||
|
|
||
|
bool HasFailed();
|
||
|
AuUInt ToOsError();
|
||
|
bool HasComplete();
|
||
|
|
||
|
bool IsValid();
|
||
|
|
||
|
|
||
|
private:
|
||
|
bool bHasFlipped {};
|
||
|
};
|
||
|
}
|