diff options
Diffstat (limited to 'include/libimobiledevice/installation_proxy.h')
-rw-r--r-- | include/libimobiledevice/installation_proxy.h | 501 |
1 files changed, 465 insertions, 36 deletions
diff --git a/include/libimobiledevice/installation_proxy.h b/include/libimobiledevice/installation_proxy.h index f5f00e8..44331aa 100644 --- a/include/libimobiledevice/installation_proxy.h +++ b/include/libimobiledevice/installation_proxy.h | |||
@@ -3,7 +3,10 @@ | |||
3 | * @brief Manage applications on a device. | 3 | * @brief Manage applications on a device. |
4 | * \internal | 4 | * \internal |
5 | * | 5 | * |
6 | * Copyright (c) 2009 Nikias Bassen All Rights Reserved. | 6 | * Copyright (c) 2010-2015 Martin Szulecki All Rights Reserved. |
7 | * Copyright (c) 2014 Christophe Fergeau All Rights Reserved. | ||
8 | * Copyright (c) 2009-2012 Nikias Bassen All Rights Reserved. | ||
9 | * Copyright (c) 2010 Bryan Forbes All Rights Reserved. | ||
7 | * | 10 | * |
8 | * This library is free software; you can redistribute it and/or | 11 | * This library is free software; you can redistribute it and/or |
9 | * modify it under the terms of the GNU Lesser General Public | 12 | * modify it under the terms of the GNU Lesser General Public |
@@ -20,54 +23,480 @@ | |||
20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | 23 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
21 | */ | 24 | */ |
22 | 25 | ||
23 | #ifndef INSTALLATION_PROXY_H | 26 | #ifndef IINSTALLATION_PROXY_H |
24 | #define INSTALLATION_PROXY_H | 27 | #define IINSTALLATION_PROXY_H |
25 | 28 | ||
26 | #ifdef __cplusplus | 29 | #ifdef __cplusplus |
27 | extern "C" { | 30 | extern "C" { |
28 | #endif | 31 | #endif |
29 | 32 | ||
30 | #include <libimobiledevice/libimobiledevice.h> | 33 | #include <libimobiledevice/libimobiledevice.h> |
31 | #include <glib.h> | 34 | #include <libimobiledevice/lockdown.h> |
32 | 35 | ||
33 | /** @name Error Codes */ | 36 | /** Service identifier passed to lockdownd_start_service() to start the installation proxy service */ |
34 | /*@{*/ | 37 | #define INSTPROXY_SERVICE_NAME "com.apple.mobile.installation_proxy" |
35 | #define INSTPROXY_E_SUCCESS 0 | ||
36 | #define INSTPROXY_E_INVALID_ARG -1 | ||
37 | #define INSTPROXY_E_PLIST_ERROR -2 | ||
38 | #define INSTPROXY_E_CONN_FAILED -3 | ||
39 | #define INSTPROXY_E_OP_IN_PROGRESS -4 | ||
40 | #define INSTPROXY_E_OP_FAILED -5 | ||
41 | 38 | ||
42 | #define INSTPROXY_E_UNKNOWN_ERROR -256 | 39 | /** Error Codes */ |
43 | /*@}*/ | 40 | typedef enum { |
41 | /* custom */ | ||
42 | INSTPROXY_E_SUCCESS = 0, | ||
43 | INSTPROXY_E_INVALID_ARG = -1, | ||
44 | INSTPROXY_E_PLIST_ERROR = -2, | ||
45 | INSTPROXY_E_CONN_FAILED = -3, | ||
46 | INSTPROXY_E_OP_IN_PROGRESS = -4, | ||
47 | INSTPROXY_E_OP_FAILED = -5, | ||
48 | INSTPROXY_E_RECEIVE_TIMEOUT = -6, | ||
49 | /* native */ | ||
50 | INSTPROXY_E_ALREADY_ARCHIVED = -7, | ||
51 | INSTPROXY_E_API_INTERNAL_ERROR = -8, | ||
52 | INSTPROXY_E_APPLICATION_ALREADY_INSTALLED = -9, | ||
53 | INSTPROXY_E_APPLICATION_MOVE_FAILED = -10, | ||
54 | INSTPROXY_E_APPLICATION_SINF_CAPTURE_FAILED = -11, | ||
55 | INSTPROXY_E_APPLICATION_SANDBOX_FAILED = -12, | ||
56 | INSTPROXY_E_APPLICATION_VERIFICATION_FAILED = -13, | ||
57 | INSTPROXY_E_ARCHIVE_DESTRUCTION_FAILED = -14, | ||
58 | INSTPROXY_E_BUNDLE_VERIFICATION_FAILED = -15, | ||
59 | INSTPROXY_E_CARRIER_BUNDLE_COPY_FAILED = -16, | ||
60 | INSTPROXY_E_CARRIER_BUNDLE_DIRECTORY_CREATION_FAILED = -17, | ||
61 | INSTPROXY_E_CARRIER_BUNDLE_MISSING_SUPPORTED_SIMS = -18, | ||
62 | INSTPROXY_E_COMM_CENTER_NOTIFICATION_FAILED = -19, | ||
63 | INSTPROXY_E_CONTAINER_CREATION_FAILED = -20, | ||
64 | INSTPROXY_E_CONTAINER_P0WN_FAILED = -21, | ||
65 | INSTPROXY_E_CONTAINER_REMOVAL_FAILED = -22, | ||
66 | INSTPROXY_E_EMBEDDED_PROFILE_INSTALL_FAILED = -23, | ||
67 | INSTPROXY_E_EXECUTABLE_TWIDDLE_FAILED = -24, | ||
68 | INSTPROXY_E_EXISTENCE_CHECK_FAILED = -25, | ||
69 | INSTPROXY_E_INSTALL_MAP_UPDATE_FAILED = -26, | ||
70 | INSTPROXY_E_MANIFEST_CAPTURE_FAILED = -27, | ||
71 | INSTPROXY_E_MAP_GENERATION_FAILED = -28, | ||
72 | INSTPROXY_E_MISSING_BUNDLE_EXECUTABLE = -29, | ||
73 | INSTPROXY_E_MISSING_BUNDLE_IDENTIFIER = -30, | ||
74 | INSTPROXY_E_MISSING_BUNDLE_PATH = -31, | ||
75 | INSTPROXY_E_MISSING_CONTAINER = -32, | ||
76 | INSTPROXY_E_NOTIFICATION_FAILED = -33, | ||
77 | INSTPROXY_E_PACKAGE_EXTRACTION_FAILED = -34, | ||
78 | INSTPROXY_E_PACKAGE_INSPECTION_FAILED = -35, | ||
79 | INSTPROXY_E_PACKAGE_MOVE_FAILED = -36, | ||
80 | INSTPROXY_E_PATH_CONVERSION_FAILED = -37, | ||
81 | INSTPROXY_E_RESTORE_CONTAINER_FAILED = -38, | ||
82 | INSTPROXY_E_SEATBELT_PROFILE_REMOVAL_FAILED = -39, | ||
83 | INSTPROXY_E_STAGE_CREATION_FAILED = -40, | ||
84 | INSTPROXY_E_SYMLINK_FAILED = -41, | ||
85 | INSTPROXY_E_UNKNOWN_COMMAND = -42, | ||
86 | INSTPROXY_E_ITUNES_ARTWORK_CAPTURE_FAILED = -43, | ||
87 | INSTPROXY_E_ITUNES_METADATA_CAPTURE_FAILED = -44, | ||
88 | INSTPROXY_E_DEVICE_OS_VERSION_TOO_LOW = -45, | ||
89 | INSTPROXY_E_DEVICE_FAMILY_NOT_SUPPORTED = -46, | ||
90 | INSTPROXY_E_PACKAGE_PATCH_FAILED = -47, | ||
91 | INSTPROXY_E_INCORRECT_ARCHITECTURE = -48, | ||
92 | INSTPROXY_E_PLUGIN_COPY_FAILED = -49, | ||
93 | INSTPROXY_E_BREADCRUMB_FAILED = -50, | ||
94 | INSTPROXY_E_BREADCRUMB_UNLOCK_FAILED = -51, | ||
95 | INSTPROXY_E_GEOJSON_CAPTURE_FAILED = -52, | ||
96 | INSTPROXY_E_NEWSSTAND_ARTWORK_CAPTURE_FAILED = -53, | ||
97 | INSTPROXY_E_MISSING_COMMAND = -54, | ||
98 | INSTPROXY_E_NOT_ENTITLED = -55, | ||
99 | INSTPROXY_E_MISSING_PACKAGE_PATH = -56, | ||
100 | INSTPROXY_E_MISSING_CONTAINER_PATH = -57, | ||
101 | INSTPROXY_E_MISSING_APPLICATION_IDENTIFIER = -58, | ||
102 | INSTPROXY_E_MISSING_ATTRIBUTE_VALUE = -59, | ||
103 | INSTPROXY_E_LOOKUP_FAILED = -60, | ||
104 | INSTPROXY_E_DICT_CREATION_FAILED = -61, | ||
105 | INSTPROXY_E_INSTALL_PROHIBITED = -62, | ||
106 | INSTPROXY_E_UNINSTALL_PROHIBITED = -63, | ||
107 | INSTPROXY_E_MISSING_BUNDLE_VERSION = -64, | ||
108 | INSTPROXY_E_UNKNOWN_ERROR = -256 | ||
109 | } instproxy_error_t; | ||
44 | 110 | ||
45 | /** Represents an error code. */ | 111 | typedef struct instproxy_client_private instproxy_client_private; /**< \private */ |
46 | typedef int16_t instproxy_error_t; | ||
47 | |||
48 | typedef struct instproxy_client_private instproxy_client_private; | ||
49 | typedef instproxy_client_private *instproxy_client_t; /**< The client handle. */ | 112 | typedef instproxy_client_private *instproxy_client_t; /**< The client handle. */ |
50 | 113 | ||
51 | /** Reports the status of the given operation */ | 114 | /** Reports the status response of the given command */ |
52 | typedef void (*instproxy_status_cb_t) (const char *operation, plist_t status, void *user_data); | 115 | typedef void (*instproxy_status_cb_t) (plist_t command, plist_t status, void *user_data); |
53 | 116 | ||
54 | /* Interface */ | 117 | /* Interface */ |
55 | instproxy_error_t instproxy_client_new(idevice_t device, uint16_t port, instproxy_client_t *client); | 118 | |
56 | instproxy_error_t instproxy_client_free(instproxy_client_t client); | 119 | /** |
57 | 120 | * Connects to the installation_proxy service on the specified device. | |
58 | instproxy_error_t instproxy_browse(instproxy_client_t client, plist_t client_options, plist_t *result); | 121 | * |
59 | instproxy_error_t instproxy_install(instproxy_client_t client, const char *pkg_path, plist_t client_options, instproxy_status_cb_t status_cb, void *user_data); | 122 | * @param device The device to connect to |
60 | instproxy_error_t instproxy_upgrade(instproxy_client_t client, const char *pkg_path, plist_t client_options, instproxy_status_cb_t status_cb, void *user_data); | 123 | * @param service The service descriptor returned by lockdownd_start_service. |
61 | instproxy_error_t instproxy_uninstall(instproxy_client_t client, const char *appid, plist_t client_options, instproxy_status_cb_t status_cb, void *user_data); | 124 | * @param client Pointer that will be set to a newly allocated |
62 | 125 | * instproxy_client_t upon successful return. | |
63 | instproxy_error_t instproxy_lookup_archives(instproxy_client_t client, plist_t client_options, plist_t *result); | 126 | * |
64 | instproxy_error_t instproxy_archive(instproxy_client_t client, const char *appid, plist_t client_options, instproxy_status_cb_t status_cb, void *user_data); | 127 | * @return INSTPROXY_E_SUCCESS on success, or an INSTPROXY_E_* error value |
65 | instproxy_error_t instproxy_restore(instproxy_client_t client, const char *appid, plist_t client_options, instproxy_status_cb_t status_cb, void *user_data); | 128 | * when an error occurred. |
66 | instproxy_error_t instproxy_remove_archive(instproxy_client_t client, const char *appid, plist_t client_options, instproxy_status_cb_t status_cb, void *user_data); | 129 | */ |
67 | 130 | LIBIMOBILEDEVICE_API instproxy_error_t instproxy_client_new(idevice_t device, lockdownd_service_descriptor_t service, instproxy_client_t *client); | |
68 | plist_t instproxy_client_options_new(); | 131 | |
69 | void instproxy_client_options_add(plist_t client_options, ...) G_GNUC_NULL_TERMINATED; | 132 | /** |
70 | void instproxy_client_options_free(plist_t client_options); | 133 | * Starts a new installation_proxy service on the specified device and connects to it. |
134 | * | ||
135 | * @param device The device to connect to. | ||
136 | * @param client Pointer that will point to a newly allocated | ||
137 | * instproxy_client_t upon successful return. Must be freed using | ||
138 | * instproxy_client_free() after use. | ||
139 | * @param label The label to use for communication. Usually the program name. | ||
140 | * Pass NULL to disable sending the label in requests to lockdownd. | ||
141 | * | ||
142 | * @return INSTPROXY_E_SUCCESS on success, or an INSTPROXY_E_* error | ||
143 | * code otherwise. | ||
144 | */ | ||
145 | LIBIMOBILEDEVICE_API instproxy_error_t instproxy_client_start_service(idevice_t device, instproxy_client_t * client, const char* label); | ||
146 | |||
147 | /** | ||
148 | * Disconnects an installation_proxy client from the device and frees up the | ||
149 | * installation_proxy client data. | ||
150 | * | ||
151 | * @param client The installation_proxy client to disconnect and free. | ||
152 | * | ||
153 | * @return INSTPROXY_E_SUCCESS on success | ||
154 | * or INSTPROXY_E_INVALID_ARG if client is NULL. | ||
155 | */ | ||
156 | LIBIMOBILEDEVICE_API instproxy_error_t instproxy_client_free(instproxy_client_t client); | ||
157 | |||
158 | /** | ||
159 | * List installed applications. This function runs synchronously. | ||
160 | * | ||
161 | * @param client The connected installation_proxy client | ||
162 | * @param client_options The client options to use, as PLIST_DICT, or NULL. | ||
163 | * Valid client options include: | ||
164 | * "ApplicationType" -> "System" | ||
165 | * "ApplicationType" -> "User" | ||
166 | * "ApplicationType" -> "Internal" | ||
167 | * "ApplicationType" -> "Any" | ||
168 | * @param result Pointer that will be set to a plist that will hold an array | ||
169 | * of PLIST_DICT holding information about the applications found. | ||
170 | * | ||
171 | * @return INSTPROXY_E_SUCCESS on success or an INSTPROXY_E_* error value if | ||
172 | * an error occurred. | ||
173 | */ | ||
174 | LIBIMOBILEDEVICE_API instproxy_error_t instproxy_browse(instproxy_client_t client, plist_t client_options, plist_t *result); | ||
175 | |||
176 | /** | ||
177 | * List pages of installed applications in a callback. | ||
178 | * | ||
179 | * @param client The connected installation_proxy client | ||
180 | * @param client_options The client options to use, as PLIST_DICT, or NULL. | ||
181 | * Valid client options include: | ||
182 | * "ApplicationType" -> "System" | ||
183 | * "ApplicationType" -> "User" | ||
184 | * "ApplicationType" -> "Internal" | ||
185 | * "ApplicationType" -> "Any" | ||
186 | * @param status_cb Callback function to process each page of application | ||
187 | * information. Passing a callback is required. | ||
188 | * @param user_data Callback data passed to status_cb. | ||
189 | * | ||
190 | * @return INSTPROXY_E_SUCCESS on success or an INSTPROXY_E_* error value if | ||
191 | * an error occurred. | ||
192 | */ | ||
193 | LIBIMOBILEDEVICE_API instproxy_error_t instproxy_browse_with_callback(instproxy_client_t client, plist_t client_options, instproxy_status_cb_t status_cb, void *user_data); | ||
194 | |||
195 | /** | ||
196 | * Lookup information about specific applications from the device. | ||
197 | * | ||
198 | * @param client The connected installation_proxy client | ||
199 | * @param appids An array of bundle identifiers that MUST have a terminating | ||
200 | * NULL entry or NULL to lookup all. | ||
201 | * @param client_options The client options to use, as PLIST_DICT, or NULL. | ||
202 | * Currently there are no known client options, so pass NULL here. | ||
203 | * @param result Pointer that will be set to a plist containing a PLIST_DICT | ||
204 | * holding requested information about the application or NULL on errors. | ||
205 | * | ||
206 | * @return INSTPROXY_E_SUCCESS on success or an INSTPROXY_E_* error value if | ||
207 | * an error occurred. | ||
208 | */ | ||
209 | LIBIMOBILEDEVICE_API instproxy_error_t instproxy_lookup(instproxy_client_t client, const char** appids, plist_t client_options, plist_t *result); | ||
210 | |||
211 | /** | ||
212 | * Install an application on the device. | ||
213 | * | ||
214 | * @param client The connected installation_proxy client | ||
215 | * @param pkg_path Path of the installation package (inside the AFC jail) | ||
216 | * @param client_options The client options to use, as PLIST_DICT, or NULL. | ||
217 | * Valid options include: | ||
218 | * "iTunesMetadata" -> PLIST_DATA | ||
219 | * "ApplicationSINF" -> PLIST_DATA | ||
220 | * "PackageType" -> "Developer" | ||
221 | * If PackageType -> Developer is specified, then pkg_path points to | ||
222 | * an .app directory instead of an install package. | ||
223 | * @param status_cb Callback function for progress and status information. If | ||
224 | * NULL is passed, this function will run synchronously. | ||
225 | * @param user_data Callback data passed to status_cb. | ||
226 | * | ||
227 | * @return INSTPROXY_E_SUCCESS on success or an INSTPROXY_E_* error value if | ||
228 | * an error occurred. | ||
229 | * | ||
230 | * @note If a callback function is given (async mode), this function returns | ||
231 | * INSTPROXY_E_SUCCESS immediately if the status updater thread has been | ||
232 | * created successfully; any error occurring during the command has to be | ||
233 | * handled inside the specified callback function. | ||
234 | */ | ||
235 | LIBIMOBILEDEVICE_API instproxy_error_t instproxy_install(instproxy_client_t client, const char *pkg_path, plist_t client_options, instproxy_status_cb_t status_cb, void *user_data); | ||
236 | |||
237 | /** | ||
238 | * Upgrade an application on the device. This function is nearly the same as | ||
239 | * instproxy_install; the difference is that the installation progress on the | ||
240 | * device is faster if the application is already installed. | ||
241 | * | ||
242 | * @param client The connected installation_proxy client | ||
243 | * @param pkg_path Path of the installation package (inside the AFC jail) | ||
244 | * @param client_options The client options to use, as PLIST_DICT, or NULL. | ||
245 | * Valid options include: | ||
246 | * "iTunesMetadata" -> PLIST_DATA | ||
247 | * "ApplicationSINF" -> PLIST_DATA | ||
248 | * "PackageType" -> "Developer" | ||
249 | * If PackageType -> Developer is specified, then pkg_path points to | ||
250 | * an .app directory instead of an install package. | ||
251 | * @param status_cb Callback function for progress and status information. If | ||
252 | * NULL is passed, this function will run synchronously. | ||
253 | * @param user_data Callback data passed to status_cb. | ||
254 | * | ||
255 | * @return INSTPROXY_E_SUCCESS on success or an INSTPROXY_E_* error value if | ||
256 | * an error occurred. | ||
257 | * | ||
258 | * @note If a callback function is given (async mode), this function returns | ||
259 | * INSTPROXY_E_SUCCESS immediately if the status updater thread has been | ||
260 | * created successfully; any error occurring during the command has to be | ||
261 | * handled inside the specified callback function. | ||
262 | */ | ||
263 | LIBIMOBILEDEVICE_API instproxy_error_t instproxy_upgrade(instproxy_client_t client, const char *pkg_path, plist_t client_options, instproxy_status_cb_t status_cb, void *user_data); | ||
264 | |||
265 | /** | ||
266 | * Uninstall an application from the device. | ||
267 | * | ||
268 | * @param client The connected installation proxy client | ||
269 | * @param appid ApplicationIdentifier of the app to uninstall | ||
270 | * @param client_options The client options to use, as PLIST_DICT, or NULL. | ||
271 | * Currently there are no known client options, so pass NULL here. | ||
272 | * @param status_cb Callback function for progress and status information. If | ||
273 | * NULL is passed, this function will run synchronously. | ||
274 | * @param user_data Callback data passed to status_cb. | ||
275 | * | ||
276 | * @return INSTPROXY_E_SUCCESS on success or an INSTPROXY_E_* error value if | ||
277 | * an error occurred. | ||
278 | * | ||
279 | * @note If a callback function is given (async mode), this function returns | ||
280 | * INSTPROXY_E_SUCCESS immediately if the status updater thread has been | ||
281 | * created successfully; any error occurring during the command has to be | ||
282 | * handled inside the specified callback function. | ||
283 | */ | ||
284 | LIBIMOBILEDEVICE_API instproxy_error_t instproxy_uninstall(instproxy_client_t client, const char *appid, plist_t client_options, instproxy_status_cb_t status_cb, void *user_data); | ||
285 | |||
286 | /** | ||
287 | * List archived applications. This function runs synchronously. | ||
288 | * | ||
289 | * @see instproxy_archive | ||
290 | * | ||
291 | * @param client The connected installation_proxy client | ||
292 | * @param client_options The client options to use, as PLIST_DICT, or NULL. | ||
293 | * Currently there are no known client options, so pass NULL here. | ||
294 | * @param result Pointer that will be set to a plist containing a PLIST_DICT | ||
295 | * holding information about the archived applications found. | ||
296 | * | ||
297 | * @return INSTPROXY_E_SUCCESS on success or an INSTPROXY_E_* error value if | ||
298 | * an error occurred. | ||
299 | */ | ||
300 | LIBIMOBILEDEVICE_API instproxy_error_t instproxy_lookup_archives(instproxy_client_t client, plist_t client_options, plist_t *result); | ||
301 | |||
302 | /** | ||
303 | * Archive an application on the device. | ||
304 | * This function tells the device to make an archive of the specified | ||
305 | * application. This results in the device creating a ZIP archive in the | ||
306 | * 'ApplicationArchives' directory and uninstalling the application. | ||
307 | * | ||
308 | * @param client The connected installation proxy client | ||
309 | * @param appid ApplicationIdentifier of the app to archive. | ||
310 | * @param client_options The client options to use, as PLIST_DICT, or NULL. | ||
311 | * Valid options include: | ||
312 | * "SkipUninstall" -> Boolean | ||
313 | * "ArchiveType" -> "ApplicationOnly" | ||
314 | * @param status_cb Callback function for progress and status information. If | ||
315 | * NULL is passed, this function will run synchronously. | ||
316 | * @param user_data Callback data passed to status_cb. | ||
317 | * | ||
318 | * @return INSTPROXY_E_SUCCESS on success or an INSTPROXY_E_* error value if | ||
319 | * an error occurred. | ||
320 | * | ||
321 | * @note If a callback function is given (async mode), this function returns | ||
322 | * INSTPROXY_E_SUCCESS immediately if the status updater thread has been | ||
323 | * created successfully; any error occurring during the command has to be | ||
324 | * handled inside the specified callback function. | ||
325 | */ | ||
326 | LIBIMOBILEDEVICE_API instproxy_error_t instproxy_archive(instproxy_client_t client, const char *appid, plist_t client_options, instproxy_status_cb_t status_cb, void *user_data); | ||
327 | |||
328 | /** | ||
329 | * Restore a previously archived application on the device. | ||
330 | * This function is the counterpart to instproxy_archive. | ||
331 | * @see instproxy_archive | ||
332 | * | ||
333 | * @param client The connected installation proxy client | ||
334 | * @param appid ApplicationIdentifier of the app to restore. | ||
335 | * @param client_options The client options to use, as PLIST_DICT, or NULL. | ||
336 | * Valid options include: | ||
337 | * "ArchiveType" -> "DocumentsOnly" | ||
338 | * @param status_cb Callback function for progress and status information. If | ||
339 | * NULL is passed, this function will run synchronously. | ||
340 | * @param user_data Callback data passed to status_cb. | ||
341 | * | ||
342 | * @return INSTPROXY_E_SUCCESS on success or an INSTPROXY_E_* error value if | ||
343 | * an error occurred. | ||
344 | * | ||
345 | * @note If a callback function is given (async mode), this function returns | ||
346 | * INSTPROXY_E_SUCCESS immediately if the status updater thread has been | ||
347 | * created successfully; any error occurring during the command has to be | ||
348 | * handled inside the specified callback function. | ||
349 | */ | ||
350 | LIBIMOBILEDEVICE_API instproxy_error_t instproxy_restore(instproxy_client_t client, const char *appid, plist_t client_options, instproxy_status_cb_t status_cb, void *user_data); | ||
351 | |||
352 | /** | ||
353 | * Removes a previously archived application from the device. | ||
354 | * This function removes the ZIP archive from the 'ApplicationArchives' | ||
355 | * directory. | ||
356 | * | ||
357 | * @param client The connected installation proxy client | ||
358 | * @param appid ApplicationIdentifier of the archived app to remove. | ||
359 | * @param client_options The client options to use, as PLIST_DICT, or NULL. | ||
360 | * Currently there are no known client options, so passing NULL is fine. | ||
361 | * @param status_cb Callback function for progress and status information. If | ||
362 | * NULL is passed, this function will run synchronously. | ||
363 | * @param user_data Callback data passed to status_cb. | ||
364 | * | ||
365 | * @return INSTPROXY_E_SUCCESS on success or an INSTPROXY_E_* error value if | ||
366 | * an error occurred. | ||
367 | * | ||
368 | * @note If a callback function is given (async mode), this function returns | ||
369 | * INSTPROXY_E_SUCCESS immediately if the status updater thread has been | ||
370 | * created successfully; any error occurring during the command has to be | ||
371 | * handled inside the specified callback function. | ||
372 | */ | ||
373 | LIBIMOBILEDEVICE_API instproxy_error_t instproxy_remove_archive(instproxy_client_t client, const char *appid, plist_t client_options, instproxy_status_cb_t status_cb, void *user_data); | ||
374 | |||
375 | /** | ||
376 | * Checks a device for certain capabilities. | ||
377 | * | ||
378 | * @param client The connected installation_proxy client | ||
379 | * @param capabilities An array of char* with capability names that MUST have a | ||
380 | * terminating NULL entry. | ||
381 | * @param client_options The client options to use, as PLIST_DICT, or NULL. | ||
382 | * Currently there are no known client options, so pass NULL here. | ||
383 | * @param result Pointer that will be set to a plist containing a PLIST_DICT | ||
384 | * holding information if the capabilities matched or NULL on errors. | ||
385 | * | ||
386 | * @return INSTPROXY_E_SUCCESS on success or an INSTPROXY_E_* error value if | ||
387 | * an error occurred. | ||
388 | */ | ||
389 | LIBIMOBILEDEVICE_API instproxy_error_t instproxy_check_capabilities_match(instproxy_client_t client, const char** capabilities, plist_t client_options, plist_t *result); | ||
390 | |||
391 | /* Helper */ | ||
392 | |||
393 | /** | ||
394 | * Gets the name from a command dictionary. | ||
395 | * | ||
396 | * @param command The dictionary describing the command. | ||
397 | * @param name Pointer to store the name of the command. | ||
398 | */ | ||
399 | LIBIMOBILEDEVICE_API void instproxy_command_get_name(plist_t command, char** name); | ||
400 | |||
401 | /** | ||
402 | * Gets the name of a status. | ||
403 | * | ||
404 | * @param status The dictionary status response to use. | ||
405 | * @param name Pointer to store the name of the status. | ||
406 | */ | ||
407 | LIBIMOBILEDEVICE_API void instproxy_status_get_name(plist_t status, char **name); | ||
408 | |||
409 | /** | ||
410 | * Gets error name, code and description from a response if available. | ||
411 | * | ||
412 | * @param status The dictionary status response to use. | ||
413 | * @param name Pointer to store the name of an error. | ||
414 | * @param description Pointer to store error description text if available. | ||
415 | * The caller is reponsible for freeing the allocated buffer after use. | ||
416 | * If NULL is passed no description will be returned. | ||
417 | * @param code Pointer to store the returned error code if available. | ||
418 | * If NULL is passed no error code will be returned. | ||
419 | * | ||
420 | * @return INSTPROXY_E_SUCCESS if no error is found or an INSTPROXY_E_* error | ||
421 | * value matching the error that ẃas found in the status. | ||
422 | */ | ||
423 | LIBIMOBILEDEVICE_API instproxy_error_t instproxy_status_get_error(plist_t status, char **name, char** description, uint64_t* code); | ||
424 | |||
425 | /** | ||
426 | * Gets total and current item information from a browse response if available. | ||
427 | * | ||
428 | * @param status The dictionary status response to use. | ||
429 | * @param total Pointer to store the total number of items. | ||
430 | * @param current_index Pointer to store the current index of all browsed items. | ||
431 | * @param current_amount Pointer to store the amount of items in the | ||
432 | * current list. | ||
433 | * @param list Pointer to store a newly allocated plist with items. | ||
434 | * The caller is reponsible for freeing the list after use. | ||
435 | * If NULL is passed no list will be returned. If NULL is returned no | ||
436 | * list was found in the status. | ||
437 | */ | ||
438 | LIBIMOBILEDEVICE_API void instproxy_status_get_current_list(plist_t status, uint64_t* total, uint64_t* current_index, uint64_t* current_amount, plist_t* list); | ||
439 | |||
440 | |||
441 | /** | ||
442 | * Gets progress in percentage from a status if available. | ||
443 | * | ||
444 | * @param status The dictionary status response to use. | ||
445 | * @param percent Pointer to an int to store the progress in percent (0-100) | ||
446 | * or -1 if no progress was found in the status. | ||
447 | */ | ||
448 | LIBIMOBILEDEVICE_API void instproxy_status_get_percent_complete(plist_t status, int *percent); | ||
449 | |||
450 | /** | ||
451 | * Creates a new client_options plist. | ||
452 | * | ||
453 | * @return A new plist_t of type PLIST_DICT. | ||
454 | */ | ||
455 | LIBIMOBILEDEVICE_API plist_t instproxy_client_options_new(void); | ||
456 | |||
457 | /** | ||
458 | * Adds one or more new key:value pairs to the given client_options. | ||
459 | * | ||
460 | * @param client_options The client options to modify. | ||
461 | * @param ... KEY, VALUE, [KEY, VALUE], NULL | ||
462 | * | ||
463 | * @note The keys and values passed are expected to be strings, except for the | ||
464 | * keys "ApplicationSINF", "iTunesMetadata", "ReturnAttributes" which are | ||
465 | * expecting a plist_t node as value and "SkipUninstall" expects int. | ||
466 | */ | ||
467 | LIBIMOBILEDEVICE_API void instproxy_client_options_add(plist_t client_options, ...); | ||
468 | |||
469 | /** | ||
470 | * Adds attributes to the given client_options to filter browse results. | ||
471 | * | ||
472 | * @param client_options The client options to modify. | ||
473 | * @param ... VALUE, VALUE, [VALUE], NULL | ||
474 | * | ||
475 | * @note The values passed are expected to be strings. | ||
476 | */ | ||
477 | LIBIMOBILEDEVICE_API void instproxy_client_options_set_return_attributes(plist_t client_options, ...); | ||
478 | |||
479 | /** | ||
480 | * Frees client_options plist. | ||
481 | * | ||
482 | * @param client_options The client options plist to free. Does nothing if NULL | ||
483 | * is passed. | ||
484 | */ | ||
485 | LIBIMOBILEDEVICE_API void instproxy_client_options_free(plist_t client_options); | ||
486 | |||
487 | /** | ||
488 | * Queries the device for the path of an application. | ||
489 | * | ||
490 | * @param client The connected installation proxy client. | ||
491 | * @param bundle_id ApplicationIdentifier of app to retrieve the path for. | ||
492 | * @param path Pointer to store the device path for the application | ||
493 | * which is set to NULL if it could not be determined. | ||
494 | * | ||
495 | * @return INSTPROXY_E_SUCCESS on success, INSTPROXY_E_OP_FAILED if | ||
496 | * the path could not be determined or an INSTPROXY_E_* error | ||
497 | * value if an error occurred. | ||
498 | */ | ||
499 | LIBIMOBILEDEVICE_API instproxy_error_t instproxy_client_get_path_for_bundle_identifier(instproxy_client_t client, const char* bundle_id, char** path); | ||
71 | 500 | ||
72 | #ifdef __cplusplus | 501 | #ifdef __cplusplus |
73 | } | 502 | } |