reinterpret_cast<in_addr*>(*(ent->h_addr_list))->s_addr);
}
-prefix_ std::string senf::INet4Address::toString() const {
- char buffer[4*4];
- ::in_addr ina;
- ina.s_addr = (*this).inaddr();
- ::inet_ntop(AF_INET, & ina , buffer, sizeof(buffer));
- buffer[sizeof(buffer)-1] = 0;
- return buffer;
-}
-
prefix_ bool senf::INet4Address::local()
const
{
///////////////////////////////////////////////////////////////////////////
// senf::INet4Network
-prefix_ senf::INet4Network::INet4Network(std::string s)
+prefix_ senf::INet4Network::INet4Network(std::string const & s)
{
std::string::size_type i (s.find('/'));
if (i == std::string::npos)
return os;
}
+prefix_ std::istream & senf::operator>>(std::istream & is, INet4Address & addr)
+{
+ std::string s;
+ if (!(is >> s))
+ return is;
+ try {
+ addr = INet4Address::from_string(s);
+ }
+ catch (AddressException &) {
+ is.setstate(std::ios::failbit);
+ }
+ return is;
+}
+
///////////////////////////////cc.e////////////////////////////////////////
#undef prefix_
//#include "INet4Address.mpp"