@mcesystems/apple-kit 1.0.24 → 1.0.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +284 -250
- package/dist/index.js +156 -22
- package/dist/index.js.map +3 -3
- package/dist/index.mjs +156 -24
- package/dist/index.mjs.map +3 -3
- package/dist/resources/bin/darwin/idevice_id +0 -0
- package/dist/resources/bin/darwin/idevicedebug +0 -0
- package/dist/resources/bin/darwin/idevicediagnostics +0 -0
- package/dist/resources/bin/darwin/ideviceinfo +0 -0
- package/dist/resources/bin/darwin/ideviceinstaller +0 -0
- package/dist/resources/bin/darwin/idevicename +0 -0
- package/dist/resources/bin/darwin/idevicepair +0 -0
- package/dist/resources/bin/darwin/idevicescreenshot +0 -0
- package/dist/resources/bin/darwin/idevicesyslog +0 -0
- package/dist/resources/bin/darwin/iproxy +0 -0
- package/dist/resources/bin/darwin/libcrypto.3.dylib +0 -0
- package/dist/resources/bin/darwin/libimobiledevice-1.0.6.dylib +0 -0
- package/dist/resources/bin/darwin/libimobiledevice-glue-1.0.0.dylib +0 -0
- package/dist/resources/bin/darwin/liblzma.5.dylib +0 -0
- package/dist/resources/bin/darwin/libplist-2.0.4.dylib +0 -0
- package/dist/resources/bin/darwin/libssl.3.dylib +0 -0
- package/dist/resources/bin/darwin/libusbmuxd-2.0.7.dylib +0 -0
- package/dist/resources/bin/darwin/libzip.5.dylib +0 -0
- package/dist/resources/bin/darwin/libzstd.1.dylib +0 -0
- package/{resources → dist/resources}/licenses/LGPL-2.1.txt +33 -33
- package/dist/types/logic/actions/device.d.ts.map +1 -1
- package/dist/types/logic/actions/proxy.d.ts.map +1 -1
- package/dist/types/logic/appleDeviceKit.d.ts +1 -1
- package/dist/types/logic/appleDeviceKit.d.ts.map +1 -1
- package/package.json +7 -4
- package/scripts/README.md +209 -0
- package/scripts/build-windows.sh.template +134 -0
- package/scripts/export-resources.ts +444 -0
- package/dist/types/utils/portManager.d.ts +0 -68
- package/dist/types/utils/portManager.d.ts.map +0 -1
- package/resources/bin/windows/bz2.dll +0 -0
- package/resources/bin/windows/getopt.dll +0 -0
- package/resources/bin/windows/iconv-2.dll +0 -0
- package/resources/bin/windows/idevice_id.exe +0 -0
- package/resources/bin/windows/ideviceactivation.exe +0 -0
- package/resources/bin/windows/idevicedebug.exe +0 -0
- package/resources/bin/windows/ideviceinfo.exe +0 -0
- package/resources/bin/windows/ideviceinstaller.exe +0 -0
- package/resources/bin/windows/idevicepair.exe +0 -0
- package/resources/bin/windows/imobiledevice.dll +0 -0
- package/resources/bin/windows/iproxy.exe +0 -0
- package/resources/bin/windows/libcrypto-1_1-x64.dll +0 -0
- package/resources/bin/windows/libcurl.dll +0 -0
- package/resources/bin/windows/libideviceactivation-1.0.dll +0 -0
- package/resources/bin/windows/libimobiledevice-1.0.dll +0 -0
- package/resources/bin/windows/libimobiledevice-glue-1.0.dll +0 -0
- package/resources/bin/windows/libplist-2.0.dll +0 -0
- package/resources/bin/windows/libssl-1_1-x64.dll +0 -0
- package/resources/bin/windows/libusb-1.0.dll +0 -0
- package/resources/bin/windows/libusb0.dll +0 -0
- package/resources/bin/windows/libusbmuxd-2.0.dll +0 -0
- package/resources/bin/windows/libxml2.dll +0 -0
- package/resources/bin/windows/lzma.dll +0 -0
- package/resources/bin/windows/pcre.dll +0 -0
- package/resources/bin/windows/pcreposix.dll +0 -0
- package/resources/bin/windows/plist.dll +0 -0
- package/resources/bin/windows/pthreadVC3.dll +0 -0
- package/resources/bin/windows/readline.dll +0 -0
- package/resources/bin/windows/usbmuxd.dll +0 -0
- package/resources/bin/windows/usbmuxd.exe +0 -0
- package/resources/bin/windows/vcruntime140.dll +0 -0
- package/resources/bin/windows/zip.dll +0 -0
- package/resources/bin/windows/zlib1.dll +0 -0
- package/resources/lib/include/libimobiledevice/afc.h +0 -413
- package/resources/lib/include/libimobiledevice/bt_packet_logger.h +0 -156
- package/resources/lib/include/libimobiledevice/companion_proxy.h +0 -212
- package/resources/lib/include/libimobiledevice/debugserver.h +0 -272
- package/resources/lib/include/libimobiledevice/diagnostics_relay.h +0 -228
- package/resources/lib/include/libimobiledevice/file_relay.h +0 -166
- package/resources/lib/include/libimobiledevice/heartbeat.h +0 -137
- package/resources/lib/include/libimobiledevice/house_arrest.h +0 -180
- package/resources/lib/include/libimobiledevice/installation_proxy.h +0 -505
- package/resources/lib/include/libimobiledevice/libimobiledevice.h +0 -444
- package/resources/lib/include/libimobiledevice/lockdown.h +0 -577
- package/resources/lib/include/libimobiledevice/misagent.h +0 -168
- package/resources/lib/include/libimobiledevice/mobile_image_mounter.h +0 -275
- package/resources/lib/include/libimobiledevice/mobileactivation.h +0 -192
- package/resources/lib/include/libimobiledevice/mobilebackup.h +0 -246
- package/resources/lib/include/libimobiledevice/mobilebackup2.h +0 -214
- package/resources/lib/include/libimobiledevice/mobilesync.h +0 -359
- package/resources/lib/include/libimobiledevice/notification_proxy.h +0 -202
- package/resources/lib/include/libimobiledevice/ostrace.h +0 -198
- package/resources/lib/include/libimobiledevice/preboard.h +0 -187
- package/resources/lib/include/libimobiledevice/property_list_service.h +0 -184
- package/resources/lib/include/libimobiledevice/restore.h +0 -179
- package/resources/lib/include/libimobiledevice/reverse_proxy.h +0 -213
- package/resources/lib/include/libimobiledevice/sbservices.h +0 -175
- package/resources/lib/include/libimobiledevice/screenshotr.h +0 -118
- package/resources/lib/include/libimobiledevice/service.h +0 -202
- package/resources/lib/include/libimobiledevice/syslog_relay.h +0 -184
- package/resources/lib/include/libimobiledevice/webinspector.h +0 -137
- package/resources/lib/include/plist/Array.h +0 -80
- package/resources/lib/include/plist/Boolean.h +0 -48
- package/resources/lib/include/plist/Data.h +0 -50
- package/resources/lib/include/plist/Date.h +0 -54
- package/resources/lib/include/plist/Dictionary.h +0 -73
- package/resources/lib/include/plist/Integer.h +0 -54
- package/resources/lib/include/plist/Key.h +0 -49
- package/resources/lib/include/plist/Node.h +0 -57
- package/resources/lib/include/plist/Real.h +0 -48
- package/resources/lib/include/plist/String.h +0 -52
- package/resources/lib/include/plist/Structure.h +0 -62
- package/resources/lib/include/plist/Uid.h +0 -48
- package/resources/lib/include/plist/plist++.h +0 -39
- package/resources/lib/include/plist/plist.h +0 -1448
- package/resources/lib/libimobiledevice-1.0.dll +0 -0
- package/resources/lib/libimobiledevice-1.0.dll.a +0 -0
- package/resources/lib/libplist-2.0.dll +0 -0
- package/resources/lib/libplist-2.0.dll.a +0 -0
|
@@ -1,246 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file libimobiledevice/mobilebackup.h
|
|
3
|
-
* @brief Backup and restore of all device data.
|
|
4
|
-
* \internal
|
|
5
|
-
*
|
|
6
|
-
* Copyright (c) 2010-2019 Nikias Bassen, All Rights Reserved.
|
|
7
|
-
* Copyright (c) 2009-2014 Martin Szulecki, All Rights Reserved.
|
|
8
|
-
*
|
|
9
|
-
* This library is free software; you can redistribute it and/or
|
|
10
|
-
* modify it under the terms of the GNU Lesser General Public
|
|
11
|
-
* License as published by the Free Software Foundation; either
|
|
12
|
-
* version 2.1 of the License, or (at your option) any later version.
|
|
13
|
-
*
|
|
14
|
-
* This library is distributed in the hope that it will be useful,
|
|
15
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
16
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
17
|
-
* Lesser General Public License for more details.
|
|
18
|
-
*
|
|
19
|
-
* You should have received a copy of the GNU Lesser General Public
|
|
20
|
-
* License along with this library; if not, write to the Free Software
|
|
21
|
-
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
22
|
-
*/
|
|
23
|
-
|
|
24
|
-
#ifndef IMOBILEBACKUP_H
|
|
25
|
-
#define IMOBILEBACKUP_H
|
|
26
|
-
|
|
27
|
-
#ifdef __cplusplus
|
|
28
|
-
extern "C" {
|
|
29
|
-
#endif
|
|
30
|
-
|
|
31
|
-
#include <libimobiledevice/libimobiledevice.h>
|
|
32
|
-
#include <libimobiledevice/lockdown.h>
|
|
33
|
-
|
|
34
|
-
/** Service identifier passed to lockdownd_start_service() to start the mobilebackup service */
|
|
35
|
-
#define MOBILEBACKUP_SERVICE_NAME "com.apple.mobilebackup"
|
|
36
|
-
|
|
37
|
-
/** Error Codes */
|
|
38
|
-
typedef enum {
|
|
39
|
-
MOBILEBACKUP_E_SUCCESS = 0,
|
|
40
|
-
MOBILEBACKUP_E_INVALID_ARG = -1,
|
|
41
|
-
MOBILEBACKUP_E_PLIST_ERROR = -2,
|
|
42
|
-
MOBILEBACKUP_E_MUX_ERROR = -3,
|
|
43
|
-
MOBILEBACKUP_E_SSL_ERROR = -4,
|
|
44
|
-
MOBILEBACKUP_E_RECEIVE_TIMEOUT = -5,
|
|
45
|
-
MOBILEBACKUP_E_BAD_VERSION = -6,
|
|
46
|
-
MOBILEBACKUP_E_REPLY_NOT_OK = -7,
|
|
47
|
-
MOBILEBACKUP_E_UNKNOWN_ERROR = -256
|
|
48
|
-
} mobilebackup_error_t;
|
|
49
|
-
|
|
50
|
-
typedef struct mobilebackup_client_private mobilebackup_client_private; /**< \private */
|
|
51
|
-
typedef mobilebackup_client_private *mobilebackup_client_t; /**< The client handle. */
|
|
52
|
-
|
|
53
|
-
/** Available flags passed to #mobilebackup_request_restore */
|
|
54
|
-
typedef enum {
|
|
55
|
-
MB_RESTORE_NOTIFY_SPRINGBOARD = 1 << 0,
|
|
56
|
-
MB_RESTORE_PRESERVE_SETTINGS = 1 << 1,
|
|
57
|
-
MB_RESTORE_PRESERVE_CAMERA_ROLL = 1 << 2
|
|
58
|
-
} mobilebackup_flags_t;
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* Connects to the mobilebackup service on the specified device.
|
|
62
|
-
*
|
|
63
|
-
* @param device The device to connect to.
|
|
64
|
-
* @param service The service descriptor returned by lockdownd_start_service.
|
|
65
|
-
* @param client Pointer that will be set to a newly allocated
|
|
66
|
-
* mobilebackup_client_t upon successful return.
|
|
67
|
-
*
|
|
68
|
-
* @return MOBILEBACKUP_E_SUCCESS on success, MOBILEBACKUP_E_INVALID ARG if one
|
|
69
|
-
* or more parameters are invalid, or DEVICE_LINK_SERVICE_E_BAD_VERSION if
|
|
70
|
-
* the mobilebackup version on the device is newer.
|
|
71
|
-
*/
|
|
72
|
-
LIBIMOBILEDEVICE_API mobilebackup_error_t mobilebackup_client_new(idevice_t device, lockdownd_service_descriptor_t service, mobilebackup_client_t * client);
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* Starts a new mobilebackup service on the specified device and connects to it.
|
|
76
|
-
*
|
|
77
|
-
* @param device The device to connect to.
|
|
78
|
-
* @param client Pointer that will point to a newly allocated
|
|
79
|
-
* mobilebackup_client_t upon successful return. Must be freed using
|
|
80
|
-
* mobilebackup_client_free() after use.
|
|
81
|
-
* @param label The label to use for communication. Usually the program name.
|
|
82
|
-
* Pass NULL to disable sending the label in requests to lockdownd.
|
|
83
|
-
*
|
|
84
|
-
* @return MOBILEBACKUP_E_SUCCESS on success, or an MOBILEBACKUP_E_* error
|
|
85
|
-
* code otherwise.
|
|
86
|
-
*/
|
|
87
|
-
LIBIMOBILEDEVICE_API mobilebackup_error_t mobilebackup_client_start_service(idevice_t device, mobilebackup_client_t* client, const char* label);
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* Disconnects a mobilebackup client from the device and frees up the
|
|
91
|
-
* mobilebackup client data.
|
|
92
|
-
*
|
|
93
|
-
* @param client The mobilebackup client to disconnect and free.
|
|
94
|
-
*
|
|
95
|
-
* @return MOBILEBACKUP_E_SUCCESS on success, or MOBILEBACKUP_E_INVALID_ARG
|
|
96
|
-
* if client is NULL.
|
|
97
|
-
*/
|
|
98
|
-
LIBIMOBILEDEVICE_API mobilebackup_error_t mobilebackup_client_free(mobilebackup_client_t client);
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
/**
|
|
102
|
-
* Polls the device for mobilebackup data.
|
|
103
|
-
*
|
|
104
|
-
* @param client The mobilebackup client
|
|
105
|
-
* @param plist A pointer to the location where the plist should be stored
|
|
106
|
-
*
|
|
107
|
-
* @return an error code
|
|
108
|
-
*/
|
|
109
|
-
LIBIMOBILEDEVICE_API mobilebackup_error_t mobilebackup_receive(mobilebackup_client_t client, plist_t *plist);
|
|
110
|
-
|
|
111
|
-
/**
|
|
112
|
-
* Sends mobilebackup data to the device
|
|
113
|
-
*
|
|
114
|
-
* @note This function is low-level and should only be used if you need to send
|
|
115
|
-
* a new type of message.
|
|
116
|
-
*
|
|
117
|
-
* @param client The mobilebackup client
|
|
118
|
-
* @param plist The location of the plist to send
|
|
119
|
-
*
|
|
120
|
-
* @return an error code
|
|
121
|
-
*/
|
|
122
|
-
LIBIMOBILEDEVICE_API mobilebackup_error_t mobilebackup_send(mobilebackup_client_t client, plist_t plist);
|
|
123
|
-
|
|
124
|
-
/**
|
|
125
|
-
* Request a backup from the connected device.
|
|
126
|
-
*
|
|
127
|
-
* @param client The connected MobileBackup client to use.
|
|
128
|
-
* @param backup_manifest The backup manifest, a plist_t of type PLIST_DICT
|
|
129
|
-
* containing the backup state of the last backup. For a first-time backup
|
|
130
|
-
* set this parameter to NULL.
|
|
131
|
-
* @param base_path The base path on the device to use for the backup
|
|
132
|
-
* operation, usually "/".
|
|
133
|
-
* @param proto_version A string denoting the version of the backup protocol
|
|
134
|
-
* to use. Latest known version is "1.6"
|
|
135
|
-
*
|
|
136
|
-
* @return MOBILEBACKUP_E_SUCCESS on success, MOBILEBACKUP_E_INVALID_ARG if
|
|
137
|
-
* one of the parameters is invalid, MOBILEBACKUP_E_PLIST_ERROR if
|
|
138
|
-
* backup_manifest is not of type PLIST_DICT, MOBILEBACKUP_E_MUX_ERROR
|
|
139
|
-
* if a communication error occurs, MOBILEBACKUP_E_REPLY_NOT_OK
|
|
140
|
-
*/
|
|
141
|
-
LIBIMOBILEDEVICE_API mobilebackup_error_t mobilebackup_request_backup(mobilebackup_client_t client, plist_t backup_manifest, const char *base_path, const char *proto_version);
|
|
142
|
-
|
|
143
|
-
/**
|
|
144
|
-
* Sends a confirmation to the device that a backup file has been received.
|
|
145
|
-
*
|
|
146
|
-
* @param client The connected MobileBackup client to use.
|
|
147
|
-
*
|
|
148
|
-
* @return MOBILEBACKUP_E_SUCCESS on success, MOBILEBACKUP_E_INVALID_ARG if
|
|
149
|
-
* client is invalid, or MOBILEBACKUP_E_MUX_ERROR if a communication error
|
|
150
|
-
* occurs.
|
|
151
|
-
*/
|
|
152
|
-
LIBIMOBILEDEVICE_API mobilebackup_error_t mobilebackup_send_backup_file_received(mobilebackup_client_t client);
|
|
153
|
-
|
|
154
|
-
/**
|
|
155
|
-
* Request that a backup should be restored to the connected device.
|
|
156
|
-
*
|
|
157
|
-
* @param client The connected MobileBackup client to use.
|
|
158
|
-
* @param backup_manifest The backup manifest, a plist_t of type PLIST_DICT
|
|
159
|
-
* containing the backup state to be restored.
|
|
160
|
-
* @param flags Flags to send with the request. Currently this is a combination
|
|
161
|
-
* of the following mobilebackup_flags_t:
|
|
162
|
-
* MB_RESTORE_NOTIFY_SPRINGBOARD - let SpringBoard show a 'Restore' screen
|
|
163
|
-
* MB_RESTORE_PRESERVE_SETTINGS - do not overwrite any settings
|
|
164
|
-
* MB_RESTORE_PRESERVE_CAMERA_ROLL - preserve the photos of the camera roll
|
|
165
|
-
* @param proto_version A string denoting the version of the backup protocol
|
|
166
|
-
* to use. Latest known version is "1.6". Ideally this value should be
|
|
167
|
-
* extracted from the given manifest plist.
|
|
168
|
-
*
|
|
169
|
-
* @return MOBILEBACKUP_E_SUCCESS on success, MOBILEBACKUP_E_INVALID_ARG if
|
|
170
|
-
* one of the parameters is invalid, MOBILEBACKUP_E_PLIST_ERROR if
|
|
171
|
-
* backup_manifest is not of type PLIST_DICT, MOBILEBACKUP_E_MUX_ERROR
|
|
172
|
-
* if a communication error occurs, or MOBILEBACKUP_E_REPLY_NOT_OK
|
|
173
|
-
* if the device did not accept the request.
|
|
174
|
-
*/
|
|
175
|
-
LIBIMOBILEDEVICE_API mobilebackup_error_t mobilebackup_request_restore(mobilebackup_client_t client, plist_t backup_manifest, mobilebackup_flags_t flags, const char *proto_version);
|
|
176
|
-
|
|
177
|
-
/**
|
|
178
|
-
* Receive a confirmation from the device that it successfully received
|
|
179
|
-
* a restore file.
|
|
180
|
-
*
|
|
181
|
-
* @param client The connected MobileBackup client to use.
|
|
182
|
-
* @param result Pointer to a plist_t that will be set to the received plist
|
|
183
|
-
* for further processing. The caller has to free it using plist_free().
|
|
184
|
-
* Note that it will be set to NULL if the operation itself fails due to
|
|
185
|
-
* a communication or plist error.
|
|
186
|
-
* If this parameter is NULL, it will be ignored.
|
|
187
|
-
*
|
|
188
|
-
* @return MOBILEBACKUP_E_SUCCESS on success, MOBILEBACKUP_E_INVALID_ARG if
|
|
189
|
-
* client is invalid, MOBILEBACKUP_E_REPLY_NOT_OK if the expected
|
|
190
|
-
* 'BackupMessageRestoreFileReceived' message could not be received,
|
|
191
|
-
* MOBILEBACKUP_E_PLIST_ERROR if the received message is not a valid backup
|
|
192
|
-
* message plist, or MOBILEBACKUP_E_MUX_ERROR if a communication error
|
|
193
|
-
* occurs.
|
|
194
|
-
*/
|
|
195
|
-
LIBIMOBILEDEVICE_API mobilebackup_error_t mobilebackup_receive_restore_file_received(mobilebackup_client_t client, plist_t *result);
|
|
196
|
-
|
|
197
|
-
/**
|
|
198
|
-
* Receive a confirmation from the device that it successfully received
|
|
199
|
-
* application data file.
|
|
200
|
-
*
|
|
201
|
-
* @param client The connected MobileBackup client to use.
|
|
202
|
-
* @param result Pointer to a plist_t that will be set to the received plist
|
|
203
|
-
* for further processing. The caller has to free it using plist_free().
|
|
204
|
-
* Note that it will be set to NULL if the operation itself fails due to
|
|
205
|
-
* a communication or plist error.
|
|
206
|
-
* If this parameter is NULL, it will be ignored.
|
|
207
|
-
*
|
|
208
|
-
* @return MOBILEBACKUP_E_SUCCESS on success, MOBILEBACKUP_E_INVALID_ARG if
|
|
209
|
-
* client is invalid, MOBILEBACKUP_E_REPLY_NOT_OK if the expected
|
|
210
|
-
* 'BackupMessageRestoreApplicationReceived' message could not be received,
|
|
211
|
-
* MOBILEBACKUP_E_PLIST_ERROR if the received message is not a valid backup
|
|
212
|
-
* message plist, or MOBILEBACKUP_E_MUX_ERROR if a communication error
|
|
213
|
-
* occurs.
|
|
214
|
-
*/
|
|
215
|
-
LIBIMOBILEDEVICE_API mobilebackup_error_t mobilebackup_receive_restore_application_received(mobilebackup_client_t client, plist_t *result);
|
|
216
|
-
|
|
217
|
-
/**
|
|
218
|
-
* Tells the device that the restore process is complete and waits for the
|
|
219
|
-
* device to close the connection. After that, the device should reboot.
|
|
220
|
-
*
|
|
221
|
-
* @param client The connected MobileBackup client to use.
|
|
222
|
-
*
|
|
223
|
-
* @return MOBILEBACKUP_E_SUCCESS on success, MOBILEBACKUP_E_INVALID_ARG if
|
|
224
|
-
* client is invalid, MOBILEBACKUP_E_PLIST_ERROR if the received disconnect
|
|
225
|
-
* message plist is invalid, or MOBILEBACKUP_E_MUX_ERROR if a communication
|
|
226
|
-
* error occurs.
|
|
227
|
-
*/
|
|
228
|
-
LIBIMOBILEDEVICE_API mobilebackup_error_t mobilebackup_send_restore_complete(mobilebackup_client_t client);
|
|
229
|
-
|
|
230
|
-
/**
|
|
231
|
-
* Sends a backup error message to the device.
|
|
232
|
-
*
|
|
233
|
-
* @param client The connected MobileBackup client to use.
|
|
234
|
-
* @param reason A string describing the reason for the error message.
|
|
235
|
-
*
|
|
236
|
-
* @return MOBILEBACKUP_E_SUCCESS on success, MOBILEBACKUP_E_INVALID_ARG if
|
|
237
|
-
* one of the parameters is invalid, or MOBILEBACKUP_E_MUX_ERROR if a
|
|
238
|
-
* communication error occurs.
|
|
239
|
-
*/
|
|
240
|
-
LIBIMOBILEDEVICE_API mobilebackup_error_t mobilebackup_send_error(mobilebackup_client_t client, const char *reason);
|
|
241
|
-
|
|
242
|
-
#ifdef __cplusplus
|
|
243
|
-
}
|
|
244
|
-
#endif
|
|
245
|
-
|
|
246
|
-
#endif
|
|
@@ -1,214 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file libimobiledevice/mobilebackup2.h
|
|
3
|
-
* @brief Backup and restore of all device data (mobilebackup2, iOS4+ only)
|
|
4
|
-
* \internal
|
|
5
|
-
*
|
|
6
|
-
* Copyright (c) 2010-2019 Nikias Bassen, All Rights Reserved.
|
|
7
|
-
* Copyright (c) 2011-2014 Martin Szulecki, All Rights Reserved.
|
|
8
|
-
*
|
|
9
|
-
* This library is free software; you can redistribute it and/or
|
|
10
|
-
* modify it under the terms of the GNU Lesser General Public
|
|
11
|
-
* License as published by the Free Software Foundation; either
|
|
12
|
-
* version 2.1 of the License, or (at your option) any later version.
|
|
13
|
-
*
|
|
14
|
-
* This library is distributed in the hope that it will be useful,
|
|
15
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
16
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
17
|
-
* Lesser General Public License for more details.
|
|
18
|
-
*
|
|
19
|
-
* You should have received a copy of the GNU Lesser General Public
|
|
20
|
-
* License along with this library; if not, write to the Free Software
|
|
21
|
-
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
22
|
-
*/
|
|
23
|
-
|
|
24
|
-
#ifndef IMOBILEBACKUP2_H
|
|
25
|
-
#define IMOBILEBACKUP2_H
|
|
26
|
-
|
|
27
|
-
#ifdef __cplusplus
|
|
28
|
-
extern "C" {
|
|
29
|
-
#endif
|
|
30
|
-
|
|
31
|
-
#include <libimobiledevice/libimobiledevice.h>
|
|
32
|
-
#include <libimobiledevice/lockdown.h>
|
|
33
|
-
|
|
34
|
-
/** Service identifier passed to lockdownd_start_service() to start the mobilebackup2 service */
|
|
35
|
-
#define MOBILEBACKUP2_SERVICE_NAME "com.apple.mobilebackup2"
|
|
36
|
-
|
|
37
|
-
/** Error Codes */
|
|
38
|
-
typedef enum {
|
|
39
|
-
MOBILEBACKUP2_E_SUCCESS = 0,
|
|
40
|
-
MOBILEBACKUP2_E_INVALID_ARG = -1,
|
|
41
|
-
MOBILEBACKUP2_E_PLIST_ERROR = -2,
|
|
42
|
-
MOBILEBACKUP2_E_MUX_ERROR = -3,
|
|
43
|
-
MOBILEBACKUP2_E_SSL_ERROR = -4,
|
|
44
|
-
MOBILEBACKUP2_E_RECEIVE_TIMEOUT = -5,
|
|
45
|
-
MOBILEBACKUP2_E_BAD_VERSION = -6,
|
|
46
|
-
MOBILEBACKUP2_E_REPLY_NOT_OK = -7,
|
|
47
|
-
MOBILEBACKUP2_E_NO_COMMON_VERSION = -8,
|
|
48
|
-
MOBILEBACKUP2_E_UNKNOWN_ERROR = -256
|
|
49
|
-
} mobilebackup2_error_t;
|
|
50
|
-
|
|
51
|
-
typedef struct mobilebackup2_client_private mobilebackup2_client_private; /**< \private */
|
|
52
|
-
typedef mobilebackup2_client_private *mobilebackup2_client_t; /**< The client handle. */
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* Connects to the mobilebackup2 service on the specified device.
|
|
57
|
-
*
|
|
58
|
-
* @param device The device to connect to.
|
|
59
|
-
* @param service The service descriptor returned by lockdownd_start_service.
|
|
60
|
-
* @param client Pointer that will be set to a newly allocated
|
|
61
|
-
* mobilebackup2_client_t upon successful return.
|
|
62
|
-
*
|
|
63
|
-
* @return MOBILEBACKUP2_E_SUCCESS on success, MOBILEBACKUP2_E_INVALID ARG
|
|
64
|
-
* if one or more parameter is invalid, or MOBILEBACKUP2_E_BAD_VERSION
|
|
65
|
-
* if the mobilebackup2 version on the device is newer.
|
|
66
|
-
*/
|
|
67
|
-
LIBIMOBILEDEVICE_API mobilebackup2_error_t mobilebackup2_client_new(idevice_t device, lockdownd_service_descriptor_t service, mobilebackup2_client_t * client);
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* Starts a new mobilebackup2 service on the specified device and connects to it.
|
|
71
|
-
*
|
|
72
|
-
* @param device The device to connect to.
|
|
73
|
-
* @param client Pointer that will point to a newly allocated
|
|
74
|
-
* mobilebackup2_client_t upon successful return. Must be freed using
|
|
75
|
-
* mobilebackup2_client_free() after use.
|
|
76
|
-
* @param label The label to use for communication. Usually the program name.
|
|
77
|
-
* Pass NULL to disable sending the label in requests to lockdownd.
|
|
78
|
-
*
|
|
79
|
-
* @return MOBILEBACKUP2_E_SUCCESS on success, or an MOBILEBACKUP2_E_* error
|
|
80
|
-
* code otherwise.
|
|
81
|
-
*/
|
|
82
|
-
LIBIMOBILEDEVICE_API mobilebackup2_error_t mobilebackup2_client_start_service(idevice_t device, mobilebackup2_client_t* client, const char* label);
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
* Disconnects a mobilebackup2 client from the device and frees up the
|
|
86
|
-
* mobilebackup2 client data.
|
|
87
|
-
*
|
|
88
|
-
* @param client The mobilebackup2 client to disconnect and free.
|
|
89
|
-
*
|
|
90
|
-
* @return MOBILEBACKUP2_E_SUCCESS on success, or MOBILEBACKUP2_E_INVALID_ARG
|
|
91
|
-
* if client is NULL.
|
|
92
|
-
*/
|
|
93
|
-
LIBIMOBILEDEVICE_API mobilebackup2_error_t mobilebackup2_client_free(mobilebackup2_client_t client);
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
/**
|
|
97
|
-
* Sends a backup message plist.
|
|
98
|
-
*
|
|
99
|
-
* @param client The connected MobileBackup client to use.
|
|
100
|
-
* @param message The message to send. This will be inserted into the request
|
|
101
|
-
* plist as value for MessageName. If this parameter is NULL,
|
|
102
|
-
* the plist passed in the options parameter will be sent directly.
|
|
103
|
-
* @param options Additional options as PLIST_DICT to add to the request.
|
|
104
|
-
* The MessageName key with the value passed in the message parameter
|
|
105
|
-
* will be inserted into this plist before sending it. This parameter
|
|
106
|
-
* can be NULL if message is not NULL.
|
|
107
|
-
*/
|
|
108
|
-
LIBIMOBILEDEVICE_API mobilebackup2_error_t mobilebackup2_send_message(mobilebackup2_client_t client, const char *message, plist_t options);
|
|
109
|
-
|
|
110
|
-
/**
|
|
111
|
-
* Receives a DL* message plist from the device.
|
|
112
|
-
* This function is a wrapper around device_link_service_receive_message.
|
|
113
|
-
*
|
|
114
|
-
* @param client The connected MobileBackup client to use.
|
|
115
|
-
* @param msg_plist Pointer to a plist that will be set to the contents of the
|
|
116
|
-
* message plist upon successful return.
|
|
117
|
-
* @param dlmessage A pointer that will be set to a newly allocated char*
|
|
118
|
-
* containing the DL* string from the given plist. It is up to the caller
|
|
119
|
-
* to free the allocated memory. If this parameter is NULL
|
|
120
|
-
* it will be ignored.
|
|
121
|
-
*
|
|
122
|
-
* @return MOBILEBACKUP2_E_SUCCESS if a DL* message was received,
|
|
123
|
-
* MOBILEBACKUP2_E_INVALID_ARG if client or message is invalid,
|
|
124
|
-
* MOBILEBACKUP2_E_PLIST_ERROR if the received plist is invalid
|
|
125
|
-
* or is not a DL* message plist, or MOBILEBACKUP2_E_MUX_ERROR if
|
|
126
|
-
* receiving from the device failed.
|
|
127
|
-
*/
|
|
128
|
-
LIBIMOBILEDEVICE_API mobilebackup2_error_t mobilebackup2_receive_message(mobilebackup2_client_t client, plist_t *msg_plist, char **dlmessage);
|
|
129
|
-
|
|
130
|
-
/**
|
|
131
|
-
* Send binary data to the device.
|
|
132
|
-
*
|
|
133
|
-
* @note This function returns MOBILEBACKUP2_E_SUCCESS even if less than the
|
|
134
|
-
* requested length has been sent. The fourth parameter is required and
|
|
135
|
-
* must be checked to ensure if the whole data has been sent.
|
|
136
|
-
*
|
|
137
|
-
* @param client The MobileBackup client to send to.
|
|
138
|
-
* @param data Pointer to the data to send
|
|
139
|
-
* @param length Number of bytes to send
|
|
140
|
-
* @param bytes Number of bytes actually sent
|
|
141
|
-
*
|
|
142
|
-
* @return MOBILEBACKUP2_E_SUCCESS if any data was successfully sent,
|
|
143
|
-
* MOBILEBACKUP2_E_INVALID_ARG if one of the parameters is invalid,
|
|
144
|
-
* or MOBILEBACKUP2_E_MUX_ERROR if sending of the data failed.
|
|
145
|
-
*/
|
|
146
|
-
LIBIMOBILEDEVICE_API mobilebackup2_error_t mobilebackup2_send_raw(mobilebackup2_client_t client, const char *data, uint32_t length, uint32_t *bytes);
|
|
147
|
-
|
|
148
|
-
/**
|
|
149
|
-
* Receive binary from the device.
|
|
150
|
-
*
|
|
151
|
-
* @note This function returns MOBILEBACKUP2_E_SUCCESS even if no data
|
|
152
|
-
* has been received (unless a communication error occurred).
|
|
153
|
-
* The fourth parameter is required and must be checked to know how
|
|
154
|
-
* many bytes were actually received.
|
|
155
|
-
*
|
|
156
|
-
* @param client The MobileBackup client to receive from.
|
|
157
|
-
* @param data Pointer to a buffer that will be filled with the received data.
|
|
158
|
-
* @param length Number of bytes to receive. The data buffer needs to be large
|
|
159
|
-
* enough to store this amount of data.
|
|
160
|
-
* @param bytes Number of bytes actually received.
|
|
161
|
-
*
|
|
162
|
-
* @return MOBILEBACKUP2_E_SUCCESS if any or no data was received,
|
|
163
|
-
* MOBILEBACKUP2_E_INVALID_ARG if one of the parameters is invalid,
|
|
164
|
-
* or MOBILEBACKUP2_E_MUX_ERROR if receiving the data failed.
|
|
165
|
-
*/
|
|
166
|
-
LIBIMOBILEDEVICE_API mobilebackup2_error_t mobilebackup2_receive_raw(mobilebackup2_client_t client, char *data, uint32_t length, uint32_t *bytes);
|
|
167
|
-
|
|
168
|
-
/**
|
|
169
|
-
* Performs the mobilebackup2 protocol version exchange.
|
|
170
|
-
*
|
|
171
|
-
* @param client The MobileBackup client to use.
|
|
172
|
-
* @param local_versions An array of supported versions to send to the remote.
|
|
173
|
-
* @param count The number of items in local_versions.
|
|
174
|
-
* @param remote_version Holds the protocol version of the remote on success.
|
|
175
|
-
*
|
|
176
|
-
* @return MOBILEBACKUP2_E_SUCCESS on success, or a MOBILEBACKUP2_E_* error
|
|
177
|
-
* code otherwise.
|
|
178
|
-
*/
|
|
179
|
-
LIBIMOBILEDEVICE_API mobilebackup2_error_t mobilebackup2_version_exchange(mobilebackup2_client_t client, double local_versions[], char count, double *remote_version);
|
|
180
|
-
|
|
181
|
-
/**
|
|
182
|
-
* Send a request to the connected mobilebackup2 service.
|
|
183
|
-
*
|
|
184
|
-
* @param client
|
|
185
|
-
* @param request The request to send to the backup service.
|
|
186
|
-
* Currently, this is one of "Backup", "Restore", "Info", or "List".
|
|
187
|
-
* @param target_identifier UDID of the target device.
|
|
188
|
-
* @param source_identifier UDID of backup data?
|
|
189
|
-
* @param options Additional options in a plist of type PLIST_DICT.
|
|
190
|
-
*
|
|
191
|
-
* @return MOBILEBACKUP2_E_SUCCESS if the request was successfully sent,
|
|
192
|
-
* or a MOBILEBACKUP2_E_* error value otherwise.
|
|
193
|
-
*/
|
|
194
|
-
LIBIMOBILEDEVICE_API mobilebackup2_error_t mobilebackup2_send_request(mobilebackup2_client_t client, const char *request, const char *target_identifier, const char *source_identifier, plist_t options);
|
|
195
|
-
|
|
196
|
-
/**
|
|
197
|
-
* Sends a DLMessageStatusResponse to the device.
|
|
198
|
-
*
|
|
199
|
-
* @param client The MobileBackup client to use.
|
|
200
|
-
* @param status_code The status code to send.
|
|
201
|
-
* @param status1 A status message to send. Can be NULL if not required.
|
|
202
|
-
* @param status2 An additional status plist to attach to the response.
|
|
203
|
-
* Can be NULL if not required.
|
|
204
|
-
*
|
|
205
|
-
* @return MOBILEBACKUP2_E_SUCCESS on success, MOBILEBACKUP2_E_INVALID_ARG
|
|
206
|
-
* if client is invalid, or another MOBILEBACKUP2_E_* otherwise.
|
|
207
|
-
*/
|
|
208
|
-
LIBIMOBILEDEVICE_API mobilebackup2_error_t mobilebackup2_send_status_response(mobilebackup2_client_t client, int status_code, const char *status1, plist_t status2);
|
|
209
|
-
|
|
210
|
-
#ifdef __cplusplus
|
|
211
|
-
}
|
|
212
|
-
#endif
|
|
213
|
-
|
|
214
|
-
#endif
|