1
0
mirror of https://github.com/mfontanini/libtins synced 2026-01-29 13:04:28 +01:00

Add remove_option member to IP, TCP, Dot11, ICMPv6, DHCP and DHCPv6

This commit is contained in:
Matias Fontanini
2015-08-17 15:19:03 -07:00
parent ab61907a06
commit 6dec68128d
19 changed files with 386 additions and 59 deletions

View File

@@ -276,7 +276,7 @@ TEST_F(DHCPTest, ConstructorFromBuffer) {
DHCP dhcp1(expected_packet, sizeof(expected_packet));
std::vector<IPv4Address> routers, expected_routers;
expected_routers.push_back("192.168.0.1");
expected_routers.push_back("127.0.0.1");
expected_routers.push_back("127.0.0.1");
EXPECT_EQ(dhcp1.opcode(), DHCP::DISCOVER);
EXPECT_EQ(dhcp1.htype(), 1);
@@ -305,4 +305,15 @@ TEST_F(DHCPTest, Serialize) {
test_equals(dhcp1, dhcp2);
}
TEST_F(DHCPTest, RemoveOption) {
DHCP dhcp;
PDU::serialization_type old_buffer = dhcp.serialize();
dhcp.domain_name("libtins.github.io");
dhcp.server_identifier("192.168.0.1");
EXPECT_TRUE(dhcp.remove_option(DHCP::DOMAIN_NAME));
EXPECT_TRUE(dhcp.remove_option(DHCP::DHCP_SERVER_IDENTIFIER));
PDU::serialization_type new_buffer = dhcp.serialize();
EXPECT_EQ(old_buffer, new_buffer);
}