summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2011-01-10 16:12:02 +0100
committerGravatar Martin Szulecki2011-04-11 19:42:19 +0200
commitca931097ff93286d65ecab3ab07156601c2e252f (patch)
tree10b21bbc1c5b1b801f20fa94863d82ba9b0aa339 /src
parent850df2c4188541109b2d08a6b8ae2c627da21d78 (diff)
downloadlibimobiledevice-ca931097ff93286d65ecab3ab07156601c2e252f.tar.gz
libimobiledevice-ca931097ff93286d65ecab3ab07156601c2e252f.tar.bz2
mobilebackup2: Add missing function documentation
Diffstat (limited to 'src')
-rw-r--r--src/mobilebackup2.c74
1 files changed, 70 insertions, 4 deletions
diff --git a/src/mobilebackup2.c b/src/mobilebackup2.c
index 2fbadd2..ae7ac03 100644
--- a/src/mobilebackup2.c
+++ b/src/mobilebackup2.c
@@ -234,16 +234,47 @@ leave:
234} 234}
235 235
236/** 236/**
237 * TODO 237 * Receives a DL* message plist from the device.
238 * This function is a wrapper around device_link_service_receive_message.
239 *
240 * @param client The connected MobileBackup client to use.
241 * @param msg_plist Pointer to a plist that will be set to the contents of the
242 * message plist upon successful return.
243 * @param dlmessage A pointer that will be set to a newly allocated char*
244 * containing the DL* string from the given plist. It is up to the caller
245 * to free the allocated memory. If this parameter is NULL
246 * it will be ignored.
247 *
248 * @return MOBILEBACKUP2_E_SUCCESS if a DL* message was received,
249 * MOBILEBACKUP2_E_INVALID_ARG if client or message is invalid,
250 * MOBILEBACKUP2_E_PLIST_ERROR if the received plist is invalid
251 * or is not a DL* message plist, or MOBILEBACKUP2_E_MUX_ERROR if
252 * receiving from the device failed.
238 */ 253 */
239mobilebackup2_error_t mobilebackup2_receive_message(mobilebackup2_client_t client, plist_t *msg_plist, char **dlmessage) 254mobilebackup2_error_t mobilebackup2_receive_message(mobilebackup2_client_t client, plist_t *msg_plist, char **dlmessage)
240{ 255{
241 return mobilebackup2_error(device_link_service_receive_message(client->parent, msg_plist, dlmessage)); 256 return mobilebackup2_error(device_link_service_receive_message(client->parent, msg_plist, dlmessage));
242} 257}
243 258
259/**
260 * Send binary data to the device.
261 *
262 * @note This function returns MOBILEBACKUP2_E_SUCCESS even if less than the
263 * requested length has been sent. The fourth parameter is required and
264 * must be checked to ensure if the whole data has been sent.
265 *
266 * @param client The MobileBackup client to send to.
267 * @param data Pointer to the data to send
268 * @param length Number of bytes to send
269 * @param bytes Number of bytes actually sent
270 *
271 * @return MOBILEBACKUP2_E_SUCCESS if any data was successfully sent,
272 * MOBILEBACKUP2_E_INVALID_ARG if one of the parameters is invalid,
273 * or MOBILEBACKUP2_E_MUX_ERROR if sending of the data failed.
274 */
244mobilebackup2_error_t mobilebackup2_send_raw(mobilebackup2_client_t client, const char *data, uint32_t length, uint32_t *bytes) 275mobilebackup2_error_t mobilebackup2_send_raw(mobilebackup2_client_t client, const char *data, uint32_t length, uint32_t *bytes)
245{ 276{
246 if (!client || !client->parent) 277 if (!client || !client->parent || !data || (length == 0) || !bytes)
247 return MOBILEBACKUP2_E_INVALID_ARG; 278 return MOBILEBACKUP2_E_INVALID_ARG;
248 279
249 *bytes = 0; 280 *bytes = 0;
@@ -267,9 +298,27 @@ mobilebackup2_error_t mobilebackup2_send_raw(mobilebackup2_client_t client, cons
267 } 298 }
268} 299}
269 300
301/**
302 * Receive binary from the device.
303 *
304 * @note This function returns MOBILEBACKUP2_E_SUCCESS even if no data
305 * has been received (unless a communication error occured).
306 * The fourth parameter is required and must be checked to know how
307 * many bytes were actually received.
308 *
309 * @param client The MobileBackup client to receive from.
310 * @param data Pointer to a buffer that will be filled with the received data.
311 * @param length Number of bytes to receive. The data buffer needs to be large
312 * enough to store this amount of data.
313 * @paran bytes Number of bytes actually received.
314 *
315 * @return MOBILEBACKUP2_E_SUCCESS if any or no data was received,
316 * MOBILEBACKUP2_E_INVALID_ARG if one of the parameters is invalid,
317 * or MOBILEBACKUP2_E_MUX_ERROR if receiving the data failed.
318 */
270mobilebackup2_error_t mobilebackup2_receive_raw(mobilebackup2_client_t client, char *data, uint32_t length, uint32_t *bytes) 319mobilebackup2_error_t mobilebackup2_receive_raw(mobilebackup2_client_t client, char *data, uint32_t length, uint32_t *bytes)
271{ 320{
272 if (!client || !client->parent) 321 if (!client || !client->parent || !data || (length == 0) || !bytes)
273 return MOBILEBACKUP2_E_INVALID_ARG; 322 return MOBILEBACKUP2_E_INVALID_ARG;
274 323
275 idevice_connection_t conn = client->parent->parent->connection; 324 idevice_connection_t conn = client->parent->parent->connection;
@@ -295,7 +344,12 @@ mobilebackup2_error_t mobilebackup2_receive_raw(mobilebackup2_client_t client, c
295} 344}
296 345
297/** 346/**
298 * TODO 347 * Performs the mobilebackup2 protocol version exchange.
348 *
349 * @param The MobileBackup client to use.
350 *
351 * @return MOBILEBACKUP2_E_SUCCESS on success, or a MOBILEBACKUP2_E_* error
352 * code otherwise.
299 */ 353 */
300mobilebackup2_error_t mobilebackup2_version_exchange(mobilebackup2_client_t client) 354mobilebackup2_error_t mobilebackup2_version_exchange(mobilebackup2_client_t client)
301{ 355{
@@ -386,6 +440,18 @@ mobilebackup2_error_t mobilebackup2_send_request(mobilebackup2_client_t client,
386 return err; 440 return err;
387} 441}
388 442
443/**
444 * Sends a DLMessageStatusResponse to the device.
445 *
446 * @param client The MobileBackup client to use.
447 * @param status_code The status code to send.
448 * @param status1 A status message to send. Can be NULL if not required.
449 * @param status2 An additional status plist to attach to the response.
450 * Can be NULL if not required.
451 *
452 * @return MOBILEBACKUP2_E_SUCCESS on success, MOBILEBACKUP2_E_INVALID_ARG
453 * if client is invalid, or another MOBILEBACKUP2_E_* otherwise.
454 */
389mobilebackup2_error_t mobilebackup2_send_status_response(mobilebackup2_client_t client, int status_code, const char *status1, plist_t status2) 455mobilebackup2_error_t mobilebackup2_send_status_response(mobilebackup2_client_t client, int status_code, const char *status1, plist_t status2)
390{ 456{
391 if (!client || !client->parent) 457 if (!client || !client->parent)