#pragma once #include #include #include namespace pex { struct ProcInfo { int32_t pid = 0; int32_t ppid = 0; std::string name; std::string user; float cpu_pct = 0.0f; float ram_mb = 0.0f; float disk_read_kb_s = 0.0f; float disk_write_kb_s = 0.0f; int32_t threads = 0; std::string state; // R/S/D/Z/T (Linux) o running/suspended (Win) std::string cmdline; }; struct StatsSnapshot { int64_t unix_ts = 0; float cpu_pct = 0.0f; float ram_used_mb = 0.0f; float ram_total_mb = 0.0f; float disk_read_mb_s = 0.0f; float disk_write_mb_s = 0.0f; float net_rx_mb_s = 0.0f; float net_tx_mb_s = 0.0f; float gpu_pct = 0.0f; }; struct DeviceInfo { std::string kind; // disk | gpu | usb | sensor std::string name; std::string detail; float usage_pct = 0.0f; // -1 si no aplica }; struct ServiceInfo { std::string name; std::string state; // running | stopped | failed std::string description; std::string runtime; // systemd | sc | docker | other }; struct NetConn { int32_t pid = 0; std::string proto; // tcp | udp std::string local; // ip:port std::string remote; std::string state; // ESTABLISHED, LISTEN, ... }; // Stubs: parsean JSON del agente o devuelven vacios si no esta disponible. // Implementacion real cuando el agente Go exista (issue 0111). std::vector fetch_processes(const std::string& base_url, const std::string& token); StatsSnapshot fetch_stats (const std::string& base_url, const std::string& token); std::vector fetch_devices (const std::string& base_url, const std::string& token); std::vector fetch_services (const std::string& base_url, const std::string& token); std::vector fetch_netconns (const std::string& base_url, const std::string& token); // Local del host donde corre el binario. // - Linux: lee /proc. // - Windows: WinAPI (psapi, GetSystemTimes, GlobalMemoryStatusEx). std::vector fetch_processes_local(); StatsSnapshot fetch_stats_local(); // WSL desde un binario Windows — trampoline via `wsl.exe -e ...`. // En Linux son aliases a fetch_*_local. std::vector fetch_processes_wsl(); StatsSnapshot fetch_stats_wsl(); // Network/Devices/Services para el host LOCAL (binario corriendo aqui). std::vector fetch_netconns_local(); std::vector fetch_devices_local(); std::vector fetch_services_local(); // Idem WSL — trampoline desde un binario Windows. En Linux son aliases local. std::vector fetch_netconns_wsl(); std::vector fetch_devices_wsl(); std::vector fetch_services_wsl(); } // namespace pex