Reece Wilson
67905a4192
============================================================================= 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
95 lines
2.2 KiB
C++
95 lines
2.2 KiB
C++
/***
|
|
Copyright (C) 2022 J Reece Wilson (a/k/a "Reece"). All rights reserved.
|
|
|
|
File: AuNetInterface.cpp
|
|
Date: 2022-8-16
|
|
Author: Reece
|
|
***/
|
|
#include "Networking.hpp"
|
|
#include "AuNetInterface.hpp"
|
|
#include "AuNetWorker.hpp"
|
|
|
|
namespace Aurora::IO::Net
|
|
{
|
|
NetInterface::NetInterface() :
|
|
netServiceResolve_(this),
|
|
netServiceSockets_(this),
|
|
netServiceDatagram_(this)
|
|
{
|
|
|
|
}
|
|
|
|
AuSPtr<INetSrvWorkers> NetInterface::GetWorkersService()
|
|
{
|
|
return AuSPtr<INetSrvWorkers>(AuSharedFromThis(), &this->netServiceWorkers_);
|
|
}
|
|
|
|
AuSPtr<INetSrvResolve> NetInterface::GetResolveService()
|
|
{
|
|
return AuSPtr<INetSrvResolve>(AuSharedFromThis(), &this->netServiceResolve_);
|
|
}
|
|
|
|
AuSPtr<INetSrvSockets> NetInterface::GetSocketService()
|
|
{
|
|
return AuSPtr<INetSrvSockets>(AuSharedFromThis(), &this->netServiceSockets_);
|
|
}
|
|
|
|
AuSPtr<INetSrvDatagram> NetInterface::GetDatagramService()
|
|
{
|
|
return AuSPtr<INetSrvDatagram>(AuSharedFromThis(), &this->netServiceDatagram_);
|
|
}
|
|
|
|
bool NetInterface::TrySchedule(const AuSPtr<IIOProcessorWorkUnit> &pWorkUnit)
|
|
{
|
|
auto workerId = AuAtomicAdd<AuUInt>(&this->atomicCounter_, 1u) - 1u;
|
|
auto worker = this->netServiceWorkers_.GetWorkerByIndex(workerId);
|
|
if (!worker)
|
|
{
|
|
SysPushErrorIO("No Worker");
|
|
return {};
|
|
}
|
|
|
|
return worker->ToProcessor()->SubmitIOWorkItem(pWorkUnit);
|
|
}
|
|
|
|
AuSPtr<NetWorker> NetInterface::TryScheduleEx()
|
|
{
|
|
AuSPtr<NetWorker> worker;
|
|
|
|
do
|
|
{
|
|
worker = this->netServiceWorkers_.GetWorkerByIndex(AuAtomicAdd<AuUInt>(&this->atomicCounter_, 1u) - 1u);
|
|
} while (!worker);
|
|
|
|
return worker;
|
|
}
|
|
|
|
void NetInterface::Shutdown()
|
|
{
|
|
|
|
}
|
|
|
|
void NetInterface::Destroy()
|
|
{
|
|
|
|
}
|
|
|
|
AUKN_SYM AuSPtr<INetInterface> NewNetworkInterface()
|
|
{
|
|
if (!IsNetReady())
|
|
{
|
|
SysPushErrorNet("Platform network service isn't available");
|
|
return {};
|
|
}
|
|
|
|
auto iface = AuMakeShared<NetInterface>();
|
|
if (!iface)
|
|
{
|
|
return iface;
|
|
}
|
|
|
|
// TODO: ...
|
|
|
|
return iface;
|
|
}
|
|
} |