diff options
| author | 2014-03-27 10:07:09 -0400 | |
|---|---|---|
| committer | 2014-03-27 21:40:43 -0400 | |
| commit | 2342dc5b4ef148b993fbe3816f3facdef8365546 (patch) | |
| tree | 69f812d91b2fc07db0fad5dcba6c80d2f8b6849e /include/libimobiledevice/mobilebackup2.h | |
| 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 'include/libimobiledevice/mobilebackup2.h')
| -rw-r--r-- | include/libimobiledevice/mobilebackup2.h | 144 |
1 files changed, 144 insertions, 0 deletions
diff --git a/include/libimobiledevice/mobilebackup2.h b/include/libimobiledevice/mobilebackup2.h index 65bbfc7..ad1dcea 100644 --- a/include/libimobiledevice/mobilebackup2.h +++ b/include/libimobiledevice/mobilebackup2.h | |||
| @@ -51,16 +51,160 @@ typedef int16_t mobilebackup2_error_t; | |||
| 51 | typedef struct mobilebackup2_client_private mobilebackup2_client_private; | 51 | typedef struct mobilebackup2_client_private mobilebackup2_client_private; |
| 52 | typedef mobilebackup2_client_private *mobilebackup2_client_t; /**< The client handle. */ | 52 | typedef mobilebackup2_client_private *mobilebackup2_client_t; /**< The client handle. */ |
| 53 | 53 | ||
| 54 | |||
| 55 | /** | ||
| 56 | * Connects to the mobilebackup2 service on the specified device. | ||
| 57 | * | ||
| 58 | * @param device The device to connect to. | ||
| 59 | * @param service The service descriptor returned by lockdownd_start_service. | ||
| 60 | * @param client Pointer that will be set to a newly allocated | ||
| 61 | * mobilebackup2_client_t upon successful return. | ||
| 62 | * | ||
| 63 | * @return MOBILEBACKUP2_E_SUCCESS on success, MOBILEBACKUP2_E_INVALID ARG | ||
| 64 | * if one or more parameter is invalid, or MOBILEBACKUP2_E_BAD_VERSION | ||
| 65 | * if the mobilebackup2 version on the device is newer. | ||
| 66 | */ | ||
| 54 | mobilebackup2_error_t mobilebackup2_client_new(idevice_t device, lockdownd_service_descriptor_t service, mobilebackup2_client_t * client); | 67 | mobilebackup2_error_t mobilebackup2_client_new(idevice_t device, lockdownd_service_descriptor_t service, mobilebackup2_client_t * client); |
| 68 | |||
| 69 | /** | ||
| 70 | * Starts a new mobilebackup2 service on the specified device and connects to it. | ||
| 71 | * | ||
| 72 | * @param device The device to connect to. | ||
| 73 | * @param client Pointer that will point to a newly allocated | ||
| 74 | * mobilebackup2_client_t upon successful return. Must be freed using | ||
| 75 | * mobilebackup2_client_free() after use. | ||
| 76 | * @param label The label to use for communication. Usually the program name. | ||
| 77 | * Pass NULL to disable sending the label in requests to lockdownd. | ||
| 78 | * | ||
| 79 | * @return MOBILEBACKUP2_E_SUCCESS on success, or an MOBILEBACKUP2_E_* error | ||
| 80 | * code otherwise. | ||
| 81 | */ | ||
| 55 | mobilebackup2_error_t mobilebackup2_client_start_service(idevice_t device, mobilebackup2_client_t* client, const char* label); | 82 | mobilebackup2_error_t mobilebackup2_client_start_service(idevice_t device, mobilebackup2_client_t* client, const char* label); |
| 83 | |||
| 84 | /** | ||
| 85 | * Disconnects a mobilebackup2 client from the device and frees up the | ||
| 86 | * mobilebackup2 client data. | ||
| 87 | * | ||
| 88 | * @param client The mobilebackup2 client to disconnect and free. | ||
| 89 | * | ||
| 90 | * @return MOBILEBACKUP2_E_SUCCESS on success, or MOBILEBACKUP2_E_INVALID_ARG | ||
| 91 | * if client is NULL. | ||
| 92 | */ | ||
| 56 | mobilebackup2_error_t mobilebackup2_client_free(mobilebackup2_client_t client); | 93 | mobilebackup2_error_t mobilebackup2_client_free(mobilebackup2_client_t client); |
| 57 | 94 | ||
| 95 | |||
| 96 | /** | ||
| 97 | * Sends a backup message plist. | ||
| 98 | * | ||
| 99 | * @param client The connected MobileBackup client to use. | ||
| 100 | * @param message The message to send. This will be inserted into the request | ||
| 101 | * plist as value for MessageName. If this parameter is NULL, | ||
| 102 | * the plist passed in the options parameter will be sent directly. | ||
| 103 | * @param options Additional options as PLIST_DICT to add to the request. | ||
| 104 | * The MessageName key with the value passed in the message parameter | ||
| 105 | * will be inserted into this plist before sending it. This parameter | ||
| 106 | * can be NULL if message is not NULL. | ||
| 107 | */ | ||
| 58 | mobilebackup2_error_t mobilebackup2_send_message(mobilebackup2_client_t client, const char *message, plist_t options); | 108 | mobilebackup2_error_t mobilebackup2_send_message(mobilebackup2_client_t client, const char *message, plist_t options); |
| 109 | |||
| 110 | /** | ||
| 111 | * Receives a DL* message plist from the device. | ||
| 112 | * This function is a wrapper around device_link_service_receive_message. | ||
| 113 | * | ||
| 114 | * @param client The connected MobileBackup client to use. | ||
| 115 | * @param msg_plist Pointer to a plist that will be set to the contents of the | ||
| 116 | * message plist upon successful return. | ||
| 117 | * @param dlmessage A pointer that will be set to a newly allocated char* | ||
| 118 | * containing the DL* string from the given plist. It is up to the caller | ||
| 119 | * to free the allocated memory. If this parameter is NULL | ||
| 120 | * it will be ignored. | ||
| 121 | * | ||
| 122 | * @return MOBILEBACKUP2_E_SUCCESS if a DL* message was received, | ||
| 123 | * MOBILEBACKUP2_E_INVALID_ARG if client or message is invalid, | ||
| 124 | * MOBILEBACKUP2_E_PLIST_ERROR if the received plist is invalid | ||
| 125 | * or is not a DL* message plist, or MOBILEBACKUP2_E_MUX_ERROR if | ||
| 126 | * receiving from the device failed. | ||
| 127 | */ | ||
| 59 | mobilebackup2_error_t mobilebackup2_receive_message(mobilebackup2_client_t client, plist_t *msg_plist, char **dlmessage); | 128 | mobilebackup2_error_t mobilebackup2_receive_message(mobilebackup2_client_t client, plist_t *msg_plist, char **dlmessage); |
| 129 | |||
| 130 | /** | ||
| 131 | * Send binary data to the device. | ||
| 132 | * | ||
| 133 | * @note This function returns MOBILEBACKUP2_E_SUCCESS even if less than the | ||
| 134 | * requested length has been sent. The fourth parameter is required and | ||
| 135 | * must be checked to ensure if the whole data has been sent. | ||
| 136 | * | ||
| 137 | * @param client The MobileBackup client to send to. | ||
| 138 | * @param data Pointer to the data to send | ||
| 139 | * @param length Number of bytes to send | ||
| 140 | * @param bytes Number of bytes actually sent | ||
| 141 | * | ||
| 142 | * @return MOBILEBACKUP2_E_SUCCESS if any data was successfully sent, | ||
| 143 | * MOBILEBACKUP2_E_INVALID_ARG if one of the parameters is invalid, | ||
| 144 | * or MOBILEBACKUP2_E_MUX_ERROR if sending of the data failed. | ||
| 145 | */ | ||
| 60 | mobilebackup2_error_t mobilebackup2_send_raw(mobilebackup2_client_t client, const char *data, uint32_t length, uint32_t *bytes); | 146 | mobilebackup2_error_t mobilebackup2_send_raw(mobilebackup2_client_t client, const char *data, uint32_t length, uint32_t *bytes); |
| 147 | |||
| 148 | /** | ||
| 149 | * Receive binary from the device. | ||
| 150 | * | ||
| 151 | * @note This function returns MOBILEBACKUP2_E_SUCCESS even if no data | ||
| 152 | * has been received (unless a communication error occured). | ||
| 153 | * The fourth parameter is required and must be checked to know how | ||
| 154 | * many bytes were actually received. | ||
| 155 | * | ||
| 156 | * @param client The MobileBackup client to receive from. | ||
| 157 | * @param data Pointer to a buffer that will be filled with the received data. | ||
| 158 | * @param length Number of bytes to receive. The data buffer needs to be large | ||
| 159 | * enough to store this amount of data. | ||
| 160 | * @paran bytes Number of bytes actually received. | ||
| 161 | * | ||
| 162 | * @return MOBILEBACKUP2_E_SUCCESS if any or no data was received, | ||
| 163 | * MOBILEBACKUP2_E_INVALID_ARG if one of the parameters is invalid, | ||
| 164 | * or MOBILEBACKUP2_E_MUX_ERROR if receiving the data failed. | ||
| 165 | */ | ||
| 61 | mobilebackup2_error_t mobilebackup2_receive_raw(mobilebackup2_client_t client, char *data, uint32_t length, uint32_t *bytes); | 166 | mobilebackup2_error_t mobilebackup2_receive_raw(mobilebackup2_client_t client, char *data, uint32_t length, uint32_t *bytes); |
| 167 | |||
| 168 | /** | ||
| 169 | * Performs the mobilebackup2 protocol version exchange. | ||
| 170 | * | ||
| 171 | * @param client The MobileBackup client to use. | ||
| 172 | * @param local_versions An array of supported versions to send to the remote. | ||
| 173 | * @param count The number of items in local_versions. | ||
| 174 | * @param remote_version Holds the protocol version of the remote on success. | ||
| 175 | * | ||
| 176 | * @return MOBILEBACKUP2_E_SUCCESS on success, or a MOBILEBACKUP2_E_* error | ||
| 177 | * code otherwise. | ||
| 178 | */ | ||
| 62 | mobilebackup2_error_t mobilebackup2_version_exchange(mobilebackup2_client_t client, double local_versions[], char count, double *remote_version); | 179 | mobilebackup2_error_t mobilebackup2_version_exchange(mobilebackup2_client_t client, double local_versions[], char count, double *remote_version); |
| 180 | |||
| 181 | /** | ||
| 182 | * Send a request to the connected mobilebackup2 service. | ||
| 183 | * | ||
| 184 | * @param client | ||
| 185 | * @param request The request to send to the backup service. | ||
| 186 | * Currently, this is one of "Backup", "Restore", "Info", or "List". | ||
| 187 | * @param target_identifier UDID of the target device. | ||
| 188 | * @param source_identifier UDID of backup data? | ||
| 189 | * @param options Additional options in a plist of type PLIST_DICT. | ||
| 190 | * | ||
| 191 | * @return MOBILEBACKUP2_E_SUCCESS if the request was successfully sent, | ||
| 192 | * or a MOBILEBACKUP2_E_* error value otherwise. | ||
| 193 | */ | ||
| 63 | mobilebackup2_error_t mobilebackup2_send_request(mobilebackup2_client_t client, const char *request, const char *target_identifier, const char *source_identifier, plist_t options); | 194 | mobilebackup2_error_t mobilebackup2_send_request(mobilebackup2_client_t client, const char *request, const char *target_identifier, const char *source_identifier, plist_t options); |
| 195 | |||
| 196 | /** | ||
| 197 | * Sends a DLMessageStatusResponse to the device. | ||
| 198 | * | ||
| 199 | * @param client The MobileBackup client to use. | ||
| 200 | * @param status_code The status code to send. | ||
| 201 | * @param status1 A status message to send. Can be NULL if not required. | ||
| 202 | * @param status2 An additional status plist to attach to the response. | ||
| 203 | * Can be NULL if not required. | ||
| 204 | * | ||
| 205 | * @return MOBILEBACKUP2_E_SUCCESS on success, MOBILEBACKUP2_E_INVALID_ARG | ||
| 206 | * if client is invalid, or another MOBILEBACKUP2_E_* otherwise. | ||
| 207 | */ | ||
| 64 | mobilebackup2_error_t mobilebackup2_send_status_response(mobilebackup2_client_t client, int status_code, const char *status1, plist_t status2); | 208 | mobilebackup2_error_t mobilebackup2_send_status_response(mobilebackup2_client_t client, int status_code, const char *status1, plist_t status2); |
| 65 | 209 | ||
| 66 | #ifdef __cplusplus | 210 | #ifdef __cplusplus |
