mirror of
https://github.com/jkcoxson/idevice.git
synced 2026-03-02 14:36:16 +01:00
remove "proxy" and run cargo fmt
This commit is contained in:
@@ -14,8 +14,8 @@ pub mod process_control;
|
|||||||
pub mod provider;
|
pub mod provider;
|
||||||
pub mod remote_server;
|
pub mod remote_server;
|
||||||
pub mod remotexpc;
|
pub mod remotexpc;
|
||||||
pub mod usbmuxd;
|
|
||||||
pub mod sbservices;
|
pub mod sbservices;
|
||||||
|
pub mod usbmuxd;
|
||||||
pub mod util;
|
pub mod util;
|
||||||
|
|
||||||
pub use errors::*;
|
pub use errors::*;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
use std::ffi::{c_void, CStr};
|
use std::ffi::{CStr, c_void};
|
||||||
|
|
||||||
use idevice::{IdeviceError, IdeviceService, sbservices::SpringBoardServicesClient};
|
use idevice::{IdeviceError, IdeviceService, sbservices::SpringBoardServicesClient};
|
||||||
|
|
||||||
@@ -13,7 +13,7 @@ pub struct SpringBoardServicesClientHandle(pub SpringBoardServicesClient);
|
|||||||
pub struct plist_t;
|
pub struct plist_t;
|
||||||
|
|
||||||
#[unsafe(no_mangle)]
|
#[unsafe(no_mangle)]
|
||||||
pub unsafe extern "C" fn springboard_services_proxy_connect_tcp(
|
pub unsafe extern "C" fn springboard_services_connect_tcp(
|
||||||
provider: *mut TcpProviderHandle,
|
provider: *mut TcpProviderHandle,
|
||||||
client: *mut *mut SpringBoardServicesClientHandle,
|
client: *mut *mut SpringBoardServicesClientHandle,
|
||||||
) -> IdeviceErrorCode {
|
) -> IdeviceErrorCode {
|
||||||
@@ -53,7 +53,7 @@ pub unsafe extern "C" fn springboard_services_proxy_connect_tcp(
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[unsafe(no_mangle)]
|
#[unsafe(no_mangle)]
|
||||||
pub unsafe extern "C" fn springboard_services_proxy_connect_usbmuxd(
|
pub unsafe extern "C" fn springboard_services_connect_usbmuxd(
|
||||||
provider: *mut UsbmuxdProviderHandle,
|
provider: *mut UsbmuxdProviderHandle,
|
||||||
client: *mut *mut SpringBoardServicesClientHandle,
|
client: *mut *mut SpringBoardServicesClientHandle,
|
||||||
) -> IdeviceErrorCode {
|
) -> IdeviceErrorCode {
|
||||||
@@ -88,7 +88,7 @@ pub unsafe extern "C" fn springboard_services_proxy_connect_usbmuxd(
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[unsafe(no_mangle)]
|
#[unsafe(no_mangle)]
|
||||||
pub unsafe extern "C" fn springboard_services_proxy_new(
|
pub unsafe extern "C" fn springboard_services_new(
|
||||||
socket: *mut IdeviceHandle,
|
socket: *mut IdeviceHandle,
|
||||||
client: *mut *mut SpringBoardServicesClientHandle,
|
client: *mut *mut SpringBoardServicesClientHandle,
|
||||||
) -> IdeviceErrorCode {
|
) -> IdeviceErrorCode {
|
||||||
@@ -116,7 +116,7 @@ pub unsafe extern "C" fn springboard_services_proxy_new(
|
|||||||
/// `client` must be a valid pointer to a handle allocated by this library
|
/// `client` must be a valid pointer to a handle allocated by this library
|
||||||
/// `out_result` must be a valid, non-null pointer to a location where the result will be stored
|
/// `out_result` must be a valid, non-null pointer to a location where the result will be stored
|
||||||
#[unsafe(no_mangle)]
|
#[unsafe(no_mangle)]
|
||||||
pub unsafe extern "C" fn springboard_services_proxy_get_icon(
|
pub unsafe extern "C" fn springboard_services_get_icon(
|
||||||
client: *mut SpringBoardServicesClientHandle,
|
client: *mut SpringBoardServicesClientHandle,
|
||||||
bundle_identifier: *const libc::c_char,
|
bundle_identifier: *const libc::c_char,
|
||||||
out_result: *mut *mut c_void,
|
out_result: *mut *mut c_void,
|
||||||
@@ -128,16 +128,14 @@ pub unsafe extern "C" fn springboard_services_proxy_get_icon(
|
|||||||
}
|
}
|
||||||
let client = unsafe { &mut *client };
|
let client = unsafe { &mut *client };
|
||||||
|
|
||||||
|
|
||||||
let name_cstr = unsafe { CStr::from_ptr(bundle_identifier) };
|
let name_cstr = unsafe { CStr::from_ptr(bundle_identifier) };
|
||||||
let bundle_id = match name_cstr.to_str() {
|
let bundle_id = match name_cstr.to_str() {
|
||||||
Ok(s) => s.to_string(),
|
Ok(s) => s.to_string(),
|
||||||
Err(_) => return IdeviceErrorCode::InvalidArg,
|
Err(_) => return IdeviceErrorCode::InvalidArg,
|
||||||
};
|
};
|
||||||
|
|
||||||
let res: Result<Vec<u8>, IdeviceError> = RUNTIME.block_on(async {
|
let res: Result<Vec<u8>, IdeviceError> =
|
||||||
client.0.get_icon_pngdata(bundle_id).await
|
RUNTIME.block_on(async { client.0.get_icon_pngdata(bundle_id).await });
|
||||||
});
|
|
||||||
|
|
||||||
match res {
|
match res {
|
||||||
Ok(r) => {
|
Ok(r) => {
|
||||||
@@ -156,16 +154,10 @@ pub unsafe extern "C" fn springboard_services_proxy_get_icon(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#[unsafe(no_mangle)]
|
#[unsafe(no_mangle)]
|
||||||
pub unsafe extern "C" fn springboard_services_proxy_free(
|
pub unsafe extern "C" fn springboard_services_free(handle: *mut SpringBoardServicesClientHandle) {
|
||||||
handle: *mut SpringBoardServicesClientHandle,
|
|
||||||
) {
|
|
||||||
if !handle.is_null() {
|
if !handle.is_null() {
|
||||||
log::debug!("Freeing springboard_services_proxy_client");
|
log::debug!("Freeing springboard_services_client");
|
||||||
let _ = unsafe { Box::from_raw(handle) };
|
let _ = unsafe { Box::from_raw(handle) };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,6 +19,8 @@ pub mod misagent;
|
|||||||
pub mod mounter;
|
pub mod mounter;
|
||||||
pub mod pairing_file;
|
pub mod pairing_file;
|
||||||
pub mod provider;
|
pub mod provider;
|
||||||
|
#[cfg(feature = "sbservices")]
|
||||||
|
pub mod sbservices;
|
||||||
#[cfg(feature = "tunnel_tcp_stack")]
|
#[cfg(feature = "tunnel_tcp_stack")]
|
||||||
pub mod tcp;
|
pub mod tcp;
|
||||||
#[cfg(feature = "tss")]
|
#[cfg(feature = "tss")]
|
||||||
@@ -30,8 +32,6 @@ pub mod usbmuxd;
|
|||||||
mod util;
|
mod util;
|
||||||
#[cfg(feature = "xpc")]
|
#[cfg(feature = "xpc")]
|
||||||
pub mod xpc;
|
pub mod xpc;
|
||||||
#[cfg(feature = "sbservices")]
|
|
||||||
pub mod sbservices;
|
|
||||||
|
|
||||||
use log::{debug, error, trace};
|
use log::{debug, error, trace};
|
||||||
use openssl::ssl::{SslConnector, SslMethod, SslVerifyMode};
|
use openssl::ssl::{SslConnector, SslMethod, SslVerifyMode};
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
use crate::{lockdownd::LockdowndClient, Idevice, IdeviceError, IdeviceService};
|
use crate::{lockdownd::LockdowndClient, Idevice, IdeviceError, IdeviceService};
|
||||||
|
|
||||||
pub struct SpringBoardServicesClient {
|
pub struct SpringBoardServicesClient {
|
||||||
pub idevice: Idevice
|
pub idevice: Idevice,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl IdeviceService for SpringBoardServicesClient {
|
impl IdeviceService for SpringBoardServicesClient {
|
||||||
@@ -40,7 +40,7 @@ impl SpringBoardServicesClient {
|
|||||||
/// `bundle_identifier` - The identifier of the app to get icon
|
/// `bundle_identifier` - The identifier of the app to get icon
|
||||||
pub async fn get_icon_pngdata(
|
pub async fn get_icon_pngdata(
|
||||||
&mut self,
|
&mut self,
|
||||||
bundle_identifier: String
|
bundle_identifier: String,
|
||||||
) -> Result<Vec<u8>, IdeviceError> {
|
) -> Result<Vec<u8>, IdeviceError> {
|
||||||
let mut req = plist::Dictionary::new();
|
let mut req = plist::Dictionary::new();
|
||||||
req.insert("command".into(), "getIconPNGData".into());
|
req.insert("command".into(), "getIconPNGData".into());
|
||||||
@@ -51,9 +51,7 @@ impl SpringBoardServicesClient {
|
|||||||
|
|
||||||
let mut res = self.idevice.read_plist().await?;
|
let mut res = self.idevice.read_plist().await?;
|
||||||
match res.remove("pngData") {
|
match res.remove("pngData") {
|
||||||
Some(plist::Value::Data(res)) => {
|
Some(plist::Value::Data(res)) => Ok(res),
|
||||||
Ok(res)
|
|
||||||
}
|
|
||||||
_ => Err(IdeviceError::UnexpectedResponse),
|
_ => Err(IdeviceError::UnexpectedResponse),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user