/// @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);
///
/// 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)
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() :
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> pkt4o6(new Pkt4o6(buffer4_, pkt6_));
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()));
// 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 u_int8_t*>(
+ const uint8_t* cp = static_cast<const u_int8_t*>(
pkt4o6.getPkt6()->getBuffer().getData());
EXPECT_EQ(0, cp[4]);
EXPECT_EQ(D6O_DHCPV4_MSG, cp[5]);
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
}