98 lines
3.2 KiB
C++
98 lines
3.2 KiB
C++
/***
|
|
Copyright (C) 2022 J Reece Wilson (a/k/a "Reece"). All rights reserved.
|
|
|
|
File: AuNetStream.Linux.hpp
|
|
Date: 2022-8-26
|
|
Author: Reece
|
|
***/
|
|
#pragma once
|
|
|
|
#include <Source/IO/Loop/Loop.hpp>
|
|
#include <Source/IO/Loop/ILoopSourceEx.hpp>
|
|
#include <Source/IO/Loop/LSHandle.hpp>
|
|
#include <Source/IO/Loop/LSEvent.hpp>
|
|
#include <Source/IO/FS/Async.Linux.hpp>
|
|
#include <Source/IO/UNIX/IOSubmit.Linux.hpp>
|
|
|
|
namespace Aurora::IO::Net
|
|
{
|
|
struct SocketBase;
|
|
|
|
struct LinuxAsyncNetworkTransaction :
|
|
IAsyncTransaction,
|
|
CompletionGroup::ICompletionGroupWorkItem,
|
|
AuEnableSharedFromThis<LinuxAsyncNetworkTransaction>, Aurora::IO::UNIX::ASubmittable
|
|
{
|
|
LinuxAsyncNetworkTransaction(SocketBase *pSocket);
|
|
~LinuxAsyncNetworkTransaction();
|
|
|
|
bool StartRead(AuUInt64 offset, const AuMemoryViewWrite &memoryView) override;
|
|
bool StartWrite(AuUInt64 offset, const AuMemoryViewRead &memoryView) override;
|
|
|
|
bool Complete() override;
|
|
|
|
bool CompleteEx(AuUInt completeRoutine);
|
|
|
|
bool HasFailed() override;
|
|
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 Reset() override;
|
|
|
|
void SetBaseOffset(AuUInt64 uBaseOffset) override;
|
|
|
|
virtual void LIOS_Process(AuUInt32 read, bool failure, int err, bool mark) override;
|
|
|
|
bool HasCompletedForGCWI() override;
|
|
void CleanupForGCWI() override;
|
|
|
|
void MakeSyncable();
|
|
void ForceNextWriteWait();
|
|
|
|
bool IDontWannaUsePorts();
|
|
|
|
void DispatchCb(AuUInt32 len);
|
|
|
|
int GetSocket();
|
|
AuLoop::ILSEvent *GetAlertable();
|
|
|
|
bool TranslateLastError(bool bReturnValue);
|
|
|
|
bool TryAttachToCompletionGroup(const AuSPtr<CompletionGroup::ICompletionGroup> &pCompletionGroup) override;
|
|
CompletionGroup::ICompletionGroupWorkHandle *ToCompletionGroupHandle() override;
|
|
AuSPtr<CompletionGroup::ICompletionGroup> GetCompletionGroup() override;
|
|
|
|
SocketBase * pSocket;
|
|
AuSPtr<Loop::ILSEvent> pWaitable;
|
|
bool bForceNextWait {};
|
|
AuSPtr<LinuxAsyncNetworkTransaction> 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;
|
|
AuSPtr<CompletionGroup::ICompletionGroup> pCompletionGroup_;
|
|
int iSocketLength {};
|
|
NetEndpoint netEndpoint;
|
|
|
|
};
|
|
} |