Class MobileBackupNativeMethods
Inheritance
Inherited Members
Namespace: iMobileDevice.MobileBackup
Assembly: iMobileDevice-net.dll
Syntax
public class MobileBackupNativeMethods
Methods
mobilebackup_client_free(IntPtr)
Disconnects a mobilebackup client from the device and frees up the mobilebackup client data.
Declaration
public static MobileBackupError mobilebackup_client_free(IntPtr client)
Parameters
Type | Name | Description |
---|---|---|
System.IntPtr | client | The mobilebackup client to disconnect and free. |
Returns
Type | Description |
---|---|
MobileBackupError | MOBILEBACKUP_E_SUCCESS on success, or MOBILEBACKUP_E_INVALID_ARG if client is NULL. |
mobilebackup_client_new(iDeviceHandle, LockdownServiceDescriptorHandle, out MobileBackupClientHandle)
Connects to the mobilebackup service on the specified device.
Declaration
public static MobileBackupError mobilebackup_client_new(iDeviceHandle device, LockdownServiceDescriptorHandle service, out MobileBackupClientHandle client)
Parameters
Type | Name | Description |
---|---|---|
iDeviceHandle | device | The device to connect to. |
LockdownServiceDescriptorHandle | service | The service descriptor returned by lockdownd_start_service. |
MobileBackupClientHandle | client | Pointer that will be set to a newly allocated mobilebackup_client_t upon successful return. |
Returns
Type | Description |
---|---|
MobileBackupError | MOBILEBACKUP_E_SUCCESS on success, MOBILEBACKUP_E_INVALID ARG if one or more parameters are invalid, or DEVICE_LINK_SERVICE_E_BAD_VERSION if the mobilebackup version on the device is newer. |
mobilebackup_client_start_service(iDeviceHandle, out MobileBackupClientHandle, String)
Starts a new mobilebackup service on the specified device and connects to it.
Declaration
public static MobileBackupError mobilebackup_client_start_service(iDeviceHandle device, out MobileBackupClientHandle client, string label)
Parameters
Type | Name | Description |
---|---|---|
iDeviceHandle | device | The device to connect to. |
MobileBackupClientHandle | client | Pointer that will point to a newly allocated mobilebackup_client_t upon successful return. Must be freed using mobilebackup_client_free() after use. |
System.String | label | The label to use for communication. Usually the program name. Pass NULL to disable sending the label in requests to lockdownd. |
Returns
Type | Description |
---|---|
MobileBackupError | MOBILEBACKUP_E_SUCCESS on success, or an MOBILEBACKUP_E_* error code otherwise. |
mobilebackup_receive(MobileBackupClientHandle, out PlistHandle)
Polls the device for mobilebackup data.
Declaration
public static MobileBackupError mobilebackup_receive(MobileBackupClientHandle client, out PlistHandle plist)
Parameters
Type | Name | Description |
---|---|---|
MobileBackupClientHandle | client | The mobilebackup client |
PlistHandle | plist | A pointer to the location where the plist should be stored |
Returns
Type | Description |
---|---|
MobileBackupError | an error code |
mobilebackup_receive_restore_application_received(MobileBackupClientHandle, out PlistHandle)
Receive a confirmation from the device that it successfully received application data file.
Declaration
public static MobileBackupError mobilebackup_receive_restore_application_received(MobileBackupClientHandle client, out PlistHandle result)
Parameters
Type | Name | Description |
---|---|---|
MobileBackupClientHandle | client | The connected MobileBackup client to use. |
PlistHandle | result | Pointer to a plist_t that will be set to the received plist for further processing. The caller has to free it using plist_free(). Note that it will be set to NULL if the operation itself fails due to a communication or plist error. If this parameter is NULL, it will be ignored. |
Returns
Type | Description |
---|---|
MobileBackupError | MOBILEBACKUP_E_SUCCESS on success, MOBILEBACKUP_E_INVALID_ARG if client is invalid, MOBILEBACKUP_E_REPLY_NOT_OK if the expected 'BackupMessageRestoreApplicationReceived' message could not be received, MOBILEBACKUP_E_PLIST_ERROR if the received message is not a valid backup message plist, or MOBILEBACKUP_E_MUX_ERROR if a communication error occurs. |
mobilebackup_receive_restore_file_received(MobileBackupClientHandle, out PlistHandle)
Receive a confirmation from the device that it successfully received a restore file.
Declaration
public static MobileBackupError mobilebackup_receive_restore_file_received(MobileBackupClientHandle client, out PlistHandle result)
Parameters
Type | Name | Description |
---|---|---|
MobileBackupClientHandle | client | The connected MobileBackup client to use. |
PlistHandle | result | Pointer to a plist_t that will be set to the received plist for further processing. The caller has to free it using plist_free(). Note that it will be set to NULL if the operation itself fails due to a communication or plist error. If this parameter is NULL, it will be ignored. |
Returns
Type | Description |
---|---|
MobileBackupError | MOBILEBACKUP_E_SUCCESS on success, MOBILEBACKUP_E_INVALID_ARG if client is invalid, MOBILEBACKUP_E_REPLY_NOT_OK if the expected 'BackupMessageRestoreFileReceived' message could not be received, MOBILEBACKUP_E_PLIST_ERROR if the received message is not a valid backup message plist, or MOBILEBACKUP_E_MUX_ERROR if a communication error occurs. |
mobilebackup_request_backup(MobileBackupClientHandle, PlistHandle, String, String)
Request a backup from the connected device.
Declaration
public static MobileBackupError mobilebackup_request_backup(MobileBackupClientHandle client, PlistHandle backupManifest, string basePath, string protoVersion)
Parameters
Type | Name | Description |
---|---|---|
MobileBackupClientHandle | client | The connected MobileBackup client to use. |
PlistHandle | backupManifest | |
System.String | basePath | |
System.String | protoVersion |
Returns
Type | Description |
---|---|
MobileBackupError | MOBILEBACKUP_E_SUCCESS on success, MOBILEBACKUP_E_INVALID_ARG if one of the parameters is invalid, MOBILEBACKUP_E_PLIST_ERROR if backup_manifest is not of type PLIST_DICT, MOBILEBACKUP_E_MUX_ERROR if a communication error occurs, MOBILEBACKUP_E_REPLY_NOT_OK |
mobilebackup_request_restore(MobileBackupClientHandle, PlistHandle, MobileBackupFlags, String)
Request that a backup should be restored to the connected device.
Declaration
public static MobileBackupError mobilebackup_request_restore(MobileBackupClientHandle client, PlistHandle backupManifest, MobileBackupFlags flags, string protoVersion)
Parameters
Type | Name | Description |
---|---|---|
MobileBackupClientHandle | client | The connected MobileBackup client to use. |
PlistHandle | backupManifest | |
MobileBackupFlags | flags | Flags to send with the request. Currently this is a combination of the following mobilebackup_flags_t: MB_RESTORE_NOTIFY_SPRINGBOARD - let SpringBoard show a 'Restore' screen MB_RESTORE_PRESERVE_SETTINGS - do not overwrite any settings MB_RESTORE_PRESERVE_CAMERA_ROLL - preserve the photos of the camera roll |
System.String | protoVersion |
Returns
Type | Description |
---|---|
MobileBackupError | MOBILEBACKUP_E_SUCCESS on success, MOBILEBACKUP_E_INVALID_ARG if one of the parameters is invalid, MOBILEBACKUP_E_PLIST_ERROR if backup_manifest is not of type PLIST_DICT, MOBILEBACKUP_E_MUX_ERROR if a communication error occurs, or MOBILEBACKUP_E_REPLY_NOT_OK if the device did not accept the request. |
mobilebackup_send(MobileBackupClientHandle, PlistHandle)
Sends mobilebackup data to the device
Declaration
public static MobileBackupError mobilebackup_send(MobileBackupClientHandle client, PlistHandle plist)
Parameters
Type | Name | Description |
---|---|---|
MobileBackupClientHandle | client | The mobilebackup client |
PlistHandle | plist | The location of the plist to send |
Returns
Type | Description |
---|---|
MobileBackupError | an error code |
Remarks
This function is low-level and should only be used if you need to send a new type of message.
mobilebackup_send_backup_file_received(MobileBackupClientHandle)
Sends a confirmation to the device that a backup file has been received.
Declaration
public static MobileBackupError mobilebackup_send_backup_file_received(MobileBackupClientHandle client)
Parameters
Type | Name | Description |
---|---|---|
MobileBackupClientHandle | client | The connected MobileBackup client to use. |
Returns
Type | Description |
---|---|
MobileBackupError | MOBILEBACKUP_E_SUCCESS on success, MOBILEBACKUP_E_INVALID_ARG if client is invalid, or MOBILEBACKUP_E_MUX_ERROR if a communication error occurs. |
mobilebackup_send_error(MobileBackupClientHandle, String)
Sends a backup error message to the device.
Declaration
public static MobileBackupError mobilebackup_send_error(MobileBackupClientHandle client, string reason)
Parameters
Type | Name | Description |
---|---|---|
MobileBackupClientHandle | client | The connected MobileBackup client to use. |
System.String | reason | A string describing the reason for the error message. |
Returns
Type | Description |
---|---|
MobileBackupError | MOBILEBACKUP_E_SUCCESS on success, MOBILEBACKUP_E_INVALID_ARG if one of the parameters is invalid, or MOBILEBACKUP_E_MUX_ERROR if a communication error occurs. |
mobilebackup_send_restore_complete(MobileBackupClientHandle)
Tells the device that the restore process is complete and waits for the device to close the connection. After that, the device should reboot.
Declaration
public static MobileBackupError mobilebackup_send_restore_complete(MobileBackupClientHandle client)
Parameters
Type | Name | Description |
---|---|---|
MobileBackupClientHandle | client | The connected MobileBackup client to use. |
Returns
Type | Description |
---|---|
MobileBackupError | MOBILEBACKUP_E_SUCCESS on success, MOBILEBACKUP_E_INVALID_ARG if client is invalid, MOBILEBACKUP_E_PLIST_ERROR if the received disconnect message plist is invalid, or MOBILEBACKUP_E_MUX_ERROR if a communication error occurs. |