[+] IProcessSectionMapView::LockSwap

[+] IProcessSectionMapView::UnlockSwap
[*] Fix critical tag under ILogger
[*] Added missing includes to experimental APIs
This commit is contained in:
Reece Wilson 2023-04-17 15:55:51 +01:00
parent 0c494cb99a
commit b2311a8824
11 changed files with 69 additions and 13 deletions

View File

@ -33,4 +33,8 @@
// API wont change much now the core implementation works.
#if 1
#include "IOExperimental.hpp"
#endif
#endif
#include "Protocol/Protocol.hpp"
#include "TLS/TLS.hpp"

View File

@ -12,10 +12,10 @@ namespace Aurora::IO::TLS
struct ICertificateChain
{
virtual AuUInt32 GetCertificateCount() = 0;
virtual AuSPtr<AuMemoryViewRead> GetCertificate(AuUInt32 idx) = 0;
virtual AuSPtr<Memory::MemoryViewRead> GetCertificate(AuUInt32 idx) = 0;
virtual Crypto::X509::DecodedCertificate GetCertificateDetails(AuUInt32 idx) = 0;
};
AUKN_SYM AuSPtr<ICertificateChain> ChainFromOne(const AuMemoryViewRead &read);
AUKN_SYM AuSPtr<ICertificateChain> ChainFromMany(const AuList<AuMemoryViewRead> &read);
AUKN_SYM AuSPtr<ICertificateChain> ChainFromOne(const Memory::MemoryViewRead &read);
AUKN_SYM AuSPtr<ICertificateChain> ChainFromMany(const AuList<Memory::MemoryViewRead> &read);
}

View File

@ -26,7 +26,7 @@ namespace Aurora::IO::TLS
/**
* @brief
*/
AuByteBuffer serverTransportId {};
Memory::ByteBuffer serverTransportId {};
int iServerCookies { 0 };
@ -117,7 +117,7 @@ namespace Aurora::IO::TLS
/**
* @brief
*/
AuNet::ETransportProtocol transportProtocol { AuNet::ETransportProtocol::eProtocolTCP };
Net::ETransportProtocol transportProtocol { Net::ETransportProtocol::eProtocolTCP };
/**
* @brief

View File

@ -11,8 +11,8 @@ namespace Aurora::IO::TLS
{
struct TLSPrivateKeyPair
{
AuList<AuByteBuffer> certificateChain;
AuByteBuffer privateKey;
AuList<Memory::ByteBuffer> certificateChain;
Memory::ByteBuffer privateKey;
AuString sPassword;
};
}

View File

@ -90,7 +90,7 @@ namespace Aurora::Logging
template<typename ... T>
inline void LogCritical(const AuString &line, T&& ... args)
{
WriteLinef(static_cast<AuUInt8>(ELogLevel::eCritical), EAnsiColor::eBoldRed, "Warn", line, AuForward<T>(args)...);
WriteLinef(static_cast<AuUInt8>(ELogLevel::eCritical), EAnsiColor::eBoldRed, "Critical", line, AuForward<T>(args)...);
}
template<typename ... T>

View File

@ -20,5 +20,8 @@ namespace Aurora::Process
virtual AuUInt8 *GetBasePointer() = 0;
virtual AuUInt8 *GetPointer(AuUInt offset) = 0;
virtual bool LockSwap() = 0;
virtual bool UnlockSwap() = 0;
};
}

View File

@ -73,4 +73,24 @@ namespace Aurora::Process
{
return this->uAddress ? AuReinterpretCast<AuUInt8 *>(this->uAddress) + offset : 0;
}
bool ProcessSectionFileMapView::LockSwap()
{
if (!this->uAddress)
{
return false;
}
return AuMemory::SwapLock::Lock({ { this->uAddress, this->uLength} });
}
bool ProcessSectionFileMapView::UnlockSwap()
{
if (!this->uAddress)
{
return false;
}
return AuMemory::SwapLock::Unlock({ { this->uAddress, this->uLength} });
}
}

View File

@ -16,9 +16,9 @@ namespace Aurora::Process
virtual ~ProcessSectionFileMapView();
ProcessSectionFileMapView(AuUInt uAddress, HANDLE hFileSection);
virtual void Unmap() override;
void Unmap() override;
virtual bool Flush(AuUInt offset, AuUInt length) override;
bool Flush(AuUInt offset, AuUInt length) override;
AuUInt GetBaseAddress() override;
AuUInt GetAddress(AuUInt offset) override;
@ -26,6 +26,9 @@ namespace Aurora::Process
AuUInt8 *GetBasePointer() override;
AuUInt8 *GetPointer(AuUInt offset) override;
bool LockSwap() override;
bool UnlockSwap() override;
ProcessSectionView *pProcessGlobalHint {};
AuSPtr<IProcessSectionView> pSharedSectionHint {};
AuUInt uOffset {};

View File

@ -87,4 +87,24 @@ namespace Aurora::Process
{
return this->uAddress ? AuReinterpretCast<AuUInt8 *>(this->uAddress) + offset : 0;
}
bool ProcessSectionFileMapView::LockSwap()
{
if (!this->uAddress)
{
return false;
}
return AuMemory::SwapLock::Lock({ { this->uAddress, this->uLength} });
}
bool ProcessSectionFileMapView::UnlockSwap()
{
if (!this->uAddress)
{
return false;
}
return AuMemory::SwapLock::Unlock({ { this->uAddress, this->uLength} });
}
}

View File

@ -16,9 +16,9 @@ namespace Aurora::Process
ProcessSectionFileMapView(AuUInt uAddress, AuUInt uLength, bool bShouldUnmap, int optFd = -1);
virtual ~ProcessSectionFileMapView();
virtual void Unmap() override;
void Unmap() override;
virtual bool Flush(AuUInt offset, AuUInt length) override;
bool Flush(AuUInt offset, AuUInt length) override;
AuUInt GetBaseAddress() override;
AuUInt GetAddress(AuUInt offset) override;
@ -27,6 +27,9 @@ namespace Aurora::Process
AuUInt8 *GetPointer(AuUInt offset) override;
AuSPtr<IProcessSectionView> pSharedSectionHint {};
bool LockSwap() override;
bool UnlockSwap() override;
private:
AuUInt uAddress {};

View File

@ -153,6 +153,7 @@ namespace Aurora::Process
}
pNewObject->pProcessGlobalHint = this;
pNewObject->uLength = uLength;
return pNewObject;
}
@ -246,6 +247,7 @@ namespace Aurora::Process
}
pNewObject->pProcessGlobalHint = this;
pNewObject->uLength = uLength;
return pNewObject;
}
@ -348,6 +350,7 @@ namespace Aurora::Process
}
pNewObject->pProcessGlobalHint = this;
pNewObject->uLength = uLength;
return pNewObject;
}