Files
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

43 lines
1.5 KiB
C++

#pragma once
#include <idevice++/bindings.hpp>
#include <idevice++/ffi.hpp>
#include <idevice++/provider.hpp>
#include <memory>
namespace IdeviceFFI {
using HeartbeatPtr =
std::unique_ptr<HeartbeatClientHandle, FnDeleter<HeartbeatClientHandle, heartbeat_client_free>>;
class Heartbeat {
public:
// Factory: connect via Provider
static Result<Heartbeat, FfiError> connect(Provider& provider);
// Factory: connect via RSD tunnel
static Result<Heartbeat, FfiError> connect_rsd(AdapterHandle* adapter, RsdHandshakeHandle* handshake);
// Factory: wrap an existing Idevice socket (consumes it on success)
static Result<Heartbeat, FfiError> from_socket(Idevice&& socket);
// Ops
Result<void, FfiError> send_polo();
Result<u_int64_t, FfiError> get_marco(u_int64_t interval);
// RAII / moves
~Heartbeat() noexcept = default;
Heartbeat(Heartbeat&&) noexcept = default;
Heartbeat& operator=(Heartbeat&&) noexcept = default;
Heartbeat(const Heartbeat&) = delete;
Heartbeat& operator=(const Heartbeat&) = delete;
HeartbeatClientHandle* raw() const noexcept { return handle_.get(); }
static Heartbeat adopt(HeartbeatClientHandle* h) noexcept { return Heartbeat(h); }
private:
explicit Heartbeat(HeartbeatClientHandle* h) noexcept : handle_(h) {}
HeartbeatPtr handle_{};
};
} // namespace IdeviceFFI