Add loopback and any address constants for IP

This commit is contained in:
Danny Robson 2011-06-23 22:07:55 +10:00
parent 212dcbfbd8
commit 9ae8b4b8d5
2 changed files with 7 additions and 0 deletions

View File

@ -27,6 +27,10 @@
using namespace std;
const ipv4::ip ipv4::ip::LOOPBACK ({ 127, 0, 0, 1 });
const ipv4::ip ipv4::ip::ANY ({ 0, 0, 0, 0 });
ipv4::ip::ip (uint8_t a, uint8_t b, uint8_t c, uint8_t d):
m_octets ({ a, b, c, d })
{ ; }

3
ip.hpp
View File

@ -34,6 +34,9 @@ namespace ipv4 {
bool operator == (const ip &) const;
static ip parse (const std::string &);
static const ip LOOPBACK;
static const ip ANY;
};