55 lines
1.4 KiB
C++
55 lines
1.4 KiB
C++
|
/***
|
||
|
Copyright (C) 2022 J Reece Wilson (a/k/a "Reece"). All rights reserved.
|
||
|
|
||
|
File: AuNetSocketOverlappedOperation.NT.hpp
|
||
|
Date: 2022-8-17
|
||
|
Author: Reece
|
||
|
***/
|
||
|
#pragma once
|
||
|
|
||
|
namespace Aurora::IO::Net
|
||
|
{
|
||
|
struct NetInterface;
|
||
|
struct NetWorker;
|
||
|
struct Socket;
|
||
|
|
||
|
struct SocketOverlappedOperation : AuIO::IIOSimpleEventListener
|
||
|
{
|
||
|
SocketOverlappedOperation(bool bMultipleTrigger = false);
|
||
|
|
||
|
OVERLAPPED overlapped {};
|
||
|
|
||
|
AuSPtr<void> pSocket {};
|
||
|
AuSPtr<AuLoop::ILSEvent> pEvent;
|
||
|
AuUInt uOsError {};
|
||
|
bool bMultipleTrigger {};
|
||
|
|
||
|
bool FinishOperation(const AuSPtr<void> &that,
|
||
|
const AuSPtr<INetWorker> &pWorker,
|
||
|
bool bReturnCode);
|
||
|
|
||
|
bool FinishOperationEx(const AuSPtr<void> &that,
|
||
|
const AuSPtr<INetWorker> &pWorker,
|
||
|
bool bReturnCode,
|
||
|
DWORD dwCode);
|
||
|
|
||
|
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 {};
|
||
|
};
|
||
|
}
|