mirror of
https://github.com/jkcoxson/idevice.git
synced 2026-05-17 20:20:34 +00:00
bae57ec4d9
* 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>
50 lines
2.0 KiB
C++
50 lines
2.0 KiB
C++
#pragma once
|
|
#include <idevice++/bindings.hpp>
|
|
#include <idevice++/ffi.hpp>
|
|
#include <idevice++/provider.hpp>
|
|
#include <memory>
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
namespace IdeviceFFI {
|
|
|
|
using NotificationProxyPtr = std::unique_ptr<NotificationProxyClientHandle,
|
|
FnDeleter<NotificationProxyClientHandle, notification_proxy_client_free>>;
|
|
|
|
class NotificationProxy {
|
|
public:
|
|
// Factory: connect via Provider
|
|
static Result<NotificationProxy, FfiError> connect(Provider& provider);
|
|
|
|
// Factory: connect via RSD tunnel
|
|
static Result<NotificationProxy, FfiError> connect_rsd(AdapterHandle* adapter, RsdHandshakeHandle* handshake);
|
|
|
|
// Factory: wrap an existing Idevice socket (consumes it on success)
|
|
static Result<NotificationProxy, FfiError> from_socket(Idevice&& socket);
|
|
|
|
// Ops
|
|
Result<void, FfiError> post_notification(const std::string& name);
|
|
Result<void, FfiError> observe_notification(const std::string& name);
|
|
Result<void, FfiError> observe_notifications(const std::vector<std::string>& names);
|
|
Result<std::string, FfiError> receive_notification();
|
|
Result<std::string, FfiError> receive_notification_with_timeout(u_int64_t interval);
|
|
|
|
// RAII / moves
|
|
~NotificationProxy() noexcept = default;
|
|
NotificationProxy(NotificationProxy&&) noexcept = default;
|
|
NotificationProxy& operator=(NotificationProxy&&) noexcept = default;
|
|
NotificationProxy(const NotificationProxy&) = delete;
|
|
NotificationProxy& operator=(const NotificationProxy&) = delete;
|
|
|
|
NotificationProxyClientHandle* raw() const noexcept { return handle_.get(); }
|
|
static NotificationProxy adopt(NotificationProxyClientHandle* h) noexcept {
|
|
return NotificationProxy(h);
|
|
}
|
|
|
|
private:
|
|
explicit NotificationProxy(NotificationProxyClientHandle* h) noexcept : handle_(h) {}
|
|
NotificationProxyPtr handle_{};
|
|
};
|
|
|
|
} // namespace IdeviceFFI
|