// Jackson Coxson #ifndef IDEVICE_RSD_H #define IDEVICE_RSD_H #include #include #include #include namespace IdeviceFFI { struct RsdService { std::string name; std::string entitlement; uint16_t port{}; bool uses_remote_xpc{}; std::vector features; int64_t service_version{-1}; }; using RsdPtr = std::unique_ptr>; class RsdHandshake { public: // Factory: consumes the ReadWrite socket regardless of result static Result from_socket(ReadWrite&& rw); // Basic info Result protocol_version() const; Result uuid() const; // Services Result, FfiError> services() const; Result service_available(const std::string& name) const; Result service_info(const std::string& name) const; // RAII / moves ~RsdHandshake() noexcept = default; RsdHandshake(RsdHandshake&&) noexcept = default; RsdHandshake& operator=(RsdHandshake&&) noexcept = default; // Enable Copying RsdHandshake(const RsdHandshake& other); RsdHandshake& operator=(const RsdHandshake& other); RsdHandshakeHandle* raw() const noexcept { return handle_.get(); } static RsdHandshake adopt(RsdHandshakeHandle* h) noexcept { return RsdHandshake(h); } private: explicit RsdHandshake(RsdHandshakeHandle* h) noexcept : handle_(h) {} RsdPtr handle_{}; }; } // namespace IdeviceFFI #endif