// Jackson Coxson #pragma once #include #include #include #include #include #include namespace IdeviceFFI { using DeviceInfoPtr = std::unique_ptr>; /// A running process on the device struct RunningProcess { uint32_t pid; std::string name; std::string real_app_name; bool is_application; uint64_t start_page_count; }; class DeviceInfo { public: static Result create(RemoteServer& server); Result, FfiError> running_processes(); Result execname_for_pid(uint32_t pid); Result is_running_pid(uint32_t pid); /// Returns a plist_t dictionary. Caller must free with plist_free(). Result hardware_information(); /// Returns a plist_t dictionary. Caller must free with plist_free(). Result network_information(); Result mach_kernel_name(); Result, FfiError> sysmon_process_attributes(); Result, FfiError> sysmon_system_attributes(); Result, FfiError> directory_listing(const std::string& path); ~DeviceInfo() noexcept = default; DeviceInfo(DeviceInfo&&) noexcept = default; DeviceInfo& operator=(DeviceInfo&&) noexcept = default; DeviceInfo(const DeviceInfo&) = delete; DeviceInfo& operator=(const DeviceInfo&) = delete; DeviceInfoHandle* raw() const noexcept { return handle_.get(); } static DeviceInfo adopt(DeviceInfoHandle* h) noexcept { return DeviceInfo(h); } private: explicit DeviceInfo(DeviceInfoHandle* h) noexcept : handle_(h) {} DeviceInfoPtr handle_{}; static std::vector collect_string_array(char** arr, size_t count); }; } // namespace IdeviceFFI