feat(Core): replace ACE network with Boost.Asio (#6574)

This commit is contained in:
Kargatum
2021-07-16 15:43:56 +07:00
committed by GitHub
parent 7449496bb5
commit 8568c4fb33
64 changed files with 3242 additions and 4712 deletions

View File

@@ -7,9 +7,9 @@
#include "Util.h"
#include "Common.h"
#include "Containers.h"
#include "IpAddress.h"
#include "StringConvert.h"
#include "StringFormat.h"
#include <ace/Default_Constants.h>
#include <algorithm>
#include <cctype>
#include <cstdarg>
@@ -17,8 +17,10 @@
#include <iomanip>
#include <sstream>
#include <string>
#include <cctype>
#include <cstdarg>
#include <ctime>
#include <utf8.h>
// #include "IpAddress.h"
Tokenizer::Tokenizer(const std::string& src, const char sep, uint32 vectorReserve)
{
@@ -295,26 +297,9 @@ bool IsIPAddress(char const* ipaddress)
return false;
}
// Let the big boys do it.
// Drawback: all valid ip address formats are recognized e.g.: 12.23, 121234, 0xABCD)
return inet_addr(ipaddress) != INADDR_NONE;
}
std::string GetAddressString(ACE_INET_Addr const& addr)
{
char buf[ACE_MAX_FULLY_QUALIFIED_NAME_LEN + 16];
addr.addr_to_string(buf, ACE_MAX_FULLY_QUALIFIED_NAME_LEN + 16);
return buf;
}
bool IsIPAddrInNetwork(ACE_INET_Addr const& net, ACE_INET_Addr const& addr, ACE_INET_Addr const& subnetMask)
{
uint32 mask = subnetMask.get_ip_address();
if ((net.get_ip_address() & mask) == (addr.get_ip_address() & mask))
{
return true;
}
return false;
boost::system::error_code error;
Acore::Net::make_address(ipaddress, error);
return !error;
}
/// create PID file