diff options
| author | 2014-03-27 10:07:09 -0400 | |
|---|---|---|
| committer | 2014-03-27 21:40:43 -0400 | |
| commit | 2342dc5b4ef148b993fbe3816f3facdef8365546 (patch) | |
| tree | 69f812d91b2fc07db0fad5dcba6c80d2f8b6849e /src/mobilebackup2.c | |
| parent | ee82e861a8c942b5013accd7589cf898d1f97167 (diff) | |
| download | libimobiledevice-2342dc5b4ef148b993fbe3816f3facdef8365546.tar.gz libimobiledevice-2342dc5b4ef148b993fbe3816f3facdef8365546.tar.bz2 | |
Moved Doxygen comments from source files to public headers.
Conflicts:
include/libimobiledevice/afc.h
Diffstat (limited to 'src/mobilebackup2.c')
| -rw-r--r-- | src/mobilebackup2.c | 134 |
1 files changed, 0 insertions, 134 deletions
diff --git a/src/mobilebackup2.c b/src/mobilebackup2.c index 09b156d..41fe5d3 100644 --- a/src/mobilebackup2.c +++ b/src/mobilebackup2.c | |||
| @@ -61,18 +61,6 @@ static mobilebackup2_error_t mobilebackup2_error(device_link_service_error_t err | |||
| 61 | return MOBILEBACKUP2_E_UNKNOWN_ERROR; | 61 | return MOBILEBACKUP2_E_UNKNOWN_ERROR; |
| 62 | } | 62 | } |
| 63 | 63 | ||
| 64 | /** | ||
| 65 | * Connects to the mobilebackup2 service on the specified device. | ||
| 66 | * | ||
| 67 | * @param device The device to connect to. | ||
| 68 | * @param service The service descriptor returned by lockdownd_start_service. | ||
| 69 | * @param client Pointer that will be set to a newly allocated | ||
| 70 | * mobilebackup2_client_t upon successful return. | ||
| 71 | * | ||
| 72 | * @return MOBILEBACKUP2_E_SUCCESS on success, MOBILEBACKUP2_E_INVALID ARG | ||
| 73 | * if one or more parameter is invalid, or MOBILEBACKUP2_E_BAD_VERSION | ||
| 74 | * if the mobilebackup2 version on the device is newer. | ||
| 75 | */ | ||
| 76 | mobilebackup2_error_t mobilebackup2_client_new(idevice_t device, lockdownd_service_descriptor_t service, | 64 | mobilebackup2_error_t mobilebackup2_client_new(idevice_t device, lockdownd_service_descriptor_t service, |
| 77 | mobilebackup2_client_t * client) | 65 | mobilebackup2_client_t * client) |
| 78 | { | 66 | { |
| @@ -101,19 +89,6 @@ mobilebackup2_error_t mobilebackup2_client_new(idevice_t device, lockdownd_servi | |||
| 101 | return ret; | 89 | return ret; |
| 102 | } | 90 | } |
| 103 | 91 | ||
| 104 | /** | ||
| 105 | * Starts a new mobilebackup2 service on the specified device and connects to it. | ||
| 106 | * | ||
| 107 | * @param device The device to connect to. | ||
| 108 | * @param client Pointer that will point to a newly allocated | ||
| 109 | * mobilebackup2_client_t upon successful return. Must be freed using | ||
| 110 | * mobilebackup2_client_free() after use. | ||
| 111 | * @param label The label to use for communication. Usually the program name. | ||
| 112 | * Pass NULL to disable sending the label in requests to lockdownd. | ||
| 113 | * | ||
| 114 | * @return MOBILEBACKUP2_E_SUCCESS on success, or an MOBILEBACKUP2_E_* error | ||
| 115 | * code otherwise. | ||
| 116 | */ | ||
| 117 | mobilebackup2_error_t mobilebackup2_client_start_service(idevice_t device, mobilebackup2_client_t * client, const char* label) | 92 | mobilebackup2_error_t mobilebackup2_client_start_service(idevice_t device, mobilebackup2_client_t * client, const char* label) |
| 118 | { | 93 | { |
| 119 | mobilebackup2_error_t err = MOBILEBACKUP2_E_UNKNOWN_ERROR; | 94 | mobilebackup2_error_t err = MOBILEBACKUP2_E_UNKNOWN_ERROR; |
| @@ -121,15 +96,6 @@ mobilebackup2_error_t mobilebackup2_client_start_service(idevice_t device, mobil | |||
| 121 | return err; | 96 | return err; |
| 122 | } | 97 | } |
| 123 | 98 | ||
| 124 | /** | ||
| 125 | * Disconnects a mobilebackup2 client from the device and frees up the | ||
| 126 | * mobilebackup2 client data. | ||
| 127 | * | ||
| 128 | * @param client The mobilebackup2 client to disconnect and free. | ||
| 129 | * | ||
| 130 | * @return MOBILEBACKUP2_E_SUCCESS on success, or MOBILEBACKUP2_E_INVALID_ARG | ||
| 131 | * if client is NULL. | ||
| 132 | */ | ||
| 133 | mobilebackup2_error_t mobilebackup2_client_free(mobilebackup2_client_t client) | 99 | mobilebackup2_error_t mobilebackup2_client_free(mobilebackup2_client_t client) |
| 134 | { | 100 | { |
| 135 | if (!client) | 101 | if (!client) |
| @@ -143,18 +109,6 @@ mobilebackup2_error_t mobilebackup2_client_free(mobilebackup2_client_t client) | |||
| 143 | return err; | 109 | return err; |
| 144 | } | 110 | } |
| 145 | 111 | ||
| 146 | /** | ||
| 147 | * Sends a backup message plist. | ||
| 148 | * | ||
| 149 | * @param client The connected MobileBackup client to use. | ||
| 150 | * @param message The message to send. This will be inserted into the request | ||
| 151 | * plist as value for MessageName. If this parameter is NULL, | ||
| 152 | * the plist passed in the options parameter will be sent directly. | ||
| 153 | * @param options Additional options as PLIST_DICT to add to the request. | ||
| 154 | * The MessageName key with the value passed in the message parameter | ||
| 155 | * will be inserted into this plist before sending it. This parameter | ||
| 156 | * can be NULL if message is not NULL. | ||
| 157 | */ | ||
| 158 | mobilebackup2_error_t mobilebackup2_send_message(mobilebackup2_client_t client, const char *message, plist_t options) | 112 | mobilebackup2_error_t mobilebackup2_send_message(mobilebackup2_client_t client, const char *message, plist_t options) |
| 159 | { | 113 | { |
| 160 | if (!client || !client->parent || (!message && !options)) | 114 | if (!client || !client->parent || (!message && !options)) |
| @@ -253,45 +207,11 @@ leave: | |||
| 253 | return err; | 207 | return err; |
| 254 | } | 208 | } |
| 255 | 209 | ||
| 256 | /** | ||
| 257 | * Receives a DL* message plist from the device. | ||
| 258 | * This function is a wrapper around device_link_service_receive_message. | ||
| 259 | * | ||
| 260 | * @param client The connected MobileBackup client to use. | ||
| 261 | * @param msg_plist Pointer to a plist that will be set to the contents of the | ||
| 262 | * message plist upon successful return. | ||
| 263 | * @param dlmessage A pointer that will be set to a newly allocated char* | ||
| 264 | * containing the DL* string from the given plist. It is up to the caller | ||
| 265 | * to free the allocated memory. If this parameter is NULL | ||
| 266 | * it will be ignored. | ||
| 267 | * | ||
| 268 | * @return MOBILEBACKUP2_E_SUCCESS if a DL* message was received, | ||
| 269 | * MOBILEBACKUP2_E_INVALID_ARG if client or message is invalid, | ||
| 270 | * MOBILEBACKUP2_E_PLIST_ERROR if the received plist is invalid | ||
| 271 | * or is not a DL* message plist, or MOBILEBACKUP2_E_MUX_ERROR if | ||
| 272 | * receiving from the device failed. | ||
| 273 | */ | ||
| 274 | mobilebackup2_error_t mobilebackup2_receive_message(mobilebackup2_client_t client, plist_t *msg_plist, char **dlmessage) | 210 | mobilebackup2_error_t mobilebackup2_receive_message(mobilebackup2_client_t client, plist_t *msg_plist, char **dlmessage) |
| 275 | { | 211 | { |
| 276 | return mobilebackup2_error(device_link_service_receive_message(client->parent, msg_plist, dlmessage)); | 212 | return mobilebackup2_error(device_link_service_receive_message(client->parent, msg_plist, dlmessage)); |
| 277 | } | 213 | } |
| 278 | 214 | ||
| 279 | /** | ||
| 280 | * Send binary data to the device. | ||
| 281 | * | ||
| 282 | * @note This function returns MOBILEBACKUP2_E_SUCCESS even if less than the | ||
| 283 | * requested length has been sent. The fourth parameter is required and | ||
| 284 | * must be checked to ensure if the whole data has been sent. | ||
| 285 | * | ||
| 286 | * @param client The MobileBackup client to send to. | ||
| 287 | * @param data Pointer to the data to send | ||
| 288 | * @param length Number of bytes to send | ||
| 289 | * @param bytes Number of bytes actually sent | ||
| 290 | * | ||
| 291 | * @return MOBILEBACKUP2_E_SUCCESS if any data was successfully sent, | ||
| 292 | * MOBILEBACKUP2_E_INVALID_ARG if one of the parameters is invalid, | ||
| 293 | * or MOBILEBACKUP2_E_MUX_ERROR if sending of the data failed. | ||
| 294 | */ | ||
| 295 | mobilebackup2_error_t mobilebackup2_send_raw(mobilebackup2_client_t client, const char *data, uint32_t length, uint32_t *bytes) | 215 | mobilebackup2_error_t mobilebackup2_send_raw(mobilebackup2_client_t client, const char *data, uint32_t length, uint32_t *bytes) |
| 296 | { | 216 | { |
| 297 | if (!client || !client->parent || !data || (length == 0) || !bytes) | 217 | if (!client || !client->parent || !data || (length == 0) || !bytes) |
| @@ -318,24 +238,6 @@ mobilebackup2_error_t mobilebackup2_send_raw(mobilebackup2_client_t client, cons | |||
| 318 | } | 238 | } |
| 319 | } | 239 | } |
| 320 | 240 | ||
| 321 | /** | ||
| 322 | * Receive binary from the device. | ||
| 323 | * | ||
| 324 | * @note This function returns MOBILEBACKUP2_E_SUCCESS even if no data | ||
| 325 | * has been received (unless a communication error occured). | ||
| 326 | * The fourth parameter is required and must be checked to know how | ||
| 327 | * many bytes were actually received. | ||
| 328 | * | ||
| 329 | * @param client The MobileBackup client to receive from. | ||
| 330 | * @param data Pointer to a buffer that will be filled with the received data. | ||
| 331 | * @param length Number of bytes to receive. The data buffer needs to be large | ||
| 332 | * enough to store this amount of data. | ||
| 333 | * @paran bytes Number of bytes actually received. | ||
| 334 | * | ||
| 335 | * @return MOBILEBACKUP2_E_SUCCESS if any or no data was received, | ||
| 336 | * MOBILEBACKUP2_E_INVALID_ARG if one of the parameters is invalid, | ||
| 337 | * or MOBILEBACKUP2_E_MUX_ERROR if receiving the data failed. | ||
| 338 | */ | ||
| 339 | mobilebackup2_error_t mobilebackup2_receive_raw(mobilebackup2_client_t client, char *data, uint32_t length, uint32_t *bytes) | 241 | mobilebackup2_error_t mobilebackup2_receive_raw(mobilebackup2_client_t client, char *data, uint32_t length, uint32_t *bytes) |
| 340 | { | 242 | { |
| 341 | if (!client || !client->parent || !data || (length == 0) || !bytes) | 243 | if (!client || !client->parent || !data || (length == 0) || !bytes) |
| @@ -363,17 +265,6 @@ mobilebackup2_error_t mobilebackup2_receive_raw(mobilebackup2_client_t client, c | |||
| 363 | } | 265 | } |
| 364 | } | 266 | } |
| 365 | 267 | ||
| 366 | /** | ||
| 367 | * Performs the mobilebackup2 protocol version exchange. | ||
| 368 | * | ||
| 369 | * @param client The MobileBackup client to use. | ||
| 370 | * @param local_versions An array of supported versions to send to the remote. | ||
| 371 | * @param count The number of items in local_versions. | ||
| 372 | * @param remote_version Holds the protocol version of the remote on success. | ||
| 373 | * | ||
| 374 | * @return MOBILEBACKUP2_E_SUCCESS on success, or a MOBILEBACKUP2_E_* error | ||
| 375 | * code otherwise. | ||
| 376 | */ | ||
| 377 | mobilebackup2_error_t mobilebackup2_version_exchange(mobilebackup2_client_t client, double local_versions[], char count, double *remote_version) | 268 | mobilebackup2_error_t mobilebackup2_version_exchange(mobilebackup2_client_t client, double local_versions[], char count, double *remote_version) |
| 378 | { | 269 | { |
| 379 | int i; | 270 | int i; |
| @@ -432,19 +323,6 @@ leave: | |||
| 432 | return err; | 323 | return err; |
| 433 | } | 324 | } |
| 434 | 325 | ||
| 435 | /** | ||
| 436 | * Send a request to the connected mobilebackup2 service. | ||
| 437 | * | ||
| 438 | * @param client | ||
| 439 | * @param request The request to send to the backup service. | ||
| 440 | * Currently, this is one of "Backup", "Restore", "Info", or "List". | ||
| 441 | * @param target_identifier UDID of the target device. | ||
| 442 | * @param source_identifier UDID of backup data? | ||
| 443 | * @param options Additional options in a plist of type PLIST_DICT. | ||
| 444 | * | ||
| 445 | * @return MOBILEBACKUP2_E_SUCCESS if the request was successfully sent, | ||
| 446 | * or a MOBILEBACKUP2_E_* error value otherwise. | ||
| 447 | */ | ||
| 448 | mobilebackup2_error_t mobilebackup2_send_request(mobilebackup2_client_t client, const char *request, const char *target_identifier, const char *source_identifier, plist_t options) | 326 | mobilebackup2_error_t mobilebackup2_send_request(mobilebackup2_client_t client, const char *request, const char *target_identifier, const char *source_identifier, plist_t options) |
| 449 | { | 327 | { |
| 450 | if (!client || !client->parent || !request || !target_identifier) | 328 | if (!client || !client->parent || !request || !target_identifier) |
| @@ -476,18 +354,6 @@ mobilebackup2_error_t mobilebackup2_send_request(mobilebackup2_client_t client, | |||
| 476 | return err; | 354 | return err; |
| 477 | } | 355 | } |
| 478 | 356 | ||
| 479 | /** | ||
| 480 | * Sends a DLMessageStatusResponse to the device. | ||
| 481 | * | ||
| 482 | * @param client The MobileBackup client to use. | ||
| 483 | * @param status_code The status code to send. | ||
| 484 | * @param status1 A status message to send. Can be NULL if not required. | ||
| 485 | * @param status2 An additional status plist to attach to the response. | ||
| 486 | * Can be NULL if not required. | ||
| 487 | * | ||
| 488 | * @return MOBILEBACKUP2_E_SUCCESS on success, MOBILEBACKUP2_E_INVALID_ARG | ||
| 489 | * if client is invalid, or another MOBILEBACKUP2_E_* otherwise. | ||
| 490 | */ | ||
| 491 | mobilebackup2_error_t mobilebackup2_send_status_response(mobilebackup2_client_t client, int status_code, const char *status1, plist_t status2) | 357 | mobilebackup2_error_t mobilebackup2_send_status_response(mobilebackup2_client_t client, int status_code, const char *status1, plist_t status2) |
| 492 | { | 358 | { |
| 493 | if (!client || !client->parent) | 359 | if (!client || !client->parent) |
