srdusr
aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/test_byteio.cpp4
-rw-r--r--tests/test_capture_queue.cpp4
-rw-r--r--tests/test_capture_session.cpp8
-rw-r--r--tests/test_checksum.cpp4
-rw-r--r--tests/test_dns.cpp4
-rw-r--r--tests/test_filter.cpp12
-rw-r--r--tests/test_http.cpp8
-rw-r--r--tests/test_icmp.cpp4
-rw-r--r--tests/test_ipv6.cpp6
-rw-r--r--tests/test_mdns.cpp4
-rw-r--r--tests/test_net.cpp10
-rw-r--r--tests/test_pcapng.cpp6
-rw-r--r--tests/test_privileges.cpp4
-rw-r--r--tests/test_search.cpp4
-rw-r--r--tests/test_ssh.cpp4
-rw-r--r--tests/test_summarize.cpp26
-rw-r--r--tests/test_tcp_reassembly.cpp8
-rw-r--r--tests/test_tls.cpp8
18 files changed, 64 insertions, 64 deletions
diff --git a/tests/test_byteio.cpp b/tests/test_byteio.cpp
index 81fa741..3b31752 100644
--- a/tests/test_byteio.cpp
+++ b/tests/test_byteio.cpp
@@ -2,9 +2,9 @@
#include <vector>
-#include "wireframe/byteio.hpp"
+#include "packeteer/byteio.hpp"
-using namespace wireframe;
+using namespace packeteer;
TEST_CASE("read_be16 reads a big-endian 16-bit value") {
std::vector<unsigned char> bytes = {0x12, 0x34};
diff --git a/tests/test_capture_queue.cpp b/tests/test_capture_queue.cpp
index da2da28..7d56fe0 100644
--- a/tests/test_capture_queue.cpp
+++ b/tests/test_capture_queue.cpp
@@ -4,9 +4,9 @@
#include <chrono>
#include <thread>
-#include "wireframe/capture_queue.hpp"
+#include "packeteer/capture_queue.hpp"
-using namespace wireframe;
+using namespace packeteer;
TEST_CASE("try_push/pop returns packets in FIFO order") {
CaptureQueue queue(4);
diff --git a/tests/test_capture_session.cpp b/tests/test_capture_session.cpp
index 691131a..dc5f424 100644
--- a/tests/test_capture_session.cpp
+++ b/tests/test_capture_session.cpp
@@ -6,10 +6,10 @@
#include <string>
#include <vector>
-#include "wireframe/capture_session.hpp"
-#include "wireframe/pcapng/writer.hpp"
+#include "packeteer/capture_session.hpp"
+#include "packeteer/pcapng/writer.hpp"
-using namespace wireframe;
+using namespace packeteer;
namespace {
@@ -20,7 +20,7 @@ struct TempPcapngFile {
std::string path;
explicit TempPcapngFile(int link_type, const std::vector<std::vector<unsigned char>>& packets) {
- char path_template[] = "/tmp/wireframe_test_XXXXXX";
+ char path_template[] = "/tmp/packeteer_test_XXXXXX";
int fd = mkstemp(path_template);
REQUIRE(fd != -1);
path = path_template;
diff --git a/tests/test_checksum.cpp b/tests/test_checksum.cpp
index 1295499..5ebaea6 100644
--- a/tests/test_checksum.cpp
+++ b/tests/test_checksum.cpp
@@ -2,9 +2,9 @@
#include <vector>
-#include "wireframe/net/checksum.hpp"
+#include "packeteer/net/checksum.hpp"
-using namespace wireframe::net;
+using namespace packeteer::net;
namespace {
diff --git a/tests/test_dns.cpp b/tests/test_dns.cpp
index 9a389bb..db5de56 100644
--- a/tests/test_dns.cpp
+++ b/tests/test_dns.cpp
@@ -2,9 +2,9 @@
#include <vector>
-#include "wireframe/l7/dns.hpp"
+#include "packeteer/l7/dns.hpp"
-using namespace wireframe::net;
+using namespace packeteer::net;
namespace {
diff --git a/tests/test_filter.cpp b/tests/test_filter.cpp
index 1dd9373..9a0ca69 100644
--- a/tests/test_filter.cpp
+++ b/tests/test_filter.cpp
@@ -1,7 +1,7 @@
#include <doctest/doctest.h>
#include <pcap.h>
-#include "wireframe/filter.hpp"
+#include "packeteer/filter.hpp"
namespace {
@@ -23,7 +23,7 @@ TEST_CASE("compile_filter accepts a valid tcpdump-style expression") {
REQUIRE(dead.handle != nullptr);
bpf_program prog{};
- auto err = wireframe::compile_filter(dead.handle, "tcp port 80", &prog);
+ auto err = packeteer::compile_filter(dead.handle, "tcp port 80", &prog);
CHECK_FALSE(err.has_value());
pcap_freecode(&prog);
}
@@ -33,7 +33,7 @@ TEST_CASE("compile_filter accepts a compound expression") {
REQUIRE(dead.handle != nullptr);
bpf_program prog{};
- auto err = wireframe::compile_filter(dead.handle, "host 10.0.0.1 and not icmp", &prog);
+ auto err = packeteer::compile_filter(dead.handle, "host 10.0.0.1 and not icmp", &prog);
CHECK_FALSE(err.has_value());
pcap_freecode(&prog);
}
@@ -43,7 +43,7 @@ TEST_CASE("compile_filter rejects invalid syntax with an error message") {
REQUIRE(dead.handle != nullptr);
bpf_program prog{};
- auto err = wireframe::compile_filter(dead.handle, "this is not a valid filter !!", &prog);
+ auto err = packeteer::compile_filter(dead.handle, "this is not a valid filter !!", &prog);
REQUIRE(err.has_value());
CHECK_FALSE(err->empty());
}
@@ -53,7 +53,7 @@ TEST_CASE("compile_filter works against DLT_RAW, not just Ethernet") {
REQUIRE(dead.handle != nullptr);
bpf_program prog{};
- auto err = wireframe::compile_filter(dead.handle, "udp", &prog);
+ auto err = packeteer::compile_filter(dead.handle, "udp", &prog);
CHECK_FALSE(err.has_value());
pcap_freecode(&prog);
}
@@ -64,6 +64,6 @@ TEST_CASE("compile_filter rejects an Ethernet-only expression against DLT_RAW")
bpf_program prog{};
// "ether" primitives are meaningless without a link-layer header.
- auto err = wireframe::compile_filter(dead.handle, "ether host 00:11:22:33:44:55", &prog);
+ auto err = packeteer::compile_filter(dead.handle, "ether host 00:11:22:33:44:55", &prog);
CHECK(err.has_value());
}
diff --git a/tests/test_http.cpp b/tests/test_http.cpp
index 7ccc9ff..2fb532d 100644
--- a/tests/test_http.cpp
+++ b/tests/test_http.cpp
@@ -2,9 +2,9 @@
#include <vector>
-#include "wireframe/l7/http.hpp"
+#include "packeteer/l7/http.hpp"
-using namespace wireframe::net;
+using namespace packeteer::net;
namespace {
@@ -69,10 +69,10 @@ TEST_CASE("HttpDissector claims port 80 and its summary matches parse_http") {
HttpDissector dissector;
CHECK(dissector.port() == kHttpPort);
- auto bytes = to_bytes("GET /path HTTP/1.1\r\nHost: wireframe.test\r\n\r\n");
+ auto bytes = to_bytes("GET /path HTTP/1.1\r\nHost: packeteer.test\r\n\r\n");
auto summary = dissector.summarize(bytes);
REQUIRE(summary.has_value());
CHECK(summary->substr(0, 4) == "HTTP");
CHECK(summary->find("GET /path") != std::string::npos);
- CHECK(summary->find("wireframe.test") != std::string::npos);
+ CHECK(summary->find("packeteer.test") != std::string::npos);
}
diff --git a/tests/test_icmp.cpp b/tests/test_icmp.cpp
index 3dd713e..520e12d 100644
--- a/tests/test_icmp.cpp
+++ b/tests/test_icmp.cpp
@@ -2,9 +2,9 @@
#include <vector>
-#include "wireframe/net/icmp.hpp"
+#include "packeteer/net/icmp.hpp"
-using namespace wireframe::net;
+using namespace packeteer::net;
TEST_CASE("parse_icmpv4 decodes an echo request with identifier/sequence") {
std::vector<unsigned char> bytes = {8, 0, 0x00, 0x00, 0x1c, 0x05, 0x00, 0x01};
diff --git a/tests/test_ipv6.cpp b/tests/test_ipv6.cpp
index 438fadc..1cce85b 100644
--- a/tests/test_ipv6.cpp
+++ b/tests/test_ipv6.cpp
@@ -2,10 +2,10 @@
#include <vector>
-#include "wireframe/net/ipv4.hpp" // for kProtoTcp
-#include "wireframe/net/ipv6.hpp"
+#include "packeteer/net/ipv4.hpp" // for kProtoTcp
+#include "packeteer/net/ipv6.hpp"
-using namespace wireframe::net;
+using namespace packeteer::net;
namespace {
diff --git a/tests/test_mdns.cpp b/tests/test_mdns.cpp
index cad77e7..b095fd7 100644
--- a/tests/test_mdns.cpp
+++ b/tests/test_mdns.cpp
@@ -2,9 +2,9 @@
#include <vector>
-#include "wireframe/l7/mdns.hpp"
+#include "packeteer/l7/mdns.hpp"
-using namespace wireframe::net;
+using namespace packeteer::net;
namespace {
diff --git a/tests/test_net.cpp b/tests/test_net.cpp
index 09de9b0..19667da 100644
--- a/tests/test_net.cpp
+++ b/tests/test_net.cpp
@@ -2,12 +2,12 @@
#include <vector>
-#include "wireframe/net/ethernet.hpp"
-#include "wireframe/net/ipv4.hpp"
-#include "wireframe/net/tcp.hpp"
-#include "wireframe/net/udp.hpp"
+#include "packeteer/net/ethernet.hpp"
+#include "packeteer/net/ipv4.hpp"
+#include "packeteer/net/tcp.hpp"
+#include "packeteer/net/udp.hpp"
-using namespace wireframe::net;
+using namespace packeteer::net;
TEST_CASE("parse_ethernet decodes header fields and leaves the right payload") {
std::vector<unsigned char> bytes = {
diff --git a/tests/test_pcapng.cpp b/tests/test_pcapng.cpp
index f292d32..aa94167 100644
--- a/tests/test_pcapng.cpp
+++ b/tests/test_pcapng.cpp
@@ -3,10 +3,10 @@
#include <cstdio>
#include <vector>
-#include "wireframe/pcapng/reader.hpp"
-#include "wireframe/pcapng/writer.hpp"
+#include "packeteer/pcapng/reader.hpp"
+#include "packeteer/pcapng/writer.hpp"
-using namespace wireframe::pcapng;
+using namespace packeteer::pcapng;
TEST_CASE("pcapng writer/reader round-trip a single packet") {
std::FILE* f = std::tmpfile();
diff --git a/tests/test_privileges.cpp b/tests/test_privileges.cpp
index 287d654..99951b8 100644
--- a/tests/test_privileges.cpp
+++ b/tests/test_privileges.cpp
@@ -1,7 +1,7 @@
#include <doctest/doctest.h>
#include <unistd.h>
-#include "wireframe/privileges.hpp"
+#include "packeteer/privileges.hpp"
// The actual drop sequence (setuid/setgid) can only be meaningfully
// exercised by literally running as root, which a unit test shouldn't
@@ -14,5 +14,5 @@
// touch privileges it doesn't have.
TEST_CASE("drop_privileges_if_root is a no-op when not running as root") {
if (geteuid() == 0) return; // this test only makes sense unprivileged
- CHECK_FALSE(wireframe::drop_privileges_if_root().has_value());
+ CHECK_FALSE(packeteer::drop_privileges_if_root().has_value());
}
diff --git a/tests/test_search.cpp b/tests/test_search.cpp
index ed687e0..f1c7580 100644
--- a/tests/test_search.cpp
+++ b/tests/test_search.cpp
@@ -1,8 +1,8 @@
#include <doctest/doctest.h>
-#include "wireframe/search.hpp"
+#include "packeteer/search.hpp"
-using namespace wireframe;
+using namespace packeteer;
TEST_CASE("matches_search finds a substring") {
CHECK(matches_search("IPv4 10.0.0.1 -> 10.0.0.2 proto=6", "10.0.0.2"));
diff --git a/tests/test_ssh.cpp b/tests/test_ssh.cpp
index 7c4e339..7201c0e 100644
--- a/tests/test_ssh.cpp
+++ b/tests/test_ssh.cpp
@@ -2,9 +2,9 @@
#include <vector>
-#include "wireframe/l7/ssh.hpp"
+#include "packeteer/l7/ssh.hpp"
-using namespace wireframe::net;
+using namespace packeteer::net;
namespace {
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");
diff --git a/tests/test_tcp_reassembly.cpp b/tests/test_tcp_reassembly.cpp
index b424610..192f12b 100644
--- a/tests/test_tcp_reassembly.cpp
+++ b/tests/test_tcp_reassembly.cpp
@@ -3,11 +3,11 @@
#include <string>
#include <vector>
-#include "wireframe/l7/http.hpp"
-#include "wireframe/net/tcp.hpp"
-#include "wireframe/net/tcp_reassembly.hpp"
+#include "packeteer/l7/http.hpp"
+#include "packeteer/net/tcp.hpp"
+#include "packeteer/net/tcp_reassembly.hpp"
-using namespace wireframe::net;
+using namespace packeteer::net;
namespace {
diff --git a/tests/test_tls.cpp b/tests/test_tls.cpp
index 65784a9..7a3ad27 100644
--- a/tests/test_tls.cpp
+++ b/tests/test_tls.cpp
@@ -2,9 +2,9 @@
#include <vector>
-#include "wireframe/l7/tls.hpp"
+#include "packeteer/l7/tls.hpp"
-using namespace wireframe::net;
+using namespace packeteer::net;
namespace {
@@ -124,9 +124,9 @@ TEST_CASE("TlsSniDissector claims port 443 and its summary matches parse_tls_cli
TlsSniDissector dissector;
CHECK(dissector.port() == kTlsPort);
- auto record = build_client_hello("wireframe.test");
+ auto record = build_client_hello("packeteer.test");
auto summary = dissector.summarize(record);
REQUIRE(summary.has_value());
CHECK(summary->substr(0, 3) == "TLS");
- CHECK(summary->find("SNI=wireframe.test") != std::string::npos);
+ CHECK(summary->find("SNI=packeteer.test") != std::string::npos);
}