This repository has been archived on 2025-09-14. You can view files and clone it, but cannot push or open issues or pull requests.
Files
stellar-stellar/test/gtest_inject_tcp_rst.cpp
2024-05-15 14:48:15 +08:00

40 lines
1.3 KiB
C++

#include <gtest/gtest.h>
#include "packet_injector_test_frame.h"
TEST(INJECT_IPV4_BASED_TCP_RST, AFTER_RECV_SYN_ACK)
{
struct packet_injector_case test = {
// descriptor
.finish_clean_work_dir = 1,
.descriptor = "Inject IPv4 based TCP RST after receiving SYN-ACK packet.",
.work_dir = "/tmp/inject_ipv4_based_tcp_rst_after_recv_syn_ack/", // user defined work directory
// prefix
.input_prefix = "pcap/inject_ipv4_based_tcp_rst_after_recv_syn_ack/test/",
.output_prefix = "/tmp/",
// input pcap
.input_pcap = "input.pcap",
// compare
.c2s_expect_pcap = "expect-192.0.2.211:59942-192.0.2.110:80-1.pcap",
.c2s_output_pcap = "inject-192.0.2.211:59942-192.0.2.110:80-1.pcap",
.s2c_expect_pcap = "expect-192.0.2.110:80-192.0.2.211:59942-2.pcap",
.s2c_output_pcap = "inject-192.0.2.110:80-192.0.2.211:59942-2.pcap",
// packet injector command
.packet_injector_cmd = "./packet_injector -t tcp-rst -c s2c-packet -n 1",
.diff_skip_pattern = "-I frame.time -I frame.time_epoch -I ip.id -I ip.ttl -I ip.checksum -I tcp.checksum -I tcp.window_size",
};
packet_injector_test_frame_run(&test);
}
int main(int argc, char **argv)
{
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}