/** * @file ip.cc * @brief A IP class, that handles all about time. * * code taken from audiere. */ #include "ip.h" #include "multi_type.h" IP::IP() {} IP::IP(int ip) { this->_ip = ip; } IP::IP(const std::string& ip) { this->_ip = IP::stringToIP(ip); } int IP::stringToIP(const std::string& ip) { } std::string IP::ipToString(const IPaddress& ipaddr) { int ip = SDLNet_Read32 (ipaddr.host); return ipToString(ip); } std::string IP::ipToString(int ip) { MultiType part0( (ip & 0xFF000000) >> 24); MultiType part1( (ip & 0x00FF0000) >> 16); MultiType part2( (ip & 0x0000FF00) >> 8); MultiType part3( (ip & 0x000000FF) ); return part0.getString() + "." + part1.getString() + "." + part2.getString() + "." + part3.getString(); }