Add ipv4::ip constructor from uint32_t

This commit is contained in:
Danny Robson 2011-06-30 20:34:53 +10:00
parent c886cd88e3
commit c57a72705c
2 changed files with 6 additions and 0 deletions

View File

@ -35,6 +35,11 @@ const range<ipv4::port> ipv4::WELL_KNOWN_PORT ( 0, 1023),
ipv4::PRIVATE_PORT (49152, 65535); ipv4::PRIVATE_PORT (49152, 65535);
ipv4::ip::ip (uint32_t _integer):
m_integer (_integer)
{ ; }
ipv4::ip::ip (uint8_t a, uint8_t b, uint8_t c, uint8_t d): ipv4::ip::ip (uint8_t a, uint8_t b, uint8_t c, uint8_t d):
m_octets ({ a, b, c, d }) m_octets ({ a, b, c, d })
{ ; } { ; }

1
ip.hpp
View File

@ -34,6 +34,7 @@ namespace ipv4 {
}; };
ip (const std::string &); ip (const std::string &);
ip (uint32_t i);
ip (uint8_t a, uint8_t b, uint8_t c, uint8_t d); ip (uint8_t a, uint8_t b, uint8_t c, uint8_t d);
ip& operator = (const ip &); ip& operator = (const ip &);