srdusr
aboutsummaryrefslogtreecommitdiffstats
path: root/tests/test_summarize.cpp
diff options
context:
space:
mode:
authorsrdusr <[email protected]>2024-05-27 22:00:00 +0200
committersrdusr <[email protected]>2024-05-27 22:00:00 +0200
commitb565d7d9c47ca1ec5af0effd828431ee96027d60 (patch)
treefbe0c9c897e78f507443507354d5b1d8fb851099 /tests/test_summarize.cpp
parentfbedc55d5aa861c381701c9f913b34ee7ab57ec4 (diff)
downloadpacketeer-b565d7d9c47ca1ec5af0effd828431ee96027d60.tar.gz
packeteer-b565d7d9c47ca1ec5af0effd828431ee96027d60.zip
Rename project from wireframe to packeteer
Decided on the name after weighing alternatives in NAMES.md: packeteer (packet + -eer, "one who wields packets") fit the project's actual scope better than the wire/frame pun once it had grown into full L2-L7 dissection, reassembly, checksums, privilege dropping, and dual TUI/GUI frontends. No existing packet-capture project uses the name; the one real-world collision (Packeteer, Inc., a networking company acquired and folded into Blue Coat/Symantec by 2008) is long defunct. Mechanical rename throughout: CMake project/target names, the wireframe:: namespace and include/wireframe/ directory (git mv, history preserved), every #include path, CLI/GUI help text, and the project's own working directory. NAMES.md rewritten to record the decision instead of leaving stale self-referential etymology behind from the blind rename pass. Verified after every step: full rebuild (all four targets, no warnings) and the full test suite (128/128 cases, 366/366 assertions) both from a fresh reconfigure and again after the directory move.
Diffstat (limited to 'tests/test_summarize.cpp')
-rw-r--r--tests/test_summarize.cpp26
1 files changed, 13 insertions, 13 deletions
diff --git a/tests/test_summarize.cpp b/tests/test_summarize.cpp
index d10053d..ac6f1c0 100644
--- a/tests/test_summarize.cpp
+++ b/tests/test_summarize.cpp
@@ -4,7 +4,7 @@
#include <string_view>
#include <vector>
-#include "wireframe/summarize.hpp"
+#include "packeteer/summarize.hpp"
namespace {
@@ -28,7 +28,7 @@ std::vector<unsigned char> ethernet_ipv4_udp_dns_frame() {
std::vector<unsigned char> ip(20, 0);
ip[0] = 0x45;
ip[8] = 64; // ttl
- ip[9] = wireframe::net::kProtoUdp; // proto
+ ip[9] = packeteer::net::kProtoUdp; // proto
ip[12] = 10; ip[13] = 0; ip[14] = 0; ip[15] = 1; // src 10.0.0.1
ip[16] = 10; ip[17] = 0; ip[18] = 0; ip[19] = 2; // dst 10.0.0.2
@@ -62,7 +62,7 @@ std::vector<unsigned char> ethernet_ipv4_tcp_http_frame() {
std::vector<unsigned char> ip(20, 0);
ip[0] = 0x45;
ip[8] = 64; // ttl
- ip[9] = wireframe::net::kProtoTcp; // proto
+ ip[9] = packeteer::net::kProtoTcp; // proto
ip[12] = 10; ip[13] = 0; ip[14] = 0; ip[15] = 1; // src 10.0.0.1
ip[16] = 10; ip[17] = 0; ip[18] = 0; ip[19] = 2; // dst 10.0.0.2
@@ -91,7 +91,7 @@ std::vector<unsigned char> ethernet_ipv6_hopbyhop_tcp_frame() {
tcp[13] = 0x02; // SYN
std::vector<unsigned char> hop_by_hop = {
- static_cast<unsigned char>(wireframe::net::kProtoTcp),
+ static_cast<unsigned char>(packeteer::net::kProtoTcp),
0x00, // hdr_ext_len = 0 -> total length (0+1)*8 = 8 bytes
0, 0, 0, 0, 0, 0, // option padding
};
@@ -101,7 +101,7 @@ std::vector<unsigned char> ethernet_ipv6_hopbyhop_tcp_frame() {
std::uint16_t payload_len = static_cast<std::uint16_t>(hop_by_hop.size() + tcp.size());
ip6[4] = static_cast<unsigned char>(payload_len >> 8);
ip6[5] = static_cast<unsigned char>(payload_len & 0xFF);
- ip6[6] = wireframe::net::kNextHeaderHopByHop;
+ ip6[6] = packeteer::net::kNextHeaderHopByHop;
ip6[7] = 64; // hop_limit
ip6[23] = 0x01; // src = ::1
ip6[39] = 0x01; // dst = ::1
@@ -122,7 +122,7 @@ std::vector<unsigned char> ethernet_ipv6_hopbyhop_tcp_frame() {
} // namespace
TEST_CASE("summarize_packet walks a Hop-by-Hop extension header to reach TCP") {
- auto line = wireframe::summarize_packet(ethernet_ipv6_hopbyhop_tcp_frame(), DLT_EN10MB);
+ auto line = packeteer::summarize_packet(ethernet_ipv6_hopbyhop_tcp_frame(), DLT_EN10MB);
CHECK(line ==
"ETH aa:bb:cc:dd:ee:ff -> 11:22:33:44:55:66 ethertype=0x86dd"
" | IPv6 ::1 -> ::1 ttl=64 proto=6"
@@ -130,7 +130,7 @@ TEST_CASE("summarize_packet walks a Hop-by-Hop extension header to reach TCP") {
}
TEST_CASE("summarize_packet decodes a full Ethernet/IPv4/TCP/HTTP frame end to end") {
- auto line = wireframe::summarize_packet(ethernet_ipv4_tcp_http_frame(), DLT_EN10MB);
+ auto line = packeteer::summarize_packet(ethernet_ipv4_tcp_http_frame(), DLT_EN10MB);
CHECK(line ==
"ETH aa:bb:cc:dd:ee:ff -> 11:22:33:44:55:66 ethertype=0x0800"
" | IPv4 10.0.0.1 -> 10.0.0.2 ttl=64 proto=6"
@@ -139,7 +139,7 @@ TEST_CASE("summarize_packet decodes a full Ethernet/IPv4/TCP/HTTP frame end to e
}
TEST_CASE("summarize_packet decodes a full Ethernet/IPv4/UDP/DNS frame end to end") {
- auto line = wireframe::summarize_packet(ethernet_ipv4_udp_dns_frame(), DLT_EN10MB);
+ auto line = packeteer::summarize_packet(ethernet_ipv4_udp_dns_frame(), DLT_EN10MB);
CHECK(line ==
"ETH aa:bb:cc:dd:ee:ff -> 11:22:33:44:55:66 ethertype=0x0800"
" | IPv4 10.0.0.1 -> 10.0.0.2 ttl=64 proto=17"
@@ -149,9 +149,9 @@ TEST_CASE("summarize_packet decodes a full Ethernet/IPv4/UDP/DNS frame end to en
TEST_CASE("summarize_packet on DLT_RAW skips the Ethernet line entirely") {
auto frame = ethernet_ipv4_udp_dns_frame();
- std::vector<unsigned char> raw(frame.begin() + wireframe::net::kEthernetHeaderLen, frame.end());
+ std::vector<unsigned char> raw(frame.begin() + packeteer::net::kEthernetHeaderLen, frame.end());
- auto line = wireframe::summarize_packet(raw, DLT_RAW);
+ auto line = packeteer::summarize_packet(raw, DLT_RAW);
CHECK(line.substr(0, 3) == "RAW");
CHECK(line.find("ETH") == std::string::npos);
CHECK(line.find("IPv4 10.0.0.1 -> 10.0.0.2") != std::string::npos);
@@ -159,7 +159,7 @@ TEST_CASE("summarize_packet on DLT_RAW skips the Ethernet line entirely") {
TEST_CASE("summarize_packet reports a truncated Ethernet frame without decoding further") {
std::vector<unsigned char> bytes(10, 0); // shorter than the 14-byte header
- auto line = wireframe::summarize_packet(bytes, DLT_EN10MB);
+ auto line = packeteer::summarize_packet(bytes, DLT_EN10MB);
CHECK(line == "[10 bytes] truncated ethernet frame");
}
@@ -168,7 +168,7 @@ TEST_CASE("summarize_packet stops after the Ethernet line for a non-IP ethertype
0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF,
0x08, 0x06, // ARP, not IPv4/IPv6
};
- auto line = wireframe::summarize_packet(bytes, DLT_EN10MB);
+ auto line = packeteer::summarize_packet(bytes, DLT_EN10MB);
CHECK(line == "ETH aa:bb:cc:dd:ee:ff -> 11:22:33:44:55:66 ethertype=0x0806");
}
@@ -176,7 +176,7 @@ TEST_CASE("hex_dump_lines produces one line per 16 bytes, with the right byte co
std::vector<unsigned char> bytes(20, 0);
for (std::size_t i = 0; i < bytes.size(); ++i) bytes[i] = static_cast<unsigned char>(i);
- auto lines = wireframe::hex_dump_lines(bytes);
+ auto lines = packeteer::hex_dump_lines(bytes);
REQUIRE(lines.size() == 2);
CHECK(lines[0].substr(0, 6) == "000000");
CHECK(lines[1].substr(0, 6) == "000010");