diff options
| author | Kargatum <dowlandtop@yandex.com> | 2021-07-16 15:43:56 +0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-07-16 10:43:56 +0200 |
| commit | 8568c4fb332ead18263ea761d6acd9473707d3a0 (patch) | |
| tree | 63aa42153cee51aff14e010a17fe549e5230143b /src/common/Utilities/Util.cpp | |
| parent | 7449496bb5174309d064294e182e0fbaa8c78068 (diff) | |
feat(Core): replace ACE network with Boost.Asio (#6574)
Diffstat (limited to 'src/common/Utilities/Util.cpp')
| -rw-r--r-- | src/common/Utilities/Util.cpp | 29 |
1 files changed, 7 insertions, 22 deletions
diff --git a/src/common/Utilities/Util.cpp b/src/common/Utilities/Util.cpp index 3df1616898..5628323251 100644 --- a/src/common/Utilities/Util.cpp +++ b/src/common/Utilities/Util.cpp @@ -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 |
