AuroraRuntime/Source/IO/Net/AuNetStream.Linux.hpp

98 lines
3.2 KiB
C++
Raw Normal View History

2023-12-28 16:49:11 +00:00
/***
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
2023-12-28 16:49:11 +00:00
{
LinuxAsyncNetworkTransaction(SocketBase *pSocket);
~LinuxAsyncNetworkTransaction();
bool StartRead(AuUInt64 offset, const AuMemoryViewWrite &memoryView) override;
bool StartWrite(AuUInt64 offset, const AuMemoryViewRead &memoryView) override;
2023-12-28 16:49:11 +00:00
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;
2024-02-23 12:44:43 +00:00
bool HasCompletedForGCWI() override;
void CleanupForGCWI() override;
2023-12-28 16:49:11 +00:00
void MakeSyncable();
void ForceNextWriteWait();
bool IDontWannaUsePorts();
void DispatchCb(AuUInt32 len);
int GetSocket();
AuLoop::ILSEvent *GetAlertable();
2023-12-28 16:49:11 +00:00
bool TranslateLastError(bool bReturnValue);
bool TryAttachToCompletionGroup(const AuSPtr<CompletionGroup::ICompletionGroup> &pCompletionGroup) override;
CompletionGroup::ICompletionGroupWorkHandle *ToCompletionGroupHandle() override;
AuSPtr<CompletionGroup::ICompletionGroup> GetCompletionGroup() override;
2023-12-28 16:49:11 +00:00
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_;
2023-12-28 16:49:11 +00:00
int iSocketLength {};
NetEndpoint netEndpoint;
};
[+] Network + Protocol + TLS - Initial Commit ============================================================================= Network ]==================================================================== ============================================================================= [+] Added (very) early Aurora::IO::Net implementation [+] AuNet::EHostnameType [+] AuNet::EIPProtocol [+] AuNet::ENetworkError [+] AuNet::ETransportProtocol [+] AuNet::INetInterface [+] AuNet::INetSrvDatagram [+] AuNet::INetSrvResolve [+] AuNet::INetSrvSockets [+] AuNet::INetSrvWorkers [+] AuNet::INetWorker [+] AuNet::IPAddress [+] AuNet::IResolver [+] AuNet::ISocket [+] AuNet::IResolver [+] AuNet::ISocketBase [+] AuNet::ISocketChannel [+] AuNet::ISocketDriver [+] AuNet::ISocketDriverFactory [+] AuNet::ISocketServer [+] AuNet::ISocketServerDriver [+] AuNet::NetEndpoint [+] AuNet::NetError [+] AuNet::NetHostname (+implementation) ============================================================================= Protocol ]=================================================================== ============================================================================= [+] IProtocolInterceptor [+] IProtocolInterceptorEx [+] IProtocolStack (+implementation) ============================================================================= TLS ]======================================================================== ============================================================================= [+] ITLSContext [+] TLSProtocolRecv [+] TLSProtocolSend (+implementation) ============================================================================= IO Bug Fixes ]=============================================================== ============================================================================= [*] IOProcessor::SubmitIOWorkItem should signal the CvEvent, forcing at least once future tick (wont optimize with if in tick & not yet dispatched work items) [*] Split IOPipeWork in into IOPipeProcessor header [+] IOPipeWork::GetBuffer (internal reallocation) [*] Harden against IAsyncTransactions without a loop source [*] Missing null `if (processor->listener)` in IOProcessor [*] Solved some soft-lock conditions under Linux's LoopQueue (added deferred commits) [*] Quick hack: IOProcessor::HasItems() should OR the early can-tick check function. ============================================================================= Other ]====================================================================== ============================================================================= [+] Linux: LSSignalCatcher [+] `static void AuResetMember(Aurora::Memory::ByteBuffer &ref)` for AuROXTL [*] Attempt to enforce a normalization and don't overwrite-readptr-under-istreamwriters policy in ByteBuffer_ReadWrite (circular buffers) [*] Bad ECC ctors ============================================================================= Known issues ]=============================================================== ============================================================================= > Linux net is nowhere near done > UDP socket emulation layer isn't implemented > Ciphersuite API is a stub > Private key API is a stub > ...therefore no TLS servers > Missing thread safety precautions under net > Net implementation is still beri early
2022-08-28 19:02:06 +00:00
}