#pragma once #include #include #include "platform/console.h" namespace roro { // The network troubleshooting commands (issue #90): ping, nslookup, port, traceroute, ifconfig, // arp. The first four take time, so each runs on a task of its own and prints its lines as they // come, to the console that asked; one at a time, and `cancel` stops it. The other two answer at // once. The packets and their meaning are lib/net/src/net_probe.h, which is host-tested. class NetTools { public: // True if `line` was one of its commands (answered, started, or refused with a reason). bool command(const std::string& line); bool busy() const { return busy_; } void cancel() { stop_ = true; } private: struct Job; void start(Job* job); static void task(void* arg); std::atomic busy_{false}, stop_{false}; }; } // namespace roro