stephb9959
2023-01-16 22:31:36 -08:00
parent 040c782f3b
commit b0f1ecbbe4
39 changed files with 408 additions and 1656 deletions

View File

@@ -109,6 +109,11 @@ uint64_t MACToInt(const std::string &MAC) {
return Result;
}
[[nodiscard]] bool ValidHostname(const std::string &Hostname) {
static std::regex HostNameRegex("^(?!-)[A-Za-z0-9-]+([\\-\\.]{1}[a-z0-9]+)*\\.[A-Za-z]{2,6}$");
return std::regex_match(Hostname,HostNameRegex);
}
[[nodiscard]] std::string ToHex(const std::vector<unsigned char> & B) {
std::string R;
R.reserve(B.size()*2);
@@ -560,4 +565,11 @@ bool ExtractBase64CompressedData(const std::string &CompressedData,
return false;
}
[[nodiscard]] std::uint64_t ConvertDate(const std::string &Date) {
Poco::DateTime DT;
int TZ;
Poco::DateTimeParser::parse(Poco::DateTimeFormat::ISO8601_FORMAT,Date,DT,TZ);
return DT.timestamp().epochTime();
}
}