mirror of
https://github.com/jkcoxson/idevice.git
synced 2026-03-02 14:36:16 +01:00
Add adapter_close to stop TCP stack
This commit is contained in:
@@ -103,7 +103,9 @@ pub unsafe extern "C" fn adapter_pcap(
|
||||
/// # Safety
|
||||
/// `handle` must be a valid pointer to a handle allocated by this library
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn adapter_close(handle: *mut AdapterStreamHandle) -> *mut IdeviceFfiError {
|
||||
pub unsafe extern "C" fn adapter_stream_close(
|
||||
handle: *mut AdapterStreamHandle,
|
||||
) -> *mut IdeviceFfiError {
|
||||
if handle.is_null() {
|
||||
return ffi_err!(IdeviceError::FfiInvalidArg);
|
||||
}
|
||||
@@ -114,6 +116,28 @@ pub unsafe extern "C" fn adapter_close(handle: *mut AdapterStreamHandle) -> *mut
|
||||
null_mut()
|
||||
}
|
||||
|
||||
/// Stops the entire adapter TCP stack
|
||||
///
|
||||
/// # Arguments
|
||||
/// * [`handle`] - The adapter handle
|
||||
///
|
||||
/// # Returns
|
||||
/// Null on success, an IdeviceFfiError otherwise
|
||||
///
|
||||
/// # Safety
|
||||
/// `handle` must be a valid pointer to a handle allocated by this library
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn adapter_close(handle: *mut AdapterHandle) -> *mut IdeviceFfiError {
|
||||
if handle.is_null() {
|
||||
return ffi_err!(IdeviceError::FfiInvalidArg);
|
||||
}
|
||||
|
||||
let adapter = unsafe { &mut (*handle).0 };
|
||||
RUNTIME.block_on(async move { adapter.close().await.ok() });
|
||||
|
||||
null_mut()
|
||||
}
|
||||
|
||||
/// Sends data through the adapter stream
|
||||
///
|
||||
/// # Arguments
|
||||
|
||||
Reference in New Issue
Block a user