From b8b57816c2a31d220ef23efde9b29244f1bca24d Mon Sep 17 00:00:00 2001 From: Tomek Mrugalski Date: Sat, 31 Oct 2015 18:49:07 +0900 Subject: [PATCH] [4027] Minor corrections. --- src/lib/dhcp/pkt4o6.h | 6 +++--- src/lib/dhcp/tests/pkt4o6_unittest.cc | 10 +++++++++- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/lib/dhcp/pkt4o6.h b/src/lib/dhcp/pkt4o6.h index 70bf6496b2..e767a69047 100644 --- a/src/lib/dhcp/pkt4o6.h +++ b/src/lib/dhcp/pkt4o6.h @@ -34,7 +34,7 @@ public: /// @brief Constructor, used in message reception. /// - /// @param pkt4 DHCPv4 message + /// @param pkt4 Content of the DHCPv4-message option /// @param pkt6 encapsulating unpacked DHCPv6 message /// the DHCPv4 message option will be removed Pkt4o6(const OptionBuffer& pkt4, const Pkt6Ptr& pkt6); @@ -52,10 +52,10 @@ public: /// /// Calls pack() on both DHCPv4 and DHCPv6 parts /// Inserts the DHCPv4-message option - /// @ref pkt4::pack and @ref pkt6::pack + /// @ref Pkt4::pack and @ref Pkt6::pack virtual void pack(); - /// @brief Checks if a DHCPv4 message has beeb transported over DHCPv6 + /// @brief Checks if a DHCPv4 message has been transported over DHCPv6 /// /// @return Boolean value which indicates whether the message is /// transported over DHCPv6 (true) or native DHCPv4 (false) diff --git a/src/lib/dhcp/tests/pkt4o6_unittest.cc b/src/lib/dhcp/tests/pkt4o6_unittest.cc index 4d178b1530..e25c6fa48d 100644 --- a/src/lib/dhcp/tests/pkt4o6_unittest.cc +++ b/src/lib/dhcp/tests/pkt4o6_unittest.cc @@ -27,6 +27,9 @@ using namespace isc::dhcp; namespace { + +/// @brief A Fixture class dedicated to testing of the Pkt4o6 class that +/// represents a DHCPv4-over-DHCPv6 packet. class Pkt4o6Test : public ::testing::Test { protected: Pkt4o6Test() : @@ -48,6 +51,7 @@ protected: OptionBuffer buffer4_; // wire-format data buffer of pkt4_ }; +// This test verifies that the constructors are working as expected. TEST_F(Pkt4o6Test, construct) { // Construct 4o6 packet, unpack the data to examine it boost::scoped_ptr pkt4o6(new Pkt4o6(buffer4_, pkt6_)); @@ -68,6 +72,8 @@ TEST_F(Pkt4o6Test, construct) { EXPECT_EQ(DHCPDISCOVER, pkt4o6->getType()); } +// This test verifies that the pack() method handles the building +// process correctly. TEST_F(Pkt4o6Test, pack) { // prepare unpacked DHCPv4 packet (see the note in constructor test) pkt4_.reset(new Pkt4(&buffer4_[0], buffer4_.size())); @@ -86,7 +92,7 @@ TEST_F(Pkt4o6Test, pack) { // Check the DHCPv4 message option content (Pkt4o6 class is not responsible // for making it valid, so we won't examine it) - const u_int8_t* cp = static_cast( + const uint8_t* cp = static_cast( pkt4o6.getPkt6()->getBuffer().getData()); EXPECT_EQ(0, cp[4]); EXPECT_EQ(D6O_DHCPV4_MSG, cp[5]); @@ -95,4 +101,6 @@ TEST_F(Pkt4o6Test, pack) { EXPECT_EQ(0, memcmp(&cp[8], &buffer4_[0], buffer4_.size())); } +/// @todo: Add a test that handles actual DHCP4o6 traffic capture +/// once we get it. We should add the capture to pkt_captures{4,6}.cc } -- 2.47.2