Browse Source

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

Marcin Siodelski 11 years ago
parent
commit
1d1e8b67f6

+ 2 - 3
src/bin/d2/d2_cfg_mgr.cc

@@ -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.

+ 2 - 2
src/lib/dhcp/iface_mgr.cc

@@ -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);
             }
 

+ 3 - 3
src/lib/dhcp/option6_addrlst.cc

@@ -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();
 }

+ 1 - 1
src/lib/dhcp/option6_iaprefix.cc

@@ -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;
 

+ 2 - 2
src/lib/dhcp/tests/iface_mgr_unittest.cc

@@ -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;
             }
         }

+ 1 - 1
src/lib/dhcpsrv/alloc_engine.cc

@@ -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.

+ 4 - 4
src/lib/dhcpsrv/subnet.cc

@@ -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");
     }
 }