mirror of
https://github.com/mfontanini/libtins
synced 2026-01-27 12:14:26 +01:00
Removed the useless PDU::flag member. Added a PDU concatenation operator.
This commit is contained in:
@@ -3,6 +3,9 @@
|
||||
#include <string>
|
||||
#include <stdint.h>
|
||||
#include "ip.h"
|
||||
#include "tcp.h"
|
||||
#include "udp.h"
|
||||
#include "icmp.h"
|
||||
#include "ip_address.h"
|
||||
#include "utils.h"
|
||||
|
||||
@@ -238,3 +241,17 @@ TEST_F(IPTest, Serialize) {
|
||||
ASSERT_EQ(buffer.size(), sizeof(expected_packet));
|
||||
EXPECT_TRUE(std::equal(buffer.begin(), buffer.end(), expected_packet));
|
||||
}
|
||||
|
||||
TEST_F(IPTest, StackedProtocols) {
|
||||
IP ip = IP() / TCP();
|
||||
IP::serialization_type buffer = ip.serialize();
|
||||
EXPECT_TRUE(IP(&buffer[0], buffer.size()).find_pdu<TCP>());
|
||||
|
||||
ip = IP() / UDP();
|
||||
buffer = ip.serialize();
|
||||
EXPECT_TRUE(IP(&buffer[0], buffer.size()).find_pdu<UDP>());
|
||||
|
||||
ip = IP() / ICMP();
|
||||
buffer = ip.serialize();
|
||||
EXPECT_TRUE(IP(&buffer[0], buffer.size()).find_pdu<ICMP>());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user