Files
idevice/cpp/include/idevice++/restore_service.hpp
T
Jackson Coxson bae57ec4d9 Implement rppairing (#79)
* Initial rppairing support

* Use idevice-srp crate

* Add more debug logging to rppairing

* Create pair_rsd_ios tool

* Start work on iOS rppairing

* Set RemoteXPC initial root ID to 0

* Send weird flags after opening reply stream

* Allow rppairing with underlying RemoteXPC connection

* fix(pair_rsd_ios): handle Linux mDNS link-local fallback (#73)

* Implement CDTunnel via rppairing

* Add example to rppair over CoreDeviceProxy

* Implement shim and FFI for RSD services

* Implement C++ RSD connect factories

---------

Co-authored-by: se2crid <151872490+se2crid@users.noreply.github.com>
2026-03-26 23:22:40 -06:00

55 lines
2.0 KiB
C++

// Jackson Coxson
#pragma once
#include <idevice++/bindings.hpp>
#include <idevice++/ffi.hpp>
#include <idevice++/idevice.hpp>
#include <idevice++/readwrite.hpp>
#include <idevice++/result.hpp>
#include <memory>
#include <string>
namespace IdeviceFFI {
using RestoreServicePtr =
std::unique_ptr<RestoreServiceClientHandle,
FnDeleter<RestoreServiceClientHandle, restore_service_client_free>>;
class RestoreService {
public:
// Factory: connect via RSD tunnel
static Result<RestoreService, FfiError> connect_rsd(AdapterHandle* adapter, RsdHandshakeHandle* handshake);
// Factory: from ReadWrite stream (RSD-only, consumes the pointer)
static Result<RestoreService, FfiError> from_readwrite_ptr(ReadWriteOpaque* consumed);
// Ergonomic overload: consume a C++ ReadWrite
static Result<RestoreService, FfiError> from_readwrite(ReadWrite&& rw);
// Ops
Result<void, FfiError> enter_recovery();
Result<void, FfiError> reboot();
Result<plist_t, FfiError> get_preflightinfo();
Result<plist_t, FfiError> get_nonces();
Result<plist_t, FfiError> get_app_parameters();
Result<void, FfiError> restore_lang(const std::string& language);
// RAII / moves
~RestoreService() noexcept = default;
RestoreService(RestoreService&&) noexcept = default;
RestoreService& operator=(RestoreService&&) noexcept = default;
RestoreService(const RestoreService&) = delete;
RestoreService& operator=(const RestoreService&) = delete;
RestoreServiceClientHandle* raw() const noexcept { return handle_.get(); }
static RestoreService adopt(RestoreServiceClientHandle* h) noexcept {
return RestoreService(h);
}
private:
explicit RestoreService(RestoreServiceClientHandle* h) noexcept : handle_(h) {}
RestoreServicePtr handle_{};
};
} // namespace IdeviceFFI