2022-08-28 19:02:06 +00:00
|
|
|
/***
|
|
|
|
Copyright (C) 2022 J Reece Wilson (a/k/a "Reece"). All rights reserved.
|
|
|
|
|
|
|
|
File: AuNetStream.NT.hpp
|
|
|
|
Date: 2022-8-17
|
|
|
|
Author: Reece
|
|
|
|
***/
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <Source/IO/Loop/ILoopSourceEx.hpp>
|
|
|
|
#include <Source/IO/Loop/LSHandle.hpp>
|
|
|
|
#include <Source/IO/Loop/LSEvent.hpp>
|
|
|
|
#include <Source/IO/FS/Async.NT.hpp>
|
|
|
|
|
|
|
|
namespace Aurora::IO::Net
|
|
|
|
{
|
|
|
|
struct SocketBase;
|
|
|
|
|
|
|
|
struct NtAsyncNetworkTransaction : IAsyncTransaction, AuEnableSharedFromThis<NtAsyncNetworkTransaction>
|
|
|
|
{
|
|
|
|
NtAsyncNetworkTransaction(SocketBase *pSocket);
|
|
|
|
~NtAsyncNetworkTransaction();
|
|
|
|
|
|
|
|
bool StartRead(AuUInt64 offset, const AuSPtr<AuMemoryViewWrite> &memoryView) override;
|
|
|
|
bool StartWrite(AuUInt64 offset, const AuSPtr<AuMemoryViewRead> &memoryView) override;
|
|
|
|
|
2023-05-11 15:05:00 +00:00
|
|
|
bool CompleteEx(AuUInt completeRoutine, bool bForce = false);
|
2022-08-28 19:02:06 +00:00
|
|
|
|
2023-08-08 23:14:36 +00:00
|
|
|
bool Complete() override;
|
|
|
|
|
2023-12-28 16:49:11 +00:00
|
|
|
bool HasFailed() override;
|
2023-04-26 19:32:25 +00:00
|
|
|
bool HasErrorCode();
|
2022-08-28 19:02:06 +00:00
|
|
|
AuUInt GetOSErrorCode() override;
|
|
|
|
|
2023-08-08 23:14:36 +00:00
|
|
|
bool HasCompleted() override;
|
|
|
|
|
2022-08-28 19:02:06 +00:00
|
|
|
AuUInt32 GetLastPacketLength() override;
|
|
|
|
|
|
|
|
void SetCallback(const AuSPtr<IAsyncFinishedSubscriber> &sub) override;
|
|
|
|
|
|
|
|
bool Wait(AuUInt32 timeout) override;
|
|
|
|
AuSPtr<AuLoop::ILoopSource> NewLoopSource() override;
|
|
|
|
|
2023-08-08 23:02:35 +00:00
|
|
|
void SetBaseOffset(AuUInt64 uBaseOffset) override;
|
|
|
|
|
2023-12-19 03:43:11 +00:00
|
|
|
void Reset() override;
|
2022-08-28 19:02:06 +00:00
|
|
|
|
|
|
|
void MakeSyncable();
|
|
|
|
void ForceNextWriteWait();
|
|
|
|
|
|
|
|
bool IDontWannaUsePorts();
|
|
|
|
|
|
|
|
void DispatchCb(AuUInt32 len);
|
|
|
|
|
|
|
|
SOCKET GetSocket();
|
|
|
|
HANDLE GetAlertable();
|
|
|
|
|
2023-12-07 11:13:32 +00:00
|
|
|
bool TranslateLastError(bool bReturnValue, bool bForceFail = false);
|
2022-08-28 19:02:06 +00:00
|
|
|
|
|
|
|
SocketBase * pSocket;
|
|
|
|
OVERLAPPED overlap {};
|
|
|
|
AuSPtr<Loop::ILSEvent> pWaitable;
|
|
|
|
bool bForceNextWait {};
|
|
|
|
AuSPtr<NtAsyncNetworkTransaction> pPin;
|
|
|
|
AuUInt32 dwLastAbstractStat {},
|
|
|
|
dwLastAbstractOffset {},
|
|
|
|
dwLastBytes {};
|
|
|
|
bool bIsIrredeemable {};
|
|
|
|
bool bLatch {};
|
|
|
|
AuUInt32 dwOsErrorCode {};
|
|
|
|
AuUInt32 dwRecvFlags {};
|
|
|
|
AuUInt32 dwSendFlags {};
|
|
|
|
bool bHasFailed {};
|
|
|
|
AuSPtr<void> pMemoryHold;
|
|
|
|
bool bDisallowRecv {};
|
|
|
|
bool bDisallowSend {};
|
|
|
|
bool bSendEOSOnce {};
|
|
|
|
bool bIsWriting {};
|
|
|
|
bool bDatagramMode {};
|
|
|
|
AuSPtr<IAsyncFinishedSubscriber> pSub;
|
|
|
|
int iSocketLength {};
|
|
|
|
NetEndpoint netEndpoint;
|
|
|
|
|
|
|
|
};
|
|
|
|
}
|