summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2010-11-22 23:15:48 +0100
committerGravatar Martin Szulecki2011-04-11 17:05:57 +0200
commitae7013d7d8355da926c0818182dd500589b48ed6 (patch)
tree871f5c2f4ffd0db6d514d58cfcff7592055d1dcb /src
parentbd8d84245b4ca80858bf9b61682268e6c4095f34 (diff)
downloadlibimobiledevice-ae7013d7d8355da926c0818182dd500589b48ed6.tar.gz
libimobiledevice-ae7013d7d8355da926c0818182dd500589b48ed6.tar.bz2
mobilebackup2: small api changes
Diffstat (limited to 'src')
-rw-r--r--src/mobilebackup2.c26
1 files changed, 21 insertions, 5 deletions
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:
}
/**
- * TODO
+ * Send a request to the connected mobilebackup2 service.
+ *
+ * @param client
+ * @param request The request to send to the backup service.
+ * Currently, this is one of "Backup", "Restore", "Info", or "List".
+ * @param target_identifier UUID of the target device.
+ * @param source_identifier UUID of backup data?
+ * @param options Additional options in a plist of type PLIST_DICT.
+ *
+ * @return MOBILEBACKUP2_E_SUCCESS if the request was successfully sent,
+ * or a MOBILEBACKUP2_E_* error value otherwise.
*/
-mobilebackup2_error_t mobilebackup2_request_backup(mobilebackup2_client_t client, const char *uuid)
+mobilebackup2_error_t mobilebackup2_send_request(mobilebackup2_client_t client, const char *request, const char *target_identifier, const char *source_identifier, plist_t options)
{
- if (!client || !client->parent)
+ if (!client || !client->parent || !request || !target_identifier)
return MOBILEBACKUP2_E_INVALID_ARG;
plist_t dict = plist_new_dict();
- plist_dict_insert_item(dict, "TargetIdentifier", plist_new_string(uuid));
- mobilebackup2_error_t err = internal_mobilebackup2_send_message(client, "Backup", dict);
+ plist_dict_insert_item(dict, "TargetIdentifier", plist_new_string(target_identifier));
+ if (source_identifier) {
+ plist_dict_insert_item(dict, "SourceIdentifier", plist_new_string(source_identifier));
+ }
+ if (options) {
+ plist_dict_insert_item(dict, "Options", plist_copy(options));
+ }
+ mobilebackup2_error_t err = internal_mobilebackup2_send_message(client, request, dict);
plist_free(dict);
return err;