Commit 1d1e8b67 authored by Marcin Siodelski's avatar Marcin Siodelski
Browse files

[1283] Use IOAddress << operator in remaining places in DHCP code.

parent 76072004
......@@ -119,7 +119,7 @@ std::string
D2CfgMgr::reverseV4Address(const isc::asiolink::IOAddress& ioaddr) {
if (!ioaddr.isV4()) {
isc_throw(D2CfgError, "D2CfgMgr address is not IPv4 address :"
<< ioaddr.toText());
<< ioaddr);
}
// Get the address in byte vector form.
......@@ -148,8 +148,7 @@ D2CfgMgr::reverseV4Address(const isc::asiolink::IOAddress& ioaddr) {
std::string
D2CfgMgr::reverseV6Address(const isc::asiolink::IOAddress& ioaddr) {
if (!ioaddr.isV6()) {
isc_throw(D2CfgError, "D2Cfg address is not IPv6 address: "
<< ioaddr.toText());
isc_throw(D2CfgError, "D2Cfg address is not IPv6 address: " << ioaddr);
}
// Turn the address into a string of digits.
......
......@@ -418,7 +418,7 @@ bool IfaceMgr::openSockets6(const uint16_t port) {
if (sock < 0) {
const char* errstr = strerror(errno);
isc_throw(SocketConfigError, "failed to open unicast socket on "
<< addr->toText() << " on interface " << iface->getName()
<< *addr << " on interface " << iface->getName()
<< ", reason: " << errstr);
}
......@@ -449,7 +449,7 @@ bool IfaceMgr::openSockets6(const uint16_t port) {
if (sock < 0) {
const char* errstr = strerror(errno);
isc_throw(SocketConfigError, "failed to open link-local socket on "
<< addr->toText() << " on interface "
<< *addr << " on interface "
<< iface->getName() << ", reason: " << errstr);
}
......
......@@ -102,9 +102,9 @@ std::string Option6AddrLst::toText(int indent /* =0 */) {
tmp << "type=" << type_ << " " << addrs_.size() << "addr(s): ";
for (AddressContainer::const_iterator addr=addrs_.begin();
addr!=addrs_.end(); ++addr) {
tmp << addr->toText() << " ";
for (AddressContainer::const_iterator addr = addrs_.begin();
addr != addrs_.end(); ++addr) {
tmp << *addr << " ";
}
return tmp.str();
}
......
......@@ -98,7 +98,7 @@ std::string Option6IAPrefix::toText(int indent /* =0 */) {
for (int i=0; i<indent; i++)
tmp << " ";
tmp << "type=" << type_ << "(IAPREFIX) prefix=" << addr_.toText() << "/"
tmp << "type=" << type_ << "(IAPREFIX) prefix=" << addr_ << "/"
<< prefix_len_ << ", preferred-lft=" << preferred_ << ", valid-lft="
<< valid_ << endl;
......
......@@ -1752,7 +1752,7 @@ TEST_F(IfaceMgrTest, DISABLED_detectIfaces_linux) {
const Iface::AddressCollection& addrs = i->getAddresses();
for (Iface::AddressCollection::const_iterator a= addrs.begin();
a != addrs.end(); ++a) {
cout << a->toText() << " ";
cout << *a << " ";
}
cout << endl;
}
......@@ -1810,7 +1810,7 @@ TEST_F(IfaceMgrTest, DISABLED_detectIfaces_linux) {
<< " address on " << detected->getFullName() << " interface." << endl;
FAIL();
}
cout << "Address " << addr->toText() << " on interface " << detected->getFullName()
cout << "Address " << *addr << " on interface " << detected->getFullName()
<< " matched with 'ifconfig -a' output." << endl;
}
}
......
......@@ -90,7 +90,7 @@ AllocEngine::IterativeAllocator::increasePrefix(const isc::asiolink::IOAddress&
const uint8_t prefix_len) {
if (!prefix.isV6()) {
isc_throw(BadValue, "Prefix operations are for IPv6 only (attempted to "
"increase prefix " << prefix.toText() << ")");
"increase prefix " << prefix << ")");
}
// Get a buffer holding an address.
......
......@@ -162,7 +162,7 @@ void Subnet::setLastAllocated(Lease::Type type,
std::string
Subnet::toText() const {
std::stringstream tmp;
tmp << prefix_.toText() << "/" << static_cast<unsigned int>(prefix_len_);
tmp << prefix_ << "/" << static_cast<unsigned int>(prefix_len_);
return (tmp.str());
}
......@@ -187,7 +187,7 @@ Subnet4::Subnet4(const isc::asiolink::IOAddress& prefix, uint8_t length,
void Subnet4::setSiaddr(const isc::asiolink::IOAddress& siaddr) {
if (!siaddr.isV4()) {
isc_throw(BadValue, "Can't set siaddr to non-IPv4 address "
<< siaddr.toText());
<< siaddr);
}
siaddr_ = siaddr;
}
......@@ -264,7 +264,7 @@ Subnet::addPool(const PoolPtr& pool) {
if (!inRange(first_addr) || !inRange(last_addr)) {
isc_throw(BadValue, "Pool (" << first_addr << "-" << last_addr
<< " does not belong in this (" << prefix_.toText() << "/"
<< " does not belong in this (" << prefix_ << "/"
<< static_cast<int>(prefix_len_) << ") subnet");
}
......@@ -331,7 +331,7 @@ Subnet6::Subnet6(const isc::asiolink::IOAddress& prefix, uint8_t length,
:Subnet(prefix, length, t1, t2, valid_lifetime),
preferred_(preferred_lifetime){
if (!prefix.isV6()) {
isc_throw(BadValue, "Non IPv6 prefix " << prefix.toText()
isc_throw(BadValue, "Non IPv6 prefix " << prefix
<< " specified in subnet6");
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment