summaryrefslogtreecommitdiffstats
path: root/include/libimobiledevice/mobilebackup.h
diff options
context:
space:
mode:
authorGravatar Aaron Burghardt2014-03-27 10:07:09 -0400
committerGravatar Aaron Burghardt2014-03-27 21:40:43 -0400
commit2342dc5b4ef148b993fbe3816f3facdef8365546 (patch)
tree69f812d91b2fc07db0fad5dcba6c80d2f8b6849e /include/libimobiledevice/mobilebackup.h
parentee82e861a8c942b5013accd7589cf898d1f97167 (diff)
downloadlibimobiledevice-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/mobilebackup.h')
-rw-r--r--include/libimobiledevice/mobilebackup.h169
1 files changed, 169 insertions, 0 deletions
diff --git a/include/libimobiledevice/mobilebackup.h b/include/libimobiledevice/mobilebackup.h
index c62e99e..c07ba68 100644
--- a/include/libimobiledevice/mobilebackup.h
+++ b/include/libimobiledevice/mobilebackup.h
@@ -56,18 +56,187 @@ typedef enum {
56 MB_RESTORE_PRESERVE_CAMERA_ROLL = 1 << 2 56 MB_RESTORE_PRESERVE_CAMERA_ROLL = 1 << 2
57} mobilebackup_flags_t; 57} mobilebackup_flags_t;
58 58
59
60/**
61 * Connects to the mobilebackup service on the specified device.
62 *
63 * @param device The device to connect to.
64 * @param service The service descriptor returned by lockdownd_start_service.
65 * @param client Pointer that will be set to a newly allocated
66 * mobilebackup_client_t upon successful return.
67 *
68 * @return MOBILEBACKUP_E_SUCCESS on success, MOBILEBACKUP_E_INVALID ARG if one
69 * or more parameters are invalid, or DEVICE_LINK_SERVICE_E_BAD_VERSION if
70 * the mobilebackup version on the device is newer.
71 */
59mobilebackup_error_t mobilebackup_client_new(idevice_t device, lockdownd_service_descriptor_t service, mobilebackup_client_t * client); 72mobilebackup_error_t mobilebackup_client_new(idevice_t device, lockdownd_service_descriptor_t service, mobilebackup_client_t * client);
73
74/**
75 * Starts a new mobilebackup service on the specified device and connects to it.
76 *
77 * @param device The device to connect to.
78 * @param client Pointer that will point to a newly allocated
79 * mobilebackup_client_t upon successful return. Must be freed using
80 * mobilebackup_client_free() after use.
81 * @param label The label to use for communication. Usually the program name.
82 * Pass NULL to disable sending the label in requests to lockdownd.
83 *
84 * @return MOBILEBACKUP_E_SUCCESS on success, or an MOBILEBACKUP_E_* error
85 * code otherwise.
86 */
60mobilebackup_error_t mobilebackup_client_start_service(idevice_t device, mobilebackup_client_t* client, const char* label); 87mobilebackup_error_t mobilebackup_client_start_service(idevice_t device, mobilebackup_client_t* client, const char* label);
88
89/**
90 * Disconnects a mobilebackup client from the device and frees up the
91 * mobilebackup client data.
92 *
93 * @param client The mobilebackup client to disconnect and free.
94 *
95 * @return MOBILEBACKUP_E_SUCCESS on success, or MOBILEBACKUP_E_INVALID_ARG
96 * if client is NULL.
97 */
61mobilebackup_error_t mobilebackup_client_free(mobilebackup_client_t client); 98mobilebackup_error_t mobilebackup_client_free(mobilebackup_client_t client);
62 99
100
101/**
102 * Polls the device for mobilebackup data.
103 *
104 * @param client The mobilebackup client
105 * @param plist A pointer to the location where the plist should be stored
106 *
107 * @return an error code
108 */
63mobilebackup_error_t mobilebackup_receive(mobilebackup_client_t client, plist_t *plist); 109mobilebackup_error_t mobilebackup_receive(mobilebackup_client_t client, plist_t *plist);
110
111/**
112 * Sends mobilebackup data to the device
113 *
114 * @note This function is low-level and should only be used if you need to send
115 * a new type of message.
116 *
117 * @param client The mobilebackup client
118 * @param plist The location of the plist to send
119 *
120 * @return an error code
121 */
64mobilebackup_error_t mobilebackup_send(mobilebackup_client_t client, plist_t plist); 122mobilebackup_error_t mobilebackup_send(mobilebackup_client_t client, plist_t plist);
123
124/**
125 * Request a backup from the connected device.
126 *
127 * @param client The connected MobileBackup client to use.
128 * @param backup_manifest The backup manifest, a plist_t of type PLIST_DICT
129 * containing the backup state of the last backup. For a first-time backup
130 * set this parameter to NULL.
131 * @param base_path The base path on the device to use for the backup
132 * operation, usually "/".
133 * @param proto_version A string denoting the version of the backup protocol
134 * to use. Latest known version is "1.6"
135 *
136 * @return MOBILEBACKUP_E_SUCCESS on success, MOBILEBACKUP_E_INVALID_ARG if
137 * one of the parameters is invalid, MOBILEBACKUP_E_PLIST_ERROR if
138 * backup_manifest is not of type PLIST_DICT, MOBILEBACKUP_E_MUX_ERROR
139 * if a communication error occurs, MOBILEBACKUP_E_REPLY_NOT_OK
140 */
65mobilebackup_error_t mobilebackup_request_backup(mobilebackup_client_t client, plist_t backup_manifest, const char *base_path, const char *proto_version); 141mobilebackup_error_t mobilebackup_request_backup(mobilebackup_client_t client, plist_t backup_manifest, const char *base_path, const char *proto_version);
142
143/**
144 * Sends a confirmation to the device that a backup file has been received.
145 *
146 * @param client The connected MobileBackup client to use.
147 *
148 * @return MOBILEBACKUP_E_SUCCESS on success, MOBILEBACKUP_E_INVALID_ARG if
149 * client is invalid, or MOBILEBACKUP_E_MUX_ERROR if a communication error
150 * occurs.
151 */
66mobilebackup_error_t mobilebackup_send_backup_file_received(mobilebackup_client_t client); 152mobilebackup_error_t mobilebackup_send_backup_file_received(mobilebackup_client_t client);
153
154/**
155 * Request that a backup should be restored to the connected device.
156 *
157 * @param client The connected MobileBackup client to use.
158 * @param backup_manifest The backup manifest, a plist_t of type PLIST_DICT
159 * containing the backup state to be restored.
160 * @param flags Flags to send with the request. Currently this is a combination
161 * of the following mobilebackup_flags_t:
162 * MB_RESTORE_NOTIFY_SPRINGBOARD - let SpringBoard show a 'Restore' screen
163 * MB_RESTORE_PRESERVE_SETTINGS - do not overwrite any settings
164 * MB_RESTORE_PRESERVE_CAMERA_ROLL - preserve the photos of the camera roll
165 * @param proto_version A string denoting the version of the backup protocol
166 * to use. Latest known version is "1.6". Ideally this value should be
167 * extracted from the given manifest plist.
168 *
169 * @return MOBILEBACKUP_E_SUCCESS on success, MOBILEBACKUP_E_INVALID_ARG if
170 * one of the parameters is invalid, MOBILEBACKUP_E_PLIST_ERROR if
171 * backup_manifest is not of type PLIST_DICT, MOBILEBACKUP_E_MUX_ERROR
172 * if a communication error occurs, or MOBILEBACKUP_E_REPLY_NOT_OK
173 * if the device did not accept the request.
174 */
67mobilebackup_error_t mobilebackup_request_restore(mobilebackup_client_t client, plist_t backup_manifest, mobilebackup_flags_t flags, const char *proto_version); 175mobilebackup_error_t mobilebackup_request_restore(mobilebackup_client_t client, plist_t backup_manifest, mobilebackup_flags_t flags, const char *proto_version);
176
177/**
178 * Receive a confirmation from the device that it successfully received
179 * a restore file.
180 *
181 * @param client The connected MobileBackup client to use.
182 * @param result Pointer to a plist_t that will be set to the received plist
183 * for further processing. The caller has to free it using plist_free().
184 * Note that it will be set to NULL if the operation itself fails due to
185 * a communication or plist error.
186 * If this parameter is NULL, it will be ignored.
187 *
188 * @return MOBILEBACKUP_E_SUCCESS on success, MOBILEBACKUP_E_INVALID_ARG if
189 * client is invalid, MOBILEBACKUP_E_REPLY_NOT_OK if the expected
190 * 'BackupMessageRestoreFileReceived' message could not be received,
191 * MOBILEBACKUP_E_PLIST_ERROR if the received message is not a valid backup
192 * message plist, or MOBILEBACKUP_E_MUX_ERROR if a communication error
193 * occurs.
194 */
68mobilebackup_error_t mobilebackup_receive_restore_file_received(mobilebackup_client_t client, plist_t *result); 195mobilebackup_error_t mobilebackup_receive_restore_file_received(mobilebackup_client_t client, plist_t *result);
196
197/**
198 * Receive a confirmation from the device that it successfully received
199 * application data file.
200 *
201 * @param client The connected MobileBackup client to use.
202 * @param result Pointer to a plist_t that will be set to the received plist
203 * for further processing. The caller has to free it using plist_free().
204 * Note that it will be set to NULL if the operation itself fails due to
205 * a communication or plist error.
206 * If this parameter is NULL, it will be ignored.
207 *
208 * @return MOBILEBACKUP_E_SUCCESS on success, MOBILEBACKUP_E_INVALID_ARG if
209 * client is invalid, MOBILEBACKUP_E_REPLY_NOT_OK if the expected
210 * 'BackupMessageRestoreApplicationReceived' message could not be received,
211 * MOBILEBACKUP_E_PLIST_ERROR if the received message is not a valid backup
212 * message plist, or MOBILEBACKUP_E_MUX_ERROR if a communication error
213 * occurs.
214 */
69mobilebackup_error_t mobilebackup_receive_restore_application_received(mobilebackup_client_t client, plist_t *result); 215mobilebackup_error_t mobilebackup_receive_restore_application_received(mobilebackup_client_t client, plist_t *result);
216
217/**
218 * Tells the device that the restore process is complete and waits for the
219 * device to close the connection. After that, the device should reboot.
220 *
221 * @param client The connected MobileBackup client to use.
222 *
223 * @return MOBILEBACKUP_E_SUCCESS on success, MOBILEBACKUP_E_INVALID_ARG if
224 * client is invalid, MOBILEBACKUP_E_PLIST_ERROR if the received disconnect
225 * message plist is invalid, or MOBILEBACKUP_E_MUX_ERROR if a communication
226 * error occurs.
227 */
70mobilebackup_error_t mobilebackup_send_restore_complete(mobilebackup_client_t client); 228mobilebackup_error_t mobilebackup_send_restore_complete(mobilebackup_client_t client);
229
230/**
231 * Sends a backup error message to the device.
232 *
233 * @param client The connected MobileBackup client to use.
234 * @param reason A string describing the reason for the error message.
235 *
236 * @return MOBILEBACKUP_E_SUCCESS on success, MOBILEBACKUP_E_INVALID_ARG if
237 * one of the parameters is invalid, or MOBILEBACKUP_E_MUX_ERROR if a
238 * communication error occurs.
239 */
71mobilebackup_error_t mobilebackup_send_error(mobilebackup_client_t client, const char *reason); 240mobilebackup_error_t mobilebackup_send_error(mobilebackup_client_t client, const char *reason);
72 241
73#ifdef __cplusplus 242#ifdef __cplusplus