diff options
Diffstat (limited to 'src/main.cpp')
| -rw-r--r-- | src/main.cpp | 56 |
1 files changed, 28 insertions, 28 deletions
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) { |