summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/libimobiledevice/installation_proxy.h75
-rw-r--r--src/installation_proxy.c8
2 files changed, 43 insertions, 40 deletions
diff --git a/include/libimobiledevice/installation_proxy.h b/include/libimobiledevice/installation_proxy.h
index 67307e2..c15f0d0 100644
--- a/include/libimobiledevice/installation_proxy.h
+++ b/include/libimobiledevice/installation_proxy.h
@@ -58,10 +58,10 @@ typedef void (*instproxy_status_cb_t) (const char *operation, plist_t status, vo
58 * @param device The device to connect to 58 * @param device The device to connect to
59 * @param service The service descriptor returned by lockdownd_start_service. 59 * @param service The service descriptor returned by lockdownd_start_service.
60 * @param client Pointer that will be set to a newly allocated 60 * @param client Pointer that will be set to a newly allocated
61 * instproxy_client_t upon successful return. 61 * instproxy_client_t upon successful return.
62 * 62 *
63 * @return INSTPROXY_E_SUCCESS on success, or an INSTPROXY_E_* error value 63 * @return INSTPROXY_E_SUCCESS on success, or an INSTPROXY_E_* error value
64 * when an error occured. 64 * when an error occured.
65 */ 65 */
66instproxy_error_t instproxy_client_new(idevice_t device, lockdownd_service_descriptor_t service, instproxy_client_t *client); 66instproxy_error_t instproxy_client_new(idevice_t device, lockdownd_service_descriptor_t service, instproxy_client_t *client);
67 67
@@ -70,13 +70,13 @@ instproxy_error_t instproxy_client_new(idevice_t device, lockdownd_service_descr
70 * 70 *
71 * @param device The device to connect to. 71 * @param device The device to connect to.
72 * @param client Pointer that will point to a newly allocated 72 * @param client Pointer that will point to a newly allocated
73 * instproxy_client_t upon successful return. Must be freed using 73 * instproxy_client_t upon successful return. Must be freed using
74 * instproxy_client_free() after use. 74 * instproxy_client_free() after use.
75 * @param label The label to use for communication. Usually the program name. 75 * @param label The label to use for communication. Usually the program name.
76 * Pass NULL to disable sending the label in requests to lockdownd. 76 * Pass NULL to disable sending the label in requests to lockdownd.
77 * 77 *
78 * @return INSTPROXY_E_SUCCESS on success, or an INSTPROXY_E_* error 78 * @return INSTPROXY_E_SUCCESS on success, or an INSTPROXY_E_* error
79 * code otherwise. 79 * code otherwise.
80 */ 80 */
81instproxy_error_t instproxy_client_start_service(idevice_t device, instproxy_client_t * client, const char* label); 81instproxy_error_t instproxy_client_start_service(idevice_t device, instproxy_client_t * client, const char* label);
82 82
@@ -87,24 +87,25 @@ instproxy_error_t instproxy_client_start_service(idevice_t device, instproxy_cli
87 * @param client The installation_proxy client to disconnect and free. 87 * @param client The installation_proxy client to disconnect and free.
88 * 88 *
89 * @return INSTPROXY_E_SUCCESS on success 89 * @return INSTPROXY_E_SUCCESS on success
90 * or INSTPROXY_E_INVALID_ARG if client is NULL. 90 * or INSTPROXY_E_INVALID_ARG if client is NULL.
91 */ 91 */
92instproxy_error_t instproxy_client_free(instproxy_client_t client); 92instproxy_error_t instproxy_client_free(instproxy_client_t client);
93 93
94
95/** 94/**
96 * List installed applications. This function runs synchronously. 95 * List installed applications. This function runs synchronously.
97 * 96 *
98 * @param client The connected installation_proxy client 97 * @param client The connected installation_proxy client
99 * @param client_options The client options to use, as PLIST_DICT, or NULL. 98 * @param client_options The client options to use, as PLIST_DICT, or NULL.
100 * Valid client options include: 99 * Valid client options include:
101 * "ApplicationType" -> "User"
102 * "ApplicationType" -> "System" 100 * "ApplicationType" -> "System"
101 * "ApplicationType" -> "User"
102 * "ApplicationType" -> "Internal"
103 * "ApplicationType" -> "Any"
103 * @param result Pointer that will be set to a plist that will hold an array 104 * @param result Pointer that will be set to a plist that will hold an array
104 * of PLIST_DICT holding information about the applications found. 105 * of PLIST_DICT holding information about the applications found.
105 * 106 *
106 * @return INSTPROXY_E_SUCCESS on success or an INSTPROXY_E_* error value if 107 * @return INSTPROXY_E_SUCCESS on success or an INSTPROXY_E_* error value if
107 * an error occured. 108 * an error occured.
108 */ 109 */
109instproxy_error_t instproxy_browse(instproxy_client_t client, plist_t client_options, plist_t *result); 110instproxy_error_t instproxy_browse(instproxy_client_t client, plist_t client_options, plist_t *result);
110 111
@@ -125,12 +126,12 @@ instproxy_error_t instproxy_browse(instproxy_client_t client, plist_t client_opt
125 * @param user_data Callback data passed to status_cb. 126 * @param user_data Callback data passed to status_cb.
126 * 127 *
127 * @return INSTPROXY_E_SUCCESS on success or an INSTPROXY_E_* error value if 128 * @return INSTPROXY_E_SUCCESS on success or an INSTPROXY_E_* error value if
128 * an error occured. 129 * an error occured.
129 * 130 *
130 * @note If a callback function is given (async mode), this function returns 131 * @note If a callback function is given (async mode), this function returns
131 * INSTPROXY_E_SUCCESS immediately if the status updater thread has been 132 * INSTPROXY_E_SUCCESS immediately if the status updater thread has been
132 * created successfully; any error occuring during the operation has to be 133 * created successfully; any error occuring during the command has to be
133 * handled inside the specified callback function. 134 * handled inside the specified callback function.
134 */ 135 */
135instproxy_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); 136instproxy_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);
136 137
@@ -153,12 +154,12 @@ instproxy_error_t instproxy_install(instproxy_client_t client, const char *pkg_p
153 * @param user_data Callback data passed to status_cb. 154 * @param user_data Callback data passed to status_cb.
154 * 155 *
155 * @return INSTPROXY_E_SUCCESS on success or an INSTPROXY_E_* error value if 156 * @return INSTPROXY_E_SUCCESS on success or an INSTPROXY_E_* error value if
156 * an error occured. 157 * an error occured.
157 * 158 *
158 * @note If a callback function is given (async mode), this function returns 159 * @note If a callback function is given (async mode), this function returns
159 * INSTPROXY_E_SUCCESS immediately if the status updater thread has been 160 * INSTPROXY_E_SUCCESS immediately if the status updater thread has been
160 * created successfully; any error occuring during the operation has to be 161 * created successfully; any error occuring during the command has to be
161 * handled inside the specified callback function. 162 * handled inside the specified callback function.
162 */ 163 */
163instproxy_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); 164instproxy_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);
164 165
@@ -177,13 +178,12 @@ instproxy_error_t instproxy_upgrade(instproxy_client_t client, const char *pkg_p
177 * an error occured. 178 * an error occured.
178 * 179 *
179 * @note If a callback function is given (async mode), this function returns 180 * @note If a callback function is given (async mode), this function returns
180 * INSTPROXY_E_SUCCESS immediately if the status updater thread has been 181 * INSTPROXY_E_SUCCESS immediately if the status updater thread has been
181 * created successfully; any error occuring during the operation has to be 182 * created successfully; any error occuring during the command has to be
182 * handled inside the specified callback function. 183 * handled inside the specified callback function.
183 */ 184 */
184instproxy_error_t instproxy_uninstall(instproxy_client_t client, const char *appid, plist_t client_options, instproxy_status_cb_t status_cb, void *user_data); 185instproxy_error_t instproxy_uninstall(instproxy_client_t client, const char *appid, plist_t client_options, instproxy_status_cb_t status_cb, void *user_data);
185 186
186
187/** 187/**
188 * List archived applications. This function runs synchronously. 188 * List archived applications. This function runs synchronously.
189 * 189 *
@@ -196,7 +196,7 @@ instproxy_error_t instproxy_uninstall(instproxy_client_t client, const char *app
196 * holding information about the archived applications found. 196 * holding information about the archived applications found.
197 * 197 *
198 * @return INSTPROXY_E_SUCCESS on success or an INSTPROXY_E_* error value if 198 * @return INSTPROXY_E_SUCCESS on success or an INSTPROXY_E_* error value if
199 * an error occured. 199 * an error occured.
200 */ 200 */
201instproxy_error_t instproxy_lookup_archives(instproxy_client_t client, plist_t client_options, plist_t *result); 201instproxy_error_t instproxy_lookup_archives(instproxy_client_t client, plist_t client_options, plist_t *result);
202 202
@@ -220,9 +220,9 @@ instproxy_error_t instproxy_lookup_archives(instproxy_client_t client, plist_t c
220 * an error occured. 220 * an error occured.
221 * 221 *
222 * @note If a callback function is given (async mode), this function returns 222 * @note If a callback function is given (async mode), this function returns
223 * INSTPROXY_E_SUCCESS immediately if the status updater thread has been 223 * INSTPROXY_E_SUCCESS immediately if the status updater thread has been
224 * created successfully; any error occuring during the operation has to be 224 * created successfully; any error occuring during the command has to be
225 * handled inside the specified callback function. 225 * handled inside the specified callback function.
226 */ 226 */
227instproxy_error_t instproxy_archive(instproxy_client_t client, const char *appid, plist_t client_options, instproxy_status_cb_t status_cb, void *user_data); 227instproxy_error_t instproxy_archive(instproxy_client_t client, const char *appid, plist_t client_options, instproxy_status_cb_t status_cb, void *user_data);
228 228
@@ -234,7 +234,8 @@ instproxy_error_t instproxy_archive(instproxy_client_t client, const char *appid
234 * @param client The connected installation proxy client 234 * @param client The connected installation proxy client
235 * @param appid ApplicationIdentifier of the app to restore. 235 * @param appid ApplicationIdentifier of the app to restore.
236 * @param client_options The client options to use, as PLIST_DICT, or NULL. 236 * @param client_options The client options to use, as PLIST_DICT, or NULL.
237 * Currently there are no known client options, so pass NULL here. 237 * Valid options include:
238 * "ArchiveType" -> "DocumentsOnly"
238 * @param status_cb Callback function for progress and status information. If 239 * @param status_cb Callback function for progress and status information. If
239 * NULL is passed, this function will run synchronously. 240 * NULL is passed, this function will run synchronously.
240 * @param user_data Callback data passed to status_cb. 241 * @param user_data Callback data passed to status_cb.
@@ -243,9 +244,9 @@ instproxy_error_t instproxy_archive(instproxy_client_t client, const char *appid
243 * an error occured. 244 * an error occured.
244 * 245 *
245 * @note If a callback function is given (async mode), this function returns 246 * @note If a callback function is given (async mode), this function returns
246 * INSTPROXY_E_SUCCESS immediately if the status updater thread has been 247 * INSTPROXY_E_SUCCESS immediately if the status updater thread has been
247 * created successfully; any error occuring during the operation has to be 248 * created successfully; any error occuring during the command has to be
248 * handled inside the specified callback function. 249 * handled inside the specified callback function.
249 */ 250 */
250instproxy_error_t instproxy_restore(instproxy_client_t client, const char *appid, plist_t client_options, instproxy_status_cb_t status_cb, void *user_data); 251instproxy_error_t instproxy_restore(instproxy_client_t client, const char *appid, plist_t client_options, instproxy_status_cb_t status_cb, void *user_data);
251 252
@@ -263,12 +264,12 @@ instproxy_error_t instproxy_restore(instproxy_client_t client, const char *appid
263 * @param user_data Callback data passed to status_cb. 264 * @param user_data Callback data passed to status_cb.
264 * 265 *
265 * @return INSTPROXY_E_SUCCESS on success or an INSTPROXY_E_* error value if 266 * @return INSTPROXY_E_SUCCESS on success or an INSTPROXY_E_* error value if
266 * an error occured. 267 * an error occured.
267 * 268 *
268 * @note If a callback function is given (async mode), this function returns 269 * @note If a callback function is given (async mode), this function returns
269 * INSTPROXY_E_SUCCESS immediately if the status updater thread has been 270 * INSTPROXY_E_SUCCESS immediately if the status updater thread has been
270 * created successfully; any error occuring during the operation has to be 271 * created successfully; any error occuring during the command has to be
271 * handled inside the specified callback function. 272 * handled inside the specified callback function.
272 */ 273 */
273instproxy_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); 274instproxy_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);
274 275
@@ -282,7 +283,7 @@ instproxy_error_t instproxy_remove_archive(instproxy_client_t client, const char
282plist_t instproxy_client_options_new(void); 283plist_t instproxy_client_options_new(void);
283 284
284/** 285/**
285 * Add one or more new key:value pairs to the given client_options. 286 * Adds one or more new key:value pairs to the given client_options.
286 * 287 *
287 * @param client_options The client options to modify. 288 * @param client_options The client options to modify.
288 * @param ... KEY, VALUE, [KEY, VALUE], NULL 289 * @param ... KEY, VALUE, [KEY, VALUE], NULL
@@ -294,7 +295,7 @@ plist_t instproxy_client_options_new(void);
294void instproxy_client_options_add(plist_t client_options, ...); 295void instproxy_client_options_add(plist_t client_options, ...);
295 296
296/** 297/**
297 * Free client_options plist. 298 * Frees client_options plist.
298 * 299 *
299 * @param client_options The client options plist to free. Does nothing if NULL 300 * @param client_options The client options plist to free. Does nothing if NULL
300 * is passed. 301 * is passed.
@@ -302,7 +303,7 @@ void instproxy_client_options_add(plist_t client_options, ...);
302void instproxy_client_options_free(plist_t client_options); 303void instproxy_client_options_free(plist_t client_options);
303 304
304/** 305/**
305 * Query the device for the path of an application. 306 * Queries the device for the path of an application.
306 * 307 *
307 * @param client The connected installation proxy client. 308 * @param client The connected installation proxy client.
308 * @param appid ApplicationIdentifier of app to retrieve the path for. 309 * @param appid ApplicationIdentifier of app to retrieve the path for.
diff --git a/src/installation_proxy.c b/src/installation_proxy.c
index 9a11e36..e279edf 100644
--- a/src/installation_proxy.c
+++ b/src/installation_proxy.c
@@ -59,7 +59,7 @@ static void instproxy_unlock(instproxy_client_t client)
59} 59}
60 60
61/** 61/**
62 * Convert a property_list_service_error_t value to an instproxy_error_t value. 62 * Converts a property_list_service_error_t value to an instproxy_error_t value.
63 * Used internally to get correct error codes. 63 * Used internally to get correct error codes.
64 * 64 *
65 * @param err A property_list_service_error_t error code 65 * @param err A property_list_service_error_t error code
@@ -130,7 +130,7 @@ LIBIMOBILEDEVICE_API instproxy_error_t instproxy_client_free(instproxy_client_t
130} 130}
131 131
132/** 132/**
133 * Send a command with specified options to the device. 133 * Sends a command to the device.
134 * Only used internally. 134 * Only used internally.
135 * 135 *
136 * @param client The connected installation_proxy client. 136 * @param client The connected installation_proxy client.
@@ -383,7 +383,6 @@ static instproxy_error_t instproxy_create_status_updater(instproxy_client_t clie
383 return res; 383 return res;
384} 384}
385 385
386
387/** 386/**
388 * Internal function used by instproxy_install and instproxy_upgrade. 387 * Internal function used by instproxy_install and instproxy_upgrade.
389 * 388 *
@@ -528,6 +527,7 @@ LIBIMOBILEDEVICE_API instproxy_error_t instproxy_remove_archive(instproxy_client
528 return INSTPROXY_E_OP_IN_PROGRESS; 527 return INSTPROXY_E_OP_IN_PROGRESS;
529 } 528 }
530 529
530 /* send command */
531 instproxy_lock(client); 531 instproxy_lock(client);
532 instproxy_error_t res = instproxy_send_command(client, "RemoveArchive", client_options, appid, NULL); 532 instproxy_error_t res = instproxy_send_command(client, "RemoveArchive", client_options, appid, NULL);
533 instproxy_unlock(client); 533 instproxy_unlock(client);
@@ -548,6 +548,7 @@ LIBIMOBILEDEVICE_API void instproxy_client_options_add(plist_t client_options, .
548{ 548{
549 if (!client_options) 549 if (!client_options)
550 return; 550 return;
551
551 va_list args; 552 va_list args;
552 va_start(args, client_options); 553 va_start(args, client_options);
553 char *arg = va_arg(args, char*); 554 char *arg = va_arg(args, char*);
@@ -607,6 +608,7 @@ LIBIMOBILEDEVICE_API instproxy_error_t instproxy_client_get_path_for_bundle_iden
607 // query device for list of apps 608 // query device for list of apps
608 instproxy_error_t ierr = instproxy_browse(client, client_opts, &apps); 609 instproxy_error_t ierr = instproxy_browse(client, client_opts, &apps);
609 instproxy_client_options_free(client_opts); 610 instproxy_client_options_free(client_opts);
611
610 if (ierr != INSTPROXY_E_SUCCESS) { 612 if (ierr != INSTPROXY_E_SUCCESS) {
611 return ierr; 613 return ierr;
612 } 614 }