BIND 10 #2396: Add IOAddress::toBytes()
BIND 10 Development
do-not-reply at isc.org
Thu Dec 6 11:21:00 UTC 2012
#2396: Add IOAddress::toBytes()
-------------------------------------+-------------------------------------
Reporter: stephen | Owner:
Type: enhancement | marcin
Priority: medium | Status:
Component: dhcp | reviewing
Keywords: | Milestone:
Sensitive: 0 | Sprint-DHCP-20121213
Sub-Project: DHCP | Resolution:
Estimated Difficulty: 0 | CVSS Scoring:
Total Hours: 0 | Defect Severity: N/A
| Feature Depending on Ticket:
| Add Hours to Ticket: 0
| Internal?: 0
-------------------------------------+-------------------------------------
Changes (by stephen):
* owner: stephen => marcin
Comment:
'''io_address.h'''
> The new IOAddress::isVx() functions "kind of" duplicate the
functionality of getFamily(). Are these new functions really necessary?
No, they aren't necessary. But virtually all the uses of
IOAddress::getFamily() in the DHCP code are of the form
{{{
if (address.getFamily() == AF_INET) {
}}}
i.e. not using the returned value of getFamily() for anything other than
checking whether an address is V4 or V6. Writing:
{{{
if (address.isV4()) {
}}}
is shorter and more clearly communicates that we are checking for a V4
address.
(Just an aside, IOAddress::getFamily() is implemented by constructing the
return value based on the result of asio::ip::address::is_v4(). So using
getFamily() to check whether an address is V4 of V6 ends up calling
asio::ip::address::is_v4() to determine a value which is then checked to
find out what asio::ip::address::is_v4() returned in the first place.)
The comment says that they are "convenience" methods - they just simplify
something that can be done in another way. But I'm not really worried one
way of the other - it seemed like a good idea based on the review of some
code I had previously been doing, but if you think they are really
unnecessary, they can be removed.
'''io_address_unittest.cc'''
> you should use ASSERT_EQ
Agreed and this has been changed. Since ASSERT_EQ will abandon the test
if there is an error, an ASSERT_EQ failure on the test of the V4 address
will prevent the check on V6 being run. I've therefore split the test
into two, one for V4 and one for V6.
Suggested !ChangeLog entry is
{{{
xxx. [func] stephen
Added IOAddress::toBytes() to get byte representation of address.
Also added convenience methods to for V4/V6 determination.
}}}
--
Ticket URL: <http://bind10.isc.org/ticket/2396#comment:6>
BIND 10 Development <http://bind10.isc.org>
BIND 10 Development
More information about the bind10-tickets
mailing list