48 lines
1.0 KiB
C++
48 lines
1.0 KiB
C++
/***
|
|
Copyright (C) 2022 J Reece Wilson (a/k/a "Reece"). All rights reserved.
|
|
|
|
File: Net.cpp
|
|
Date: 2022-8-22
|
|
Author: Reece
|
|
***/
|
|
#include "Networking.hpp"
|
|
#include "Net.hpp"
|
|
|
|
#if defined(AURORA_IS_LINUX_DERIVED)
|
|
#include "AuNetResolver.Unix.hpp"
|
|
#endif
|
|
|
|
namespace Aurora::IO::Net
|
|
{
|
|
static bool gWin32NetReady { };
|
|
|
|
void InitNetworking()
|
|
{
|
|
#if defined(AURORA_IS_MODERNNT_DERIVED)
|
|
WORD wVersionRequested;
|
|
WSADATA wsaData;
|
|
|
|
wVersionRequested = MAKEWORD(2, 2);
|
|
gWin32NetReady = !WSAStartup(wVersionRequested, &wsaData);
|
|
|
|
GetAddrInfoExCancel_f = AuReinterpretCast<decltype(GetAddrInfoExCancel_f)>(GetProcAddress(GetModuleHandleW(L"Ws2_32.dll"), "GetAddrInfoExCancel"));
|
|
|
|
#endif
|
|
|
|
#if defined(AURORA_IS_LINUX_DERIVED)
|
|
InitFreetardedResolver();
|
|
#endif
|
|
|
|
// ANYONE ELSE? MUSLC FUCKERS?
|
|
|
|
}
|
|
|
|
bool IsNetReady()
|
|
{
|
|
#if defined(AURORA_IS_MODERNNT_DERIVED)
|
|
return gWin32NetReady;
|
|
#else
|
|
return true;
|
|
#endif
|
|
}
|
|
} |