From f6555734bf8a28ce9663d87320a1eff61710d7a4 Mon Sep 17 00:00:00 2001 From: Nikias Bassen Date: Wed, 11 Jan 2012 17:24:57 +0100 Subject: restored: allow passing options to restored_start_restore() --- include/libimobiledevice/restore.h | 2 +- src/restore.c | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/include/libimobiledevice/restore.h b/include/libimobiledevice/restore.h index 9c30b03..aa8233f 100644 --- a/include/libimobiledevice/restore.h +++ b/include/libimobiledevice/restore.h @@ -59,7 +59,7 @@ restored_error_t restored_send(restored_client_t client, plist_t plist); restored_error_t restored_receive(restored_client_t client, plist_t *plist); restored_error_t restored_goodbye(restored_client_t client); -restored_error_t restored_start_restore(restored_client_t client); +restored_error_t restored_start_restore(restored_client_t client, plist_t options, uint64_t version); restored_error_t restored_reboot(restored_client_t client); /* Helper */ diff --git a/src/restore.c b/src/restore.c index fd23d85..10642da 100644 --- a/src/restore.c +++ b/src/restore.c @@ -391,11 +391,13 @@ restored_error_t restored_goodbye(restored_client_t client) * Requests to start a restore and retrieve it's port on success. * * @param client The restored client + * @param options PLIST_DICT with options for the restore process or NULL + * @param version the restore protocol version, see restored_query_type() * * @return RESTORE_E_SUCCESS on success, NP_E_INVALID_ARG if a parameter * is NULL, RESTORE_E_START_RESTORE_FAILED if the request fails */ -restored_error_t restored_start_restore(restored_client_t client) +restored_error_t restored_start_restore(restored_client_t client, plist_t options, uint64_t version) { if (!client) return RESTORE_E_INVALID_ARG; @@ -406,7 +408,10 @@ restored_error_t restored_start_restore(restored_client_t client) dict = plist_new_dict(); plist_dict_add_label(dict, client->label); plist_dict_insert_item(dict,"Request", plist_new_string("StartRestore")); - plist_dict_insert_item(dict,"RestoreProtocolVersion", plist_new_uint(2)); + if (options) { + plist_dict_insert_item(dict, "RestoreOptions", plist_copy(options)); + } + plist_dict_insert_item(dict,"RestoreProtocolVersion", plist_new_uint(version)); /* send to device */ ret = restored_send(client, dict); -- cgit v1.1-32-gdbae