summaryrefslogtreecommitdiffstats
path: root/include/libimobiledevice/installation_proxy.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/libimobiledevice/installation_proxy.h')
-rw-r--r--include/libimobiledevice/installation_proxy.h247
1 files changed, 247 insertions, 0 deletions
diff --git a/include/libimobiledevice/installation_proxy.h b/include/libimobiledevice/installation_proxy.h
index 18b7804..4740b20 100644
--- a/include/libimobiledevice/installation_proxy.h
+++ b/include/libimobiledevice/installation_proxy.h
@@ -55,24 +55,271 @@ typedef instproxy_client_private *instproxy_client_t; /**< The client handle. */
55typedef void (*instproxy_status_cb_t) (const char *operation, plist_t status, void *user_data); 55typedef void (*instproxy_status_cb_t) (const char *operation, plist_t status, void *user_data);
56 56
57/* Interface */ 57/* Interface */
58
59/**
60 * Connects to the installation_proxy service on the specified device.
61 *
62 * @param device The device to connect to
63 * @param service The service descriptor returned by lockdownd_start_service.
64 * @param client Pointer that will be set to a newly allocated
65 * instproxy_client_t upon successful return.
66 *
67 * @return INSTPROXY_E_SUCCESS on success, or an INSTPROXY_E_* error value
68 * when an error occured.
69 */
58instproxy_error_t instproxy_client_new(idevice_t device, lockdownd_service_descriptor_t service, instproxy_client_t *client); 70instproxy_error_t instproxy_client_new(idevice_t device, lockdownd_service_descriptor_t service, instproxy_client_t *client);
71
72/**
73 * Starts a new installation_proxy service on the specified device and connects to it.
74 *
75 * @param device The device to connect to.
76 * @param client Pointer that will point to a newly allocated
77 * instproxy_client_t upon successful return. Must be freed using
78 * instproxy_client_free() after use.
79 * @param label The label to use for communication. Usually the program name.
80 * Pass NULL to disable sending the label in requests to lockdownd.
81 *
82 * @return INSTPROXY_E_SUCCESS on success, or an INSTPROXY_E_* error
83 * code otherwise.
84 */
59instproxy_error_t instproxy_client_start_service(idevice_t device, instproxy_client_t * client, const char* label); 85instproxy_error_t instproxy_client_start_service(idevice_t device, instproxy_client_t * client, const char* label);
86
87/**
88 * Disconnects an installation_proxy client from the device and frees up the
89 * installation_proxy client data.
90 *
91 * @param client The installation_proxy client to disconnect and free.
92 *
93 * @return INSTPROXY_E_SUCCESS on success
94 * or INSTPROXY_E_INVALID_ARG if client is NULL.
95 */
60instproxy_error_t instproxy_client_free(instproxy_client_t client); 96instproxy_error_t instproxy_client_free(instproxy_client_t client);
61 97
98
99/**
100 * List installed applications. This function runs synchronously.
101 *
102 * @param client The connected installation_proxy client
103 * @param client_options The client options to use, as PLIST_DICT, or NULL.
104 * Valid client options include:
105 * "ApplicationType" -> "User"
106 * "ApplicationType" -> "System"
107 * @param result Pointer that will be set to a plist that will hold an array
108 * of PLIST_DICT holding information about the applications found.
109 *
110 * @return INSTPROXY_E_SUCCESS on success or an INSTPROXY_E_* error value if
111 * an error occured.
112 */
62instproxy_error_t instproxy_browse(instproxy_client_t client, plist_t client_options, plist_t *result); 113instproxy_error_t instproxy_browse(instproxy_client_t client, plist_t client_options, plist_t *result);
114
115/**
116 * Install an application on the device.
117 *
118 * @param client The connected installation_proxy client
119 * @param pkg_path Path of the installation package (inside the AFC jail)
120 * @param client_options The client options to use, as PLIST_DICT, or NULL.
121 * Valid options include:
122 * "iTunesMetadata" -> PLIST_DATA
123 * "ApplicationSINF" -> PLIST_DATA
124 * "PackageType" -> "Developer"
125 * If PackageType -> Developer is specified, then pkg_path points to
126 * an .app directory instead of an install package.
127 * @param status_cb Callback function for progress and status information. If
128 * NULL is passed, this function will run synchronously.
129 * @param user_data Callback data passed to status_cb.
130 *
131 * @return INSTPROXY_E_SUCCESS on success or an INSTPROXY_E_* error value if
132 * an error occured.
133 *
134 * @note If a callback function is given (async mode), this function returns
135 * INSTPROXY_E_SUCCESS immediately if the status updater thread has been
136 * created successfully; any error occuring during the operation has to be
137 * handled inside the specified callback function.
138 */
63instproxy_error_t instproxy_install(instproxy_client_t client, const char *pkg_path, plist_t client_options, instproxy_status_cb_t status_cb, void *user_data); 139instproxy_error_t instproxy_install(instproxy_client_t client, const char *pkg_path, plist_t client_options, instproxy_status_cb_t status_cb, void *user_data);
140
141/**
142 * Upgrade an application on the device. This function is nearly the same as
143 * instproxy_install; the difference is that the installation progress on the
144 * device is faster if the application is already installed.
145 *
146 * @param client The connected installation_proxy client
147 * @param pkg_path Path of the installation package (inside the AFC jail)
148 * @param client_options The client options to use, as PLIST_DICT, or NULL.
149 * Valid options include:
150 * "iTunesMetadata" -> PLIST_DATA
151 * "ApplicationSINF" -> PLIST_DATA
152 * "PackageType" -> "Developer"
153 * If PackageType -> Developer is specified, then pkg_path points to
154 * an .app directory instead of an install package.
155 * @param status_cb Callback function for progress and status information. If
156 * NULL is passed, this function will run synchronously.
157 * @param user_data Callback data passed to status_cb.
158 *
159 * @return INSTPROXY_E_SUCCESS on success or an INSTPROXY_E_* error value if
160 * an error occured.
161 *
162 * @note If a callback function is given (async mode), this function returns
163 * INSTPROXY_E_SUCCESS immediately if the status updater thread has been
164 * created successfully; any error occuring during the operation has to be
165 * handled inside the specified callback function.
166 */
64instproxy_error_t instproxy_upgrade(instproxy_client_t client, const char *pkg_path, plist_t client_options, instproxy_status_cb_t status_cb, void *user_data); 167instproxy_error_t instproxy_upgrade(instproxy_client_t client, const char *pkg_path, plist_t client_options, instproxy_status_cb_t status_cb, void *user_data);
168
169/**
170 * Uninstall an application from the device.
171 *
172 * @param client The connected installation proxy client
173 * @param appid ApplicationIdentifier of the app to uninstall
174 * @param client_options The client options to use, as PLIST_DICT, or NULL.
175 * Currently there are no known client options, so pass NULL here.
176 * @param status_cb Callback function for progress and status information. If
177 * NULL is passed, this function will run synchronously.
178 * @param user_data Callback data passed to status_cb.
179 *
180 * @return INSTPROXY_E_SUCCESS on success or an INSTPROXY_E_* error value if
181 * an error occured.
182 *
183 * @note If a callback function is given (async mode), this function returns
184 * INSTPROXY_E_SUCCESS immediately if the status updater thread has been
185 * created successfully; any error occuring during the operation has to be
186 * handled inside the specified callback function.
187 */
65instproxy_error_t instproxy_uninstall(instproxy_client_t client, const char *appid, plist_t client_options, instproxy_status_cb_t status_cb, void *user_data); 188instproxy_error_t instproxy_uninstall(instproxy_client_t client, const char *appid, plist_t client_options, instproxy_status_cb_t status_cb, void *user_data);
66 189
190
191/**
192 * List archived applications. This function runs synchronously.
193 *
194 * @see instproxy_archive
195 *
196 * @param client The connected installation_proxy client
197 * @param client_options The client options to use, as PLIST_DICT, or NULL.
198 * Currently there are no known client options, so pass NULL here.
199 * @param result Pointer that will be set to a plist containing a PLIST_DICT
200 * holding information about the archived applications found.
201 *
202 * @return INSTPROXY_E_SUCCESS on success or an INSTPROXY_E_* error value if
203 * an error occured.
204 */
67instproxy_error_t instproxy_lookup_archives(instproxy_client_t client, plist_t client_options, plist_t *result); 205instproxy_error_t instproxy_lookup_archives(instproxy_client_t client, plist_t client_options, plist_t *result);
206
207/**
208 * Archive an application on the device.
209 * This function tells the device to make an archive of the specified
210 * application. This results in the device creating a ZIP archive in the
211 * 'ApplicationArchives' directory and uninstalling the application.
212 *
213 * @param client The connected installation proxy client
214 * @param appid ApplicationIdentifier of the app to archive.
215 * @param client_options The client options to use, as PLIST_DICT, or NULL.
216 * Valid options include:
217 * "SkipUninstall" -> Boolean
218 * "ArchiveType" -> "ApplicationOnly"
219 * @param status_cb Callback function for progress and status information. If
220 * NULL is passed, this function will run synchronously.
221 * @param user_data Callback data passed to status_cb.
222 *
223 * @return INSTPROXY_E_SUCCESS on success or an INSTPROXY_E_* error value if
224 * an error occured.
225 *
226 * @note If a callback function is given (async mode), this function returns
227 * INSTPROXY_E_SUCCESS immediately if the status updater thread has been
228 * created successfully; any error occuring during the operation has to be
229 * handled inside the specified callback function.
230 */
68instproxy_error_t instproxy_archive(instproxy_client_t client, const char *appid, plist_t client_options, instproxy_status_cb_t status_cb, void *user_data); 231instproxy_error_t instproxy_archive(instproxy_client_t client, const char *appid, plist_t client_options, instproxy_status_cb_t status_cb, void *user_data);
232
233/**
234 * Restore a previously archived application on the device.
235 * This function is the counterpart to instproxy_archive.
236 * @see instproxy_archive
237 *
238 * @param client The connected installation proxy client
239 * @param appid ApplicationIdentifier of the app to restore.
240 * @param client_options The client options to use, as PLIST_DICT, or NULL.
241 * Currently there are no known client options, so pass NULL here.
242 * @param status_cb Callback function for progress and status information. If
243 * NULL is passed, this function will run synchronously.
244 * @param user_data Callback data passed to status_cb.
245 *
246 * @return INSTPROXY_E_SUCCESS on success or an INSTPROXY_E_* error value if
247 * an error occured.
248 *
249 * @note If a callback function is given (async mode), this function returns
250 * INSTPROXY_E_SUCCESS immediately if the status updater thread has been
251 * created successfully; any error occuring during the operation has to be
252 * handled inside the specified callback function.
253 */
69instproxy_error_t instproxy_restore(instproxy_client_t client, const char *appid, plist_t client_options, instproxy_status_cb_t status_cb, void *user_data); 254instproxy_error_t instproxy_restore(instproxy_client_t client, const char *appid, plist_t client_options, instproxy_status_cb_t status_cb, void *user_data);
255
256/**
257 * Removes a previously archived application from the device.
258 * This function removes the ZIP archive from the 'ApplicationArchives'
259 * directory.
260 *
261 * @param client The connected installation proxy client
262 * @param appid ApplicationIdentifier of the archived app to remove.
263 * @param client_options The client options to use, as PLIST_DICT, or NULL.
264 * Currently there are no known client options, so passing NULL is fine.
265 * @param status_cb Callback function for progress and status information. If
266 * NULL is passed, this function will run synchronously.
267 * @param user_data Callback data passed to status_cb.
268 *
269 * @return INSTPROXY_E_SUCCESS on success or an INSTPROXY_E_* error value if
270 * an error occured.
271 *
272 * @note If a callback function is given (async mode), this function returns
273 * INSTPROXY_E_SUCCESS immediately if the status updater thread has been
274 * created successfully; any error occuring during the operation has to be
275 * handled inside the specified callback function.
276 */
70instproxy_error_t instproxy_remove_archive(instproxy_client_t client, const char *appid, plist_t client_options, instproxy_status_cb_t status_cb, void *user_data); 277instproxy_error_t instproxy_remove_archive(instproxy_client_t client, const char *appid, plist_t client_options, instproxy_status_cb_t status_cb, void *user_data);
71 278
72/* Helper */ 279/* Helper */
280
281/**
282 * Create a new client_options plist.
283 *
284 * @return A new plist_t of type PLIST_DICT.
285 */
73plist_t instproxy_client_options_new(); 286plist_t instproxy_client_options_new();
287
288/**
289 * Add one or more new key:value pairs to the given client_options.
290 *
291 * @param client_options The client options to modify.
292 * @param ... KEY, VALUE, [KEY, VALUE], NULL
293 *
294 * @note The keys and values passed are expected to be strings, except for the
295 * keys "ApplicationSINF", "iTunesMetadata", "ReturnAttributes" which are
296 * expecting a plist_t node as value and "SkipUninstall" expects int.
297 */
74void instproxy_client_options_add(plist_t client_options, ...); 298void instproxy_client_options_add(plist_t client_options, ...);
299
300/**
301 * Free client_options plist.
302 *
303 * @param client_options The client options plist to free. Does nothing if NULL
304 * is passed.
305 */
75void instproxy_client_options_free(plist_t client_options); 306void instproxy_client_options_free(plist_t client_options);
307
308/**
309 * Query the device for the path of an application.
310 *
311 * @param client The connected installation proxy client.
312 * @param appid ApplicationIdentifier of app to retrieve the path for.
313 * @param path Pointer to store the device path for the application
314 * which is set to NULL if it could not be determined.
315 *
316 * @return INSTPROXY_E_SUCCESS on success, INSTPROXY_E_OP_FAILED if
317 * the path could not be determined or an INSTPROXY_E_* error
318 * value if an error occured.
319 *
320 * @note This implementation browses all applications and matches the
321 * right entry by the application identifier.
322 */
76instproxy_error_t instproxy_client_get_path_for_bundle_identifier(instproxy_client_t client, const char* bundle_id, char** path); 323instproxy_error_t instproxy_client_get_path_for_bundle_identifier(instproxy_client_t client, const char* bundle_id, char** path);
77 324
78#ifdef __cplusplus 325#ifdef __cplusplus