From 2d9a6ecbba3bf5ccbe06468632fc4ab2de9d569b Mon Sep 17 00:00:00 2001 From: Pavel Odintsov Date: Sat, 14 Feb 2015 20:49:32 +0300 Subject: [PATCH] Add proof of concept for CIDR validator --- tests/test_cidr.cpp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 tests/test_cidr.cpp diff --git a/tests/test_cidr.cpp b/tests/test_cidr.cpp new file mode 100644 index 0000000..ab7feb7 --- /dev/null +++ b/tests/test_cidr.cpp @@ -0,0 +1,24 @@ +#include +#include +#include +#include +#include +#include +#include +#include + +uint32_t convert_ip_as_string_to_uint(std::string ip) { + struct in_addr ip_addr; + inet_aton(ip.c_str(), &ip_addr); + + // in network byte order + return ip_addr.s_addr; +} + +int main() { + std::cout<<"network byte order"<