diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/afpacket_capture.cpp | 10 | ||||
| -rw-r--r-- | src/gui_main.cpp | 40 | ||||
| -rw-r--r-- | src/main.cpp | 56 |
3 files changed, 53 insertions, 53 deletions
diff --git a/src/afpacket_capture.cpp b/src/afpacket_capture.cpp index 877bc88..0b5696f 100644 --- a/src/afpacket_capture.cpp +++ b/src/afpacket_capture.cpp @@ -36,8 +36,8 @@ #include <cstring> #include <span> -#include "wireframe/privileges.hpp" -#include "wireframe/summarize.hpp" +#include "packeteer/privileges.hpp" +#include "packeteer/summarize.hpp" namespace { @@ -130,8 +130,8 @@ int main(int argc, char** argv) { // Everything CAP_NET_RAW was needed for is done: socket created, // ring mapped, bound to the interface. Same drop-after-open - // principle as CaptureSession (wireframe/privileges.hpp). - if (auto err = wireframe::drop_privileges_if_root()) { + // principle as CaptureSession (packeteer/privileges.hpp). + if (auto err = packeteer::drop_privileges_if_root()) { std::fprintf(stderr, "failed to drop privileges: %s\n", err->c_str()); munmap(ring, ring_size); close(sock); @@ -171,7 +171,7 @@ int main(int argc, char** argv) { reinterpret_cast<const unsigned char*>(header) + header->tp_mac; std::span<const unsigned char> bytes(packet_start, header->tp_snaplen); - std::printf("%s\n", wireframe::summarize_packet(bytes, DLT_EN10MB).c_str()); + std::printf("%s\n", packeteer::summarize_packet(bytes, DLT_EN10MB).c_str()); std::fflush(stdout); // Hand the slot back to the kernel so it can reuse it for a diff --git a/src/gui_main.cpp b/src/gui_main.cpp index 8a7771a..49f40dc 100644 --- a/src/gui_main.cpp +++ b/src/gui_main.cpp @@ -1,6 +1,6 @@ // GUI frontend (secondary to the TUI - see PLAN.md Decisions). Same // capture/decode/filter/pcapng pipeline as main.cpp's CLI/TUI modes, -// via wireframe::CaptureSession - not a hand-copied setup path, so it +// via packeteer::CaptureSession - not a hand-copied setup path, so it // can't drift on datalink validation, filter errors, or the // pcap_breakloop() shutdown hook the way two independent // implementations eventually would. @@ -22,11 +22,11 @@ #include <string> #include <thread> -#include "wireframe/capture_session.hpp" -#include "wireframe/net/tcp_reassembly.hpp" -#include "wireframe/packet_diagnostics.hpp" -#include "wireframe/search.hpp" -#include "wireframe/summarize.hpp" +#include "packeteer/capture_session.hpp" +#include "packeteer/net/tcp_reassembly.hpp" +#include "packeteer/packet_diagnostics.hpp" +#include "packeteer/search.hpp" +#include "packeteer/summarize.hpp" namespace { @@ -58,11 +58,11 @@ struct SharedState { std::atomic<bool> capture_alive{true}; }; -void consumer_loop(wireframe::CaptureSession& session, wireframe::CaptureQueue& queue, - SharedState& state, wireframe::net::TcpReassembler* reassembler) { +void consumer_loop(packeteer::CaptureSession& session, packeteer::CaptureQueue& queue, + SharedState& state, packeteer::net::TcpReassembler* reassembler) { while (auto packet = queue.pop()) { std::span<const unsigned char> bytes{packet->data}; - std::string summary = wireframe::summarize_packet(bytes, session.datalink()); + std::string summary = packeteer::summarize_packet(bytes, session.datalink()); if (auto* writer = session.pcapng_writer()) { writer->write_packet(/*interface_id=*/0, packet->ts_sec, packet->ts_usec, bytes, @@ -71,7 +71,7 @@ void consumer_loop(wireframe::CaptureSession& session, wireframe::CaptureQueue& std::optional<std::string> reassembled_http; if (reassembler) { - reassembled_http = wireframe::reassembled_http_status(bytes, session.datalink(), + reassembled_http = packeteer::reassembled_http_status(bytes, session.datalink(), *reassembler); } @@ -91,7 +91,7 @@ void consumer_loop(wireframe::CaptureSession& session, wireframe::CaptureQueue& void print_usage(const char* argv0) { std::printf( - "wireframe - terminal packet capture and analysis tool (GUI)\n" + "packeteer - terminal packet capture and analysis tool (GUI)\n" "\n" "Usage: %s [options] [interface]\n" "\n" @@ -127,7 +127,7 @@ int main(int argc, char** argv) { } } - wireframe::CaptureSessionOptions options; + packeteer::CaptureSessionOptions options; bool enable_checksums = false; bool enable_reassembly = false; for (int i = 1; i < argc; ++i) { @@ -146,7 +146,7 @@ int main(int argc, char** argv) { } } - wireframe::CaptureSession session; + packeteer::CaptureSession session; if (auto err = session.open(options)) { std::fprintf(stderr, "%s\n", err->c_str()); return 1; @@ -159,7 +159,7 @@ int main(int argc, char** argv) { } SDL_Window* window = - SDL_CreateWindow("wireframe", 1000, 650, SDL_WINDOW_RESIZABLE | SDL_WINDOW_HIDDEN); + SDL_CreateWindow("packeteer", 1000, 650, SDL_WINDOW_RESIZABLE | SDL_WINDOW_HIDDEN); if (window == nullptr) { std::fprintf(stderr, "SDL_CreateWindow failed: %s\n", SDL_GetError()); SDL_Quit(); @@ -181,9 +181,9 @@ int main(int argc, char** argv) { ImGui_ImplSDL3_InitForSDLRenderer(window, renderer); ImGui_ImplSDLRenderer3_Init(renderer); - wireframe::CaptureQueue queue(4096); + packeteer::CaptureQueue queue(4096); SharedState state; - wireframe::net::TcpReassembler reassembler; + packeteer::net::TcpReassembler reassembler; std::thread capture_thread = session.start_capture_thread(queue); std::thread consumer_thread(consumer_loop, std::ref(session), std::ref(queue), std::ref(state), enable_reassembly ? &reassembler : nullptr); @@ -219,7 +219,7 @@ int main(int argc, char** argv) { ImGui::SetNextWindowPos(ImVec2(0, 0)); ImGui::SetNextWindowSize(io.DisplaySize); - ImGui::Begin("wireframe", nullptr, + ImGui::Begin("packeteer", nullptr, ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoCollapse); @@ -246,7 +246,7 @@ int main(int argc, char** argv) { { std::lock_guard<std::mutex> lock(state.mutex); for (std::size_t i = 0; i < state.rows.size(); ++i) { - if (!wireframe::matches_search(state.rows[i].summary, search_term)) continue; + if (!packeteer::matches_search(state.rows[i].summary, search_term)) continue; ++shown; // ImGui derives a widget's ID from its label text by @@ -276,7 +276,7 @@ int main(int argc, char** argv) { if (selected_row >= 0 && selected_row < static_cast<int>(state.rows.size())) { const auto& row = state.rows[selected_row]; if (enable_checksums) { - std::string status = wireframe::checksum_status(row.data, session.datalink()); + std::string status = packeteer::checksum_status(row.data, session.datalink()); if (!status.empty()) { ImGui::TextColored(ImVec4(0.6f, 0.8f, 1.0f, 1.0f), "%s", status.c_str()); } @@ -285,7 +285,7 @@ int main(int argc, char** argv) { ImGui::TextColored(ImVec4(0.6f, 1.0f, 0.6f, 1.0f), "%s", row.reassembled_http->c_str()); } - for (const auto& line : wireframe::hex_dump_lines(row.data)) { + for (const auto& line : packeteer::hex_dump_lines(row.data)) { ImGui::TextUnformatted(line.c_str()); } } else { diff --git a/src/main.cpp b/src/main.cpp index 72dd267..82b07a9 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -14,7 +14,7 @@ // packet and counts it instead. // // Stage 5: L7 dissectors register into an L7Registry keyed by port -// (wireframe/l7/dissector.hpp) and get consulted from summarize_packet +// (packeteer/l7/dissector.hpp) and get consulted from summarize_packet // once TCP/UDP decode a port number. DNS is the first one, proving the // interface against real traffic rather than synthetic bytes. // @@ -23,12 +23,12 @@ // traffic silently dropped once the decoder only handled IPv4. // // Stage 6: -f <expr> compiles a tcpdump-style BPF expression via -// libpcap's own compiler (wireframe/filter.hpp) and installs it with +// libpcap's own compiler (packeteer/filter.hpp) and installs it with // pcap_setfilter(), filtering in the kernel before packets ever reach // userspace - rather than hand-rolling a second BPF parser. // // Device-open/datalink-validate/filter/pcapng/signal-handler setup all -// goes through wireframe::CaptureSession (wireframe/capture_session.hpp) +// goes through packeteer::CaptureSession (packeteer/capture_session.hpp) // - the same one gui_main.cpp uses - so the CLI/TUI and GUI frontends // can't drift apart on that setup path. @@ -47,11 +47,11 @@ #include <ftxui/component/screen_interactive.hpp> #include <ftxui/dom/elements.hpp> -#include "wireframe/capture_session.hpp" -#include "wireframe/net/tcp_reassembly.hpp" -#include "wireframe/packet_diagnostics.hpp" -#include "wireframe/search.hpp" -#include "wireframe/summarize.hpp" +#include "packeteer/capture_session.hpp" +#include "packeteer/net/tcp_reassembly.hpp" +#include "packeteer/packet_diagnostics.hpp" +#include "packeteer/search.hpp" +#include "packeteer/summarize.hpp" namespace { @@ -62,7 +62,7 @@ namespace { constexpr std::size_t kQueueCapacity = 4096; void hex_dump(std::span<const unsigned char> bytes) { - for (const auto& line : wireframe::hex_dump_lines(bytes)) { + for (const auto& line : packeteer::hex_dump_lines(bytes)) { std::printf("%s\n", line.c_str()); } std::printf("\n"); @@ -72,15 +72,15 @@ struct RenderOptions { bool verbose_hex; bool verbose_checksums; int datalink; - wireframe::pcapng::Writer* pcapng_writer; - std::string search_term; // display filter - see wireframe/search.hpp - wireframe::net::TcpReassembler* reassembler; // -a only; nullptr means disabled + packeteer::pcapng::Writer* pcapng_writer; + std::string search_term; // display filter - see packeteer/search.hpp + packeteer::net::TcpReassembler* reassembler; // -a only; nullptr means disabled }; -void render_packet(const wireframe::CapturedPacket& packet, const RenderOptions& opts) { +void render_packet(const packeteer::CapturedPacket& packet, const RenderOptions& opts) { std::span<const unsigned char> bytes{packet.data}; - std::string line = wireframe::summarize_packet(bytes, opts.datalink); + std::string line = packeteer::summarize_packet(bytes, opts.datalink); // -g is a display filter, not a capture filter: still written to // -w regardless of whether it matches, since -w should reflect @@ -90,15 +90,15 @@ void render_packet(const wireframe::CapturedPacket& packet, const RenderOptions& packet.original_len); } - if (!wireframe::matches_search(line, opts.search_term)) return; + if (!packeteer::matches_search(line, opts.search_term)) return; if (opts.verbose_checksums) { - std::string status = wireframe::checksum_status(bytes, opts.datalink); + std::string status = packeteer::checksum_status(bytes, opts.datalink); if (!status.empty()) line += " " + status; } std::printf("%s\n", line.c_str()); if (opts.reassembler) { - if (auto status = wireframe::reassembled_http_status(bytes, opts.datalink, + if (auto status = packeteer::reassembled_http_status(bytes, opts.datalink, *opts.reassembler)) { std::printf(" [%s]\n", status->c_str()); } @@ -122,7 +122,7 @@ void render_packet(const wireframe::CapturedPacket& packet, const RenderOptions& // path as Ctrl-C, so there's one shutdown sequence, not two: breakloop // -> capture thread's pcap_loop returns -> queue.stop() -> consumer // drains and calls screen.Exit() -> screen.Loop() returns. -void run_tui(wireframe::CaptureSession& session, wireframe::CaptureQueue& queue, +void run_tui(packeteer::CaptureSession& session, packeteer::CaptureQueue& queue, RenderOptions& opts) { using namespace ftxui; @@ -133,7 +133,7 @@ void run_tui(wireframe::CaptureSession& session, wireframe::CaptureQueue& queue, std::uint64_t packet_count = 0; // '/' search: a display filter over `rows`, independent of the - // capture itself (wireframe/search.hpp) - typed and read only on + // capture itself (packeteer/search.hpp) - typed and read only on // the UI thread (the consumer thread never touches it), so unlike // `rows`/`packet_count` it doesn't need state_mutex. bool searching = false; @@ -145,7 +145,7 @@ void run_tui(wireframe::CaptureSession& session, wireframe::CaptureQueue& queue, std::thread consumer_thread([&] { while (auto packet = queue.pop()) { std::span<const unsigned char> bytes{packet->data}; - std::string line = wireframe::summarize_packet(bytes, opts.datalink); + std::string line = packeteer::summarize_packet(bytes, opts.datalink); if (opts.pcapng_writer) { opts.pcapng_writer->write_packet(/*interface_id=*/0, packet->ts_sec, @@ -182,7 +182,7 @@ void run_tui(wireframe::CaptureSession& session, wireframe::CaptureQueue& queue, Elements lines; std::size_t shown = 0; for (const auto& row : rows) { - if (!wireframe::matches_search(row, search_term)) continue; + if (!packeteer::matches_search(row, search_term)) continue; lines.push_back(text(row)); ++shown; } @@ -209,8 +209,8 @@ void run_tui(wireframe::CaptureSession& session, wireframe::CaptureQueue& queue, footer.push_back(text("search: " + search_term + (searching ? "_" : "")) | color(Color::Green)); } - std::string title = session.is_replay() ? ("wireframe - replaying " + session.device()) - : "wireframe - live capture"; + std::string title = session.is_replay() ? ("packeteer - replaying " + session.device()) + : "packeteer - live capture"; return vbox({ text(title) | bold | color(Color::Cyan), separator(), @@ -266,7 +266,7 @@ void run_tui(wireframe::CaptureSession& session, wireframe::CaptureQueue& queue, void print_usage(const char* argv0) { std::printf( - "wireframe - terminal packet capture and analysis tool\n" + "packeteer - terminal packet capture and analysis tool\n" "\n" "Usage: %s [options] [interface]\n" "\n" @@ -314,7 +314,7 @@ int main(int argc, char** argv) { } } - wireframe::CaptureSessionOptions options; + packeteer::CaptureSessionOptions options; bool tui_mode = false; bool enable_reassembly = false; RenderOptions opts{.verbose_hex = false, @@ -346,7 +346,7 @@ int main(int argc, char** argv) { } } - wireframe::CaptureSession session; + packeteer::CaptureSession session; if (auto err = session.open(options)) { std::fprintf(stderr, "%s\n", err->c_str()); return 1; @@ -355,7 +355,7 @@ int main(int argc, char** argv) { opts.pcapng_writer = session.pcapng_writer(); session.install_signal_handlers(); - wireframe::net::TcpReassembler reassembler; + packeteer::net::TcpReassembler reassembler; if (enable_reassembly) opts.reassembler = &reassembler; if (!tui_mode) { @@ -368,7 +368,7 @@ int main(int argc, char** argv) { } } - wireframe::CaptureQueue queue(kQueueCapacity); + packeteer::CaptureQueue queue(kQueueCapacity); std::thread capture_thread = session.start_capture_thread(queue); if (tui_mode) { |