diff options
| author | 2010-11-22 23:15:48 +0100 | |
|---|---|---|
| committer | 2011-04-11 17:05:57 +0200 | |
| commit | ae7013d7d8355da926c0818182dd500589b48ed6 (patch) | |
| tree | 871f5c2f4ffd0db6d514d58cfcff7592055d1dcb | |
| parent | bd8d84245b4ca80858bf9b61682268e6c4095f34 (diff) | |
| download | libimobiledevice-ae7013d7d8355da926c0818182dd500589b48ed6.tar.gz libimobiledevice-ae7013d7d8355da926c0818182dd500589b48ed6.tar.bz2 | |
mobilebackup2: small api changes
| -rw-r--r-- | include/libimobiledevice/mobilebackup2.h | 2 | ||||
| -rw-r--r-- | src/mobilebackup2.c | 26 | ||||
| -rw-r--r-- | tools/idevicebackup4.c | 2 |
3 files changed, 23 insertions, 7 deletions
diff --git a/include/libimobiledevice/mobilebackup2.h b/include/libimobiledevice/mobilebackup2.h index ea49602..a58dc00 100644 --- a/include/libimobiledevice/mobilebackup2.h +++ b/include/libimobiledevice/mobilebackup2.h | |||
| @@ -53,7 +53,7 @@ mobilebackup2_error_t mobilebackup2_receive_message(mobilebackup2_client_t clien | |||
| 53 | mobilebackup2_error_t mobilebackup2_send_raw(mobilebackup2_client_t client, const char *data, uint32_t length, uint32_t *bytes); | 53 | mobilebackup2_error_t mobilebackup2_send_raw(mobilebackup2_client_t client, const char *data, uint32_t length, uint32_t *bytes); |
| 54 | mobilebackup2_error_t mobilebackup2_receive_raw(mobilebackup2_client_t client, char *data, uint32_t length, uint32_t *bytes); | 54 | mobilebackup2_error_t mobilebackup2_receive_raw(mobilebackup2_client_t client, char *data, uint32_t length, uint32_t *bytes); |
| 55 | mobilebackup2_error_t mobilebackup2_version_exchange(mobilebackup2_client_t client); | 55 | mobilebackup2_error_t mobilebackup2_version_exchange(mobilebackup2_client_t client); |
| 56 | mobilebackup2_error_t mobilebackup2_request_backup(mobilebackup2_client_t client, const char *uuid); | 56 | mobilebackup2_error_t mobilebackup2_send_request(mobilebackup2_client_t client, const char *request, const char *target_identifier, const char *source_identifier, plist_t options); |
| 57 | mobilebackup2_error_t mobilebackup2_send_status_response(mobilebackup2_client_t client, int status_code, const char *status1, plist_t status2); | 57 | mobilebackup2_error_t mobilebackup2_send_status_response(mobilebackup2_client_t client, int status_code, const char *status1, plist_t status2); |
| 58 | 58 | ||
| 59 | #ifdef __cplusplus | 59 | #ifdef __cplusplus |
diff --git a/src/mobilebackup2.c b/src/mobilebackup2.c index 7b6ea33..2fbadd2 100644 --- a/src/mobilebackup2.c +++ b/src/mobilebackup2.c | |||
| @@ -355,16 +355,32 @@ leave: | |||
| 355 | } | 355 | } |
| 356 | 356 | ||
| 357 | /** | 357 | /** |
| 358 | * TODO | 358 | * Send a request to the connected mobilebackup2 service. |
| 359 | * | ||
| 360 | * @param client | ||
| 361 | * @param request The request to send to the backup service. | ||
| 362 | * Currently, this is one of "Backup", "Restore", "Info", or "List". | ||
| 363 | * @param target_identifier UUID of the target device. | ||
| 364 | * @param source_identifier UUID of backup data? | ||
| 365 | * @param options Additional options in a plist of type PLIST_DICT. | ||
| 366 | * | ||
| 367 | * @return MOBILEBACKUP2_E_SUCCESS if the request was successfully sent, | ||
| 368 | * or a MOBILEBACKUP2_E_* error value otherwise. | ||
| 359 | */ | 369 | */ |
| 360 | mobilebackup2_error_t mobilebackup2_request_backup(mobilebackup2_client_t client, const char *uuid) | 370 | mobilebackup2_error_t mobilebackup2_send_request(mobilebackup2_client_t client, const char *request, const char *target_identifier, const char *source_identifier, plist_t options) |
| 361 | { | 371 | { |
| 362 | if (!client || !client->parent) | 372 | if (!client || !client->parent || !request || !target_identifier) |
| 363 | return MOBILEBACKUP2_E_INVALID_ARG; | 373 | return MOBILEBACKUP2_E_INVALID_ARG; |
| 364 | 374 | ||
| 365 | plist_t dict = plist_new_dict(); | 375 | plist_t dict = plist_new_dict(); |
| 366 | plist_dict_insert_item(dict, "TargetIdentifier", plist_new_string(uuid)); | 376 | plist_dict_insert_item(dict, "TargetIdentifier", plist_new_string(target_identifier)); |
| 367 | mobilebackup2_error_t err = internal_mobilebackup2_send_message(client, "Backup", dict); | 377 | if (source_identifier) { |
| 378 | plist_dict_insert_item(dict, "SourceIdentifier", plist_new_string(source_identifier)); | ||
| 379 | } | ||
| 380 | if (options) { | ||
| 381 | plist_dict_insert_item(dict, "Options", plist_copy(options)); | ||
| 382 | } | ||
| 383 | mobilebackup2_error_t err = internal_mobilebackup2_send_message(client, request, dict); | ||
| 368 | plist_free(dict); | 384 | plist_free(dict); |
| 369 | 385 | ||
| 370 | return err; | 386 | return err; |
diff --git a/tools/idevicebackup4.c b/tools/idevicebackup4.c index 4b39510..a44abb6 100644 --- a/tools/idevicebackup4.c +++ b/tools/idevicebackup4.c | |||
| @@ -1381,7 +1381,7 @@ checkpoint: | |||
| 1381 | /* request backup from device with manifest from last backup */ | 1381 | /* request backup from device with manifest from last backup */ |
| 1382 | printf("Requesting backup from device...\n"); | 1382 | printf("Requesting backup from device...\n"); |
| 1383 | 1383 | ||
| 1384 | err = mobilebackup2_request_backup(mobilebackup2, uuid); | 1384 | err = mobilebackup2_send_request(mobilebackup2, "Backup", uuid, NULL, NULL); |
| 1385 | if (err == MOBILEBACKUP2_E_SUCCESS) { | 1385 | if (err == MOBILEBACKUP2_E_SUCCESS) { |
| 1386 | /*if (is_full_backup) | 1386 | /*if (is_full_backup) |
| 1387 | printf("Full backup mode.\n"); | 1387 | printf("Full backup mode.\n"); |
