diff options
Diffstat (limited to 'include/libimobiledevice/mobilesync.h')
-rw-r--r-- | include/libimobiledevice/mobilesync.h | 67 |
1 files changed, 36 insertions, 31 deletions
diff --git a/include/libimobiledevice/mobilesync.h b/include/libimobiledevice/mobilesync.h index e6885c7..c3bc53d 100644 --- a/include/libimobiledevice/mobilesync.h +++ b/include/libimobiledevice/mobilesync.h @@ -3,8 +3,8 @@ * @brief Synchronize data classes with a device and computer. * \internal * + * Copyright (c) 2010-2019 Nikias Bassen, All Rights Reserved. * Copyright (c) 2010-2014 Martin Szulecki All Rights Reserved. - * Copyright (c) 2010-2011 Nikias Bassen All Rights Reserved. * Copyright (c) 2014 Christophe Fergeau All Rights Reserved. * Copyright (c) 2010 Bryan Forbes All Rights Reserved. * Copyright (c) 2009 Jonathan Beck All Rights Reserved. @@ -34,6 +34,7 @@ extern "C" { #include <libimobiledevice/libimobiledevice.h> #include <libimobiledevice/lockdown.h> +/** Service identifier passed to lockdownd_start_service() to start the mobilesync service */ #define MOBILESYNC_SERVICE_NAME "com.apple.mobilesync" /** Error Codes */ @@ -42,11 +43,13 @@ typedef enum { MOBILESYNC_E_INVALID_ARG = -1, MOBILESYNC_E_PLIST_ERROR = -2, MOBILESYNC_E_MUX_ERROR = -3, - MOBILESYNC_E_BAD_VERSION = -4, - MOBILESYNC_E_SYNC_REFUSED = -5, - MOBILESYNC_E_CANCELLED = -6, - MOBILESYNC_E_WRONG_DIRECTION = -7, - MOBILESYNC_E_NOT_READY = -8, + MOBILESYNC_E_SSL_ERROR = -4, + MOBILESYNC_E_RECEIVE_TIMEOUT = -5, + MOBILESYNC_E_BAD_VERSION = -6, + MOBILESYNC_E_SYNC_REFUSED = -7, + MOBILESYNC_E_CANCELLED = -8, + MOBILESYNC_E_WRONG_DIRECTION = -9, + MOBILESYNC_E_NOT_READY = -10, MOBILESYNC_E_UNKNOWN_ERROR = -256 } mobilesync_error_t; @@ -57,14 +60,16 @@ typedef enum { MOBILESYNC_SYNC_TYPE_RESET /**< Reset-sync signals that the computer should send all data again. */ } mobilesync_sync_type_t; -typedef struct mobilesync_client_private mobilesync_client_private; +typedef struct mobilesync_client_private mobilesync_client_private; /**< \private */ typedef mobilesync_client_private *mobilesync_client_t; /**< The client handle */ +/** Anchors used by the device and computer (structure) */ typedef struct { - char *device_anchor; - char *computer_anchor; + char *device_anchor; /**< device anchor */ + char *computer_anchor; /**< computer anchor */ } mobilesync_anchors; -typedef mobilesync_anchors *mobilesync_anchors_t; /**< Anchors used by the device and computer. */ +/** Anchors used by the device and computer */ +typedef mobilesync_anchors *mobilesync_anchors_t; /* Interface */ @@ -81,7 +86,7 @@ typedef mobilesync_anchors *mobilesync_anchors_t; /**< Anchors used by the devic * @retval DEVICE_LINK_SERVICE_E_BAD_VERSION if the mobilesync version on * the device is newer. */ -mobilesync_error_t mobilesync_client_new(idevice_t device, lockdownd_service_descriptor_t service, mobilesync_client_t * client); +LIBIMOBILEDEVICE_API mobilesync_error_t mobilesync_client_new(idevice_t device, lockdownd_service_descriptor_t service, mobilesync_client_t * client); /** * Starts a new mobilesync service on the specified device and connects to it. @@ -96,7 +101,7 @@ mobilesync_error_t mobilesync_client_new(idevice_t device, lockdownd_service_des * @return MOBILESYNC_E_SUCCESS on success, or an MOBILESYNC_E_* error * code otherwise. */ -mobilesync_error_t mobilesync_client_start_service(idevice_t device, mobilesync_client_t* client, const char* label); +LIBIMOBILEDEVICE_API mobilesync_error_t mobilesync_client_start_service(idevice_t device, mobilesync_client_t* client, const char* label); /** * Disconnects a mobilesync client from the device and frees up the @@ -107,7 +112,7 @@ mobilesync_error_t mobilesync_client_start_service(idevice_t device, mobilesync_ * @retval MOBILESYNC_E_SUCCESS on success * @retval MOBILESYNC_E_INVALID_ARG if \a client is NULL. */ -mobilesync_error_t mobilesync_client_free(mobilesync_client_t client); +LIBIMOBILEDEVICE_API mobilesync_error_t mobilesync_client_free(mobilesync_client_t client); /** @@ -118,7 +123,7 @@ mobilesync_error_t mobilesync_client_free(mobilesync_client_t client); * * @return an error code */ -mobilesync_error_t mobilesync_receive(mobilesync_client_t client, plist_t *plist); +LIBIMOBILEDEVICE_API mobilesync_error_t mobilesync_receive(mobilesync_client_t client, plist_t *plist); /** * Sends mobilesync data to the device @@ -131,7 +136,7 @@ mobilesync_error_t mobilesync_receive(mobilesync_client_t client, plist_t *plist * * @return an error code */ -mobilesync_error_t mobilesync_send(mobilesync_client_t client, plist_t plist); +LIBIMOBILEDEVICE_API mobilesync_error_t mobilesync_send(mobilesync_client_t client, plist_t plist); /** @@ -154,7 +159,7 @@ mobilesync_error_t mobilesync_send(mobilesync_client_t client, plist_t plist); * @retval MOBILESYNC_E_CANCELLED if the device explicitly cancelled the * sync request */ -mobilesync_error_t mobilesync_start(mobilesync_client_t client, const char *data_class, mobilesync_anchors_t anchors, uint64_t computer_data_class_version, mobilesync_sync_type_t *sync_type, uint64_t *device_data_class_version, char** error_description); +LIBIMOBILEDEVICE_API mobilesync_error_t mobilesync_start(mobilesync_client_t client, const char *data_class, mobilesync_anchors_t anchors, uint64_t computer_data_class_version, mobilesync_sync_type_t *sync_type, uint64_t *device_data_class_version, char** error_description); /** * Cancels a running synchronization session with a device at any time. @@ -165,7 +170,7 @@ mobilesync_error_t mobilesync_start(mobilesync_client_t client, const char *data * @retval MOBILESYNC_E_SUCCESS on success * @retval MOBILESYNC_E_INVALID_ARG if one of the parameters is invalid */ -mobilesync_error_t mobilesync_cancel(mobilesync_client_t client, const char* reason); +LIBIMOBILEDEVICE_API mobilesync_error_t mobilesync_cancel(mobilesync_client_t client, const char* reason); /** * Finish a synchronization session of a data class on the device. @@ -178,7 +183,7 @@ mobilesync_error_t mobilesync_cancel(mobilesync_client_t client, const char* rea * @retval MOBILESYNC_E_PLIST_ERROR if the received plist is not of valid * form */ -mobilesync_error_t mobilesync_finish(mobilesync_client_t client); +LIBIMOBILEDEVICE_API mobilesync_error_t mobilesync_finish(mobilesync_client_t client); /** @@ -191,7 +196,7 @@ mobilesync_error_t mobilesync_finish(mobilesync_client_t client); * @retval MOBILESYNC_E_SUCCESS on success * @retval MOBILESYNC_E_INVALID_ARG if one of the parameters is invalid */ -mobilesync_error_t mobilesync_get_all_records_from_device(mobilesync_client_t client); +LIBIMOBILEDEVICE_API mobilesync_error_t mobilesync_get_all_records_from_device(mobilesync_client_t client); /** * Requests to receive only changed records of the currently set data class from the device. @@ -203,7 +208,7 @@ mobilesync_error_t mobilesync_get_all_records_from_device(mobilesync_client_t cl * @retval MOBILESYNC_E_SUCCESS on success * @retval MOBILESYNC_E_INVALID_ARG if one of the parameters is invalid */ -mobilesync_error_t mobilesync_get_changes_from_device(mobilesync_client_t client); +LIBIMOBILEDEVICE_API mobilesync_error_t mobilesync_get_changes_from_device(mobilesync_client_t client); /** * Requests the device to delete all records of the current data class @@ -216,7 +221,7 @@ mobilesync_error_t mobilesync_get_changes_from_device(mobilesync_client_t client * @retval MOBILESYNC_E_INVALID_ARG if one of the parameters is invalid * @retval MOBILESYNC_E_PLIST_ERROR if the received plist is not of valid form */ -mobilesync_error_t mobilesync_clear_all_records_on_device(mobilesync_client_t client); +LIBIMOBILEDEVICE_API mobilesync_error_t mobilesync_clear_all_records_on_device(mobilesync_client_t client); /** @@ -232,7 +237,7 @@ mobilesync_error_t mobilesync_clear_all_records_on_device(mobilesync_client_t cl * @retval MOBILESYNC_E_CANCELLED if the device explicitly cancelled the * session */ -mobilesync_error_t mobilesync_receive_changes(mobilesync_client_t client, plist_t *entities, uint8_t *is_last_record, plist_t *actions); +LIBIMOBILEDEVICE_API mobilesync_error_t mobilesync_receive_changes(mobilesync_client_t client, plist_t *entities, uint8_t *is_last_record, plist_t *actions); /** * Acknowledges to the device that the changes have been merged on the computer @@ -242,7 +247,7 @@ mobilesync_error_t mobilesync_receive_changes(mobilesync_client_t client, plist_ * @retval MOBILESYNC_E_SUCCESS on success * @retval MOBILESYNC_E_INVALID_ARG if one of the parameters is invalid */ -mobilesync_error_t mobilesync_acknowledge_changes_from_device(mobilesync_client_t client); +LIBIMOBILEDEVICE_API mobilesync_error_t mobilesync_acknowledge_changes_from_device(mobilesync_client_t client); /** @@ -262,7 +267,7 @@ mobilesync_error_t mobilesync_acknowledge_changes_from_device(mobilesync_client_ * @retval MOBILESYNC_E_NOT_READY if the device is not ready to start * receiving any changes */ -mobilesync_error_t mobilesync_ready_to_send_changes_from_computer(mobilesync_client_t client); +LIBIMOBILEDEVICE_API mobilesync_error_t mobilesync_ready_to_send_changes_from_computer(mobilesync_client_t client); /** @@ -279,7 +284,7 @@ mobilesync_error_t mobilesync_ready_to_send_changes_from_computer(mobilesync_cli * @retval MOBILESYNC_E_WRONG_DIRECTION if the current sync direction does * not permit this call */ -mobilesync_error_t mobilesync_send_changes(mobilesync_client_t client, plist_t entities, uint8_t is_last_record, plist_t actions); +LIBIMOBILEDEVICE_API mobilesync_error_t mobilesync_send_changes(mobilesync_client_t client, plist_t entities, uint8_t is_last_record, plist_t actions); /** * Receives any remapped identifiers reported after the device merged submitted changes. @@ -296,7 +301,7 @@ mobilesync_error_t mobilesync_send_changes(mobilesync_client_t client, plist_t e * @retval MOBILESYNC_E_CANCELLED if the device explicitly cancelled the * session */ -mobilesync_error_t mobilesync_remap_identifiers(mobilesync_client_t client, plist_t *mapping); +LIBIMOBILEDEVICE_API mobilesync_error_t mobilesync_remap_identifiers(mobilesync_client_t client, plist_t *mapping); /* Helper */ @@ -309,14 +314,14 @@ mobilesync_error_t mobilesync_remap_identifiers(mobilesync_client_t client, plis * * @return A new #mobilesync_anchors_t struct. Must be freed using mobilesync_anchors_free(). */ -mobilesync_anchors_t mobilesync_anchors_new(const char *device_anchor, const char *computer_anchor); +LIBIMOBILEDEVICE_API mobilesync_anchors_t mobilesync_anchors_new(const char *device_anchor, const char *computer_anchor); /** * Free memory used by anchors. * * @param anchors The anchors to free. */ -void mobilesync_anchors_free(mobilesync_anchors_t anchors); +LIBIMOBILEDEVICE_API void mobilesync_anchors_free(mobilesync_anchors_t anchors); /** @@ -324,7 +329,7 @@ void mobilesync_anchors_free(mobilesync_anchors_t anchors); * * @return A new plist_t of type PLIST_DICT. */ -plist_t mobilesync_actions_new(void); +LIBIMOBILEDEVICE_API plist_t mobilesync_actions_new(void); /** * Add one or more new key:value pairs to the given actions plist. @@ -338,14 +343,14 @@ plist_t mobilesync_actions_new(void); * integer to use as a boolean value indicating that the device should * link submitted changes and report remapped identifiers. */ -void mobilesync_actions_add(plist_t actions, ...); +LIBIMOBILEDEVICE_API void mobilesync_actions_add(plist_t actions, ...); /** * Free actions plist. * * @param actions The actions plist to free. Does nothing if NULL is passed. */ -void mobilesync_actions_free(plist_t actions); +LIBIMOBILEDEVICE_API void mobilesync_actions_free(plist_t actions); #ifdef __cplusplus } |