diff --git a/cpp/include/idevice++/dvt/network_monitor.hpp b/cpp/include/idevice++/dvt/network_monitor.hpp index 229bf6d..6dcf2a2 100644 --- a/cpp/include/idevice++/dvt/network_monitor.hpp +++ b/cpp/include/idevice++/dvt/network_monitor.hpp @@ -22,7 +22,7 @@ struct CppSocketAddress { /// A decoded network event from the device struct NetworkEvent { - IdeviceNetworkEventType event_type = Unknown; + IdeviceNetworkEventType event_type = NetworkEventUnknown; // InterfaceDetection uint32_t interface_index = 0; diff --git a/ffi/Cargo.toml b/ffi/Cargo.toml index 91bd981..933e743 100644 --- a/ffi/Cargo.toml +++ b/ffi/Cargo.toml @@ -71,7 +71,7 @@ tunnel_tcp_stack = ["idevice/tunnel_tcp_stack"] tunnel_tcp_stack_pcap = ["idevice/tunnel_tcp_stack_pcap"] tss = ["idevice/tss"] tunneld = ["idevice/tunneld"] -usbmuxd = ["idevice/usbmuxd"] +usbmuxd = ["idevice/usbmuxd", "dep:futures"] wda = ["idevice/wda", "dep:serde_json"] xpc = ["idevice/xpc"] screenshotr = ["idevice/screenshotr"] diff --git a/ffi/src/dvt/network_monitor.rs b/ffi/src/dvt/network_monitor.rs index e089ffa..264b36d 100644 --- a/ffi/src/dvt/network_monitor.rs +++ b/ffi/src/dvt/network_monitor.rs @@ -18,7 +18,7 @@ pub enum IdeviceNetworkEventType { InterfaceDetection = 0, ConnectionDetection = 1, ConnectionUpdate = 2, - Unknown = 255, + NetworkEventUnknown = 255, } /// A socket address (IPv4 or IPv6), represented as a null-terminated string + port @@ -286,7 +286,7 @@ pub unsafe extern "C" fn network_monitor_next_event( unknown_type: 0, }, NetworkEvent::Unknown(t) => IdeviceNetworkEvent { - event_type: IdeviceNetworkEventType::Unknown, + event_type: IdeviceNetworkEventType::NetworkEventUnknown, interface_index: 0, interface_name: null_mut(), local_addr: make_socket_addr(None), diff --git a/ffi/src/lockdown.rs b/ffi/src/lockdown.rs index cb04c27..d13a25a 100644 --- a/ffi/src/lockdown.rs +++ b/ffi/src/lockdown.rs @@ -3,14 +3,14 @@ use std::ptr::null_mut; use idevice::{ - IdeviceError, IdeviceService, RsdService as _, lockdown::LockdownClient, + IdeviceError, IdeviceService, lockdown::LockdownClient, provider::IdeviceProvider, }; use plist_ffi::plist_t; use crate::{ - IdeviceFfiError, IdeviceHandle, IdevicePairingFile, core_device_proxy::AdapterHandle, ffi_err, - provider::IdeviceProviderHandle, rsd::RsdHandshakeHandle, run_sync_local, + IdeviceFfiError, IdeviceHandle, IdevicePairingFile, ffi_err, + provider::IdeviceProviderHandle, run_sync_local, }; pub struct LockdowndClientHandle(pub LockdownClient); @@ -55,45 +55,6 @@ pub unsafe extern "C" fn lockdownd_connect( } } -/// Creates a new LockdownClient via RSD -/// -/// # Arguments -/// * [`provider`] - An adapter created by this library -/// * [`handshake`] - An RSD handshake from the same provider -/// * [`client`] - On success, will be set to point to a newly allocated LockdownClient handle -/// -/// # Returns -/// An IdeviceFfiError on error, null on success -/// -/// # Safety -/// `provider` must be a valid pointer to a handle allocated by this library -/// `handshake` must be a valid pointer to a handle allocated by this library -/// `client` must be a valid, non-null pointer to a location where the handle will be stored -#[unsafe(no_mangle)] -pub unsafe extern "C" fn lockdownd_connect_rsd( - provider: *mut AdapterHandle, - handshake: *mut RsdHandshakeHandle, - client: *mut *mut LockdowndClientHandle, -) -> *mut IdeviceFfiError { - if provider.is_null() || handshake.is_null() || client.is_null() { - return ffi_err!(IdeviceError::FfiInvalidArg); - } - let res: Result = run_sync_local(async move { - let provider_ref = unsafe { &mut (*provider).0 }; - let handshake_ref = unsafe { &mut (*handshake).0 }; - LockdownClient::connect_rsd(provider_ref, handshake_ref).await - }); - - match res { - Ok(r) => { - let boxed = Box::new(LockdowndClientHandle(r)); - unsafe { *client = Box::into_raw(boxed) }; - null_mut() - } - Err(e) => ffi_err!(e), - } -} - /// Creates a new LockdowndClient from an existing Idevice connection /// /// # Arguments diff --git a/idevice/src/lib.rs b/idevice/src/lib.rs index b208525..d8d8109 100644 --- a/idevice/src/lib.rs +++ b/idevice/src/lib.rs @@ -51,7 +51,7 @@ pub mod tunnel; pub use xpc::RemoteXpcClient; use plist_macro::{plist, pretty_print_dictionary, pretty_print_plist}; -use provider::{IdeviceProvider, RsdProvider}; +use provider::IdeviceProvider; #[cfg(feature = "rustls")] use rustls::{crypto::CryptoProvider, pki_types::ServerName}; use std::{