85 lines
2.5 KiB
C++
85 lines
2.5 KiB
C++
/***
|
|
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;
|
|
|
|
bool CompleteEx(AuUInt completeRoutine, bool bForce = false);
|
|
|
|
bool Complete() override;
|
|
|
|
bool Failed() override;
|
|
bool HasErrorCode();
|
|
AuUInt GetOSErrorCode() override;
|
|
|
|
bool HasCompleted() override;
|
|
|
|
AuUInt32 GetLastPacketLength() override;
|
|
|
|
void SetCallback(const AuSPtr<IAsyncFinishedSubscriber> &sub) override;
|
|
|
|
bool Wait(AuUInt32 timeout) override;
|
|
AuSPtr<AuLoop::ILoopSource> NewLoopSource() override;
|
|
|
|
void SetBaseOffset(AuUInt64 uBaseOffset) override;
|
|
|
|
void Reset();
|
|
|
|
void MakeSyncable();
|
|
void ForceNextWriteWait();
|
|
|
|
bool IDontWannaUsePorts();
|
|
|
|
void DispatchCb(AuUInt32 len);
|
|
|
|
SOCKET GetSocket();
|
|
HANDLE GetAlertable();
|
|
|
|
bool TranslateLastError(bool bReturnValue);
|
|
|
|
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;
|
|
|
|
};
|
|
} |