Commit fab53a07 authored by Stephen Morris's avatar Stephen Morris
Browse files

[1486] Rename IOAddress::from_bytes() to IOAddress::fromBytes()

... to conform to coding standards.
parent 504f64b2
......@@ -61,7 +61,7 @@ IOAddress::toText() const {
}
IOAddress
IOAddress::from_bytes(short family, const uint8_t* data) {
IOAddress::fromBytes(short family, const uint8_t* data) {
if (data == NULL) {
isc_throw(BadValue, "NULL pointer received.");
} else
......
......@@ -111,7 +111,7 @@ public:
///
/// \return Created IOAddress object
static IOAddress
from_bytes(short family, const uint8_t* data);
fromBytes(short family, const uint8_t* data);
/// \brief Compare addresses for equality
///
......
......@@ -64,7 +64,7 @@ TEST(IOAddressTest, Family) {
EXPECT_EQ(AF_INET6, IOAddress("2001:0DB8:0:0::0012").getFamily());
}
TEST(IOAddressTest, from_bytes) {
TEST(IOAddressTest, fromBytes) {
// 2001:db8:1::dead:beef
uint8_t v6[] = {
0x20, 0x01, 0x0d, 0xb8, 0x00, 0x01, 0, 0,
......@@ -74,12 +74,12 @@ TEST(IOAddressTest, from_bytes) {
IOAddress addr("::");
EXPECT_NO_THROW({
addr = IOAddress::from_bytes(AF_INET6, v6);
addr = IOAddress::fromBytes(AF_INET6, v6);
});
EXPECT_EQ("2001:db8:1::dead:beef", addr.toText());
EXPECT_NO_THROW({
addr = IOAddress::from_bytes(AF_INET, v4);
addr = IOAddress::fromBytes(AF_INET, v4);
});
EXPECT_EQ(addr.toText(), IOAddress("192.0.2.3").toText());
}
......
......@@ -1098,9 +1098,9 @@ Pkt6Ptr IfaceMgr::receive6(uint32_t timeout_sec, uint32_t timeout_usec /* = 0 */
pkt->updateTimestamp();
pkt->setLocalAddr(IOAddress::from_bytes(AF_INET6,
pkt->setLocalAddr(IOAddress::fromBytes(AF_INET6,
reinterpret_cast<const uint8_t*>(&to_addr)));
pkt->setRemoteAddr(IOAddress::from_bytes(AF_INET6,
pkt->setRemoteAddr(IOAddress::fromBytes(AF_INET6,
reinterpret_cast<const uint8_t*>(&from.sin6_addr)));
pkt->setRemotePort(ntohs(from.sin6_port));
pkt->setIndex(ifindex);
......
......@@ -302,7 +302,7 @@ void Netlink::ipaddrs_get(IfaceMgr::Iface& iface, NetlinkMessages& addr_info) {
memcpy(addr, RTA_DATA(rta_tb[IFLA_ADDRESS]),
ifa->ifa_family==AF_INET?V4ADDRESS_LEN:V6ADDRESS_LEN);
IOAddress a = IOAddress::from_bytes(ifa->ifa_family, addr);
IOAddress a = IOAddress::fromBytes(ifa->ifa_family, addr);
iface.addAddress(a);
/// TODO: Read lifetimes of configured IPv6 addresses
......
......@@ -84,7 +84,7 @@ void Option6AddrLst::unpack(OptionBufferConstIter begin,
<< " is not divisible by 16.");
}
while (begin != end) {
addrs_.push_back(IOAddress::from_bytes(AF_INET6, &(*begin)));
addrs_.push_back(IOAddress::fromBytes(AF_INET6, &(*begin)));
begin += V6ADDRESS_LEN;
}
}
......
......@@ -69,7 +69,7 @@ void Option6IAAddr::unpack(OptionBuffer::const_iterator begin,
}
// 16 bytes: IPv6 address
addr_ = IOAddress::from_bytes(AF_INET6, &(*begin));
addr_ = IOAddress::fromBytes(AF_INET6, &(*begin));
begin += V6ADDRESS_LEN;
preferred_ = readUint32( &(*begin) );
......
......@@ -79,7 +79,7 @@ isc::asiolink::IOAddress firstAddrInPrefix6(const isc::asiolink::IOAddress& pref
}
// Finally, let's wrap this into nice and easy IOAddress object.
return (isc::asiolink::IOAddress::from_bytes(AF_INET6, packed));
return (isc::asiolink::IOAddress::fromBytes(AF_INET6, packed));
}
/// @brief calculates the first IPv4 address in a IPv4 prefix
......@@ -159,7 +159,7 @@ isc::asiolink::IOAddress lastAddrInPrefix6(const isc::asiolink::IOAddress& prefi
}
// Finally, let's wrap this into nice and easy IOAddress object.
return (isc::asiolink::IOAddress::from_bytes(AF_INET6, packed));
return (isc::asiolink::IOAddress::fromBytes(AF_INET6, packed));
}
}; // end of anonymous namespace
......
......@@ -51,7 +51,7 @@ AllocEngine::IterativeAllocator::increaseAddress(const isc::asiolink::IOAddress&
}
}
return (IOAddress::from_bytes(addr.getFamily(), packed));
return (IOAddress::fromBytes(addr.getFamily(), packed));
}
......
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