summaryrefslogtreecommitdiffstats
path: root/include/libimobiledevice/mobile_image_mounter.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/libimobiledevice/mobile_image_mounter.h')
-rw-r--r--include/libimobiledevice/mobile_image_mounter.h100
1 files changed, 100 insertions, 0 deletions
diff --git a/include/libimobiledevice/mobile_image_mounter.h b/include/libimobiledevice/mobile_image_mounter.h
index 560fec6..569b288 100644
--- a/include/libimobiledevice/mobile_image_mounter.h
+++ b/include/libimobiledevice/mobile_image_mounter.h
@@ -53,13 +53,113 @@ typedef mobile_image_mounter_client_private *mobile_image_mounter_client_t; /**<
53typedef ssize_t (*mobile_image_mounter_upload_cb_t) (void* buffer, size_t length, void *user_data); 53typedef ssize_t (*mobile_image_mounter_upload_cb_t) (void* buffer, size_t length, void *user_data);
54 54
55/* Interface */ 55/* Interface */
56
57/**
58 * Connects to the mobile_image_mounter service on the specified device.
59 *
60 * @param device The device to connect to.
61 * @param service The service descriptor returned by lockdownd_start_service.
62 * @param client Pointer that will be set to a newly allocated
63 * mobile_image_mounter_client_t upon successful return.
64 *
65 * @return MOBILE_IMAGE_MOUNTER_E_SUCCESS on success,
66 * MOBILE_IMAGE_MOUNTER_E_INVALID_ARG if device is NULL,
67 * or MOBILE_IMAGE_MOUNTER_E_CONN_FAILED if the connection to the
68 * device could not be established.
69 */
56mobile_image_mounter_error_t mobile_image_mounter_new(idevice_t device, lockdownd_service_descriptor_t service, mobile_image_mounter_client_t *client); 70mobile_image_mounter_error_t mobile_image_mounter_new(idevice_t device, lockdownd_service_descriptor_t service, mobile_image_mounter_client_t *client);
71
72/**
73 * Starts a new mobile_image_mounter 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 * mobile_image_mounter_t upon successful return. Must be freed using
78 * mobile_image_mounter_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 MOBILE_IMAGE_MOUNTER_E_SUCCESS on success, or an MOBILE_IMAGE_MOUNTER_E_* error
83 * code otherwise.
84 */
57mobile_image_mounter_error_t mobile_image_mounter_start_service(idevice_t device, mobile_image_mounter_client_t* client, const char* label); 85mobile_image_mounter_error_t mobile_image_mounter_start_service(idevice_t device, mobile_image_mounter_client_t* client, const char* label);
86
87/**
88 * Disconnects a mobile_image_mounter client from the device and frees up the
89 * mobile_image_mounter client data.
90 *
91 * @param client The mobile_image_mounter client to disconnect and free.
92 *
93 * @return MOBILE_IMAGE_MOUNTER_E_SUCCESS on success,
94 * or MOBILE_IMAGE_MOUNTER_E_INVALID_ARG if client is NULL.
95 */
58mobile_image_mounter_error_t mobile_image_mounter_free(mobile_image_mounter_client_t client); 96mobile_image_mounter_error_t mobile_image_mounter_free(mobile_image_mounter_client_t client);
59 97
98
99/**
100 * Tells if the image of ImageType is already mounted.
101 *
102 * @param client The client use
103 * @param image_type The type of the image to look up
104 * @param result Pointer to a plist that will receive the result of the
105 * operation.
106 *
107 * @note This function may return MOBILE_IMAGE_MOUNTER_E_SUCCESS even if the
108 * operation has failed. Check the resulting plist for further information.
109 *
110 * @return MOBILE_IMAGE_MOUNTER_E_SUCCESS on success, or an error code on error
111 */
60mobile_image_mounter_error_t mobile_image_mounter_lookup_image(mobile_image_mounter_client_t client, const char *image_type, plist_t *result); 112mobile_image_mounter_error_t mobile_image_mounter_lookup_image(mobile_image_mounter_client_t client, const char *image_type, plist_t *result);
113
114/**
115 * Uploads an image to the device.
116 *
117 * @param client The connected mobile_image_mounter client.
118 * @param image_type Type of image that is being uploaded.
119 * @param image_size Total size of the image.
120 * @param upload_cb Callback function that gets the data chunks for uploading
121 * the image.
122 * @param userdata User defined data for the upload callback function.
123 *
124 * @return MOBILE_IMAGE_MOUNTER_E_SUCCESS on succes, or a
125 * MOBILE_IMAGE_MOUNTER_E_* error code otherwise.
126 */
61mobile_image_mounter_error_t mobile_image_mounter_upload_image(mobile_image_mounter_client_t client, const char *image_type, size_t image_size, mobile_image_mounter_upload_cb_t upload_cb, void* userdata); 127mobile_image_mounter_error_t mobile_image_mounter_upload_image(mobile_image_mounter_client_t client, const char *image_type, size_t image_size, mobile_image_mounter_upload_cb_t upload_cb, void* userdata);
128
129/**
130 * Mounts an image on the device.
131 *
132 * @param client The connected mobile_image_mounter client.
133 * @param image_path The absolute path of the image to mount. The image must
134 * be present before calling this function.
135 * @param image_signature Pointer to a buffer holding the images' signature
136 * @param signature_length Length of the signature image_signature points to
137 * @param image_type Type of image to mount
138 * @param result Pointer to a plist that will receive the result of the
139 * operation.
140 *
141 * @note This function may return MOBILE_IMAGE_MOUNTER_E_SUCCESS even if the
142 * operation has failed. Check the resulting plist for further information.
143 * Note that there is no unmounting function. The mount persists until the
144 * device is rebooted.
145 *
146 * @return MOBILE_IMAGE_MOUNTER_E_SUCCESS on success,
147 * MOBILE_IMAGE_MOUNTER_E_INVALID_ARG if on ore more parameters are
148 * invalid, or another error code otherwise.
149 */
62mobile_image_mounter_error_t mobile_image_mounter_mount_image(mobile_image_mounter_client_t client, const char *image_path, const char *image_signature, uint16_t signature_length, const char *image_type, plist_t *result); 150mobile_image_mounter_error_t mobile_image_mounter_mount_image(mobile_image_mounter_client_t client, const char *image_path, const char *image_signature, uint16_t signature_length, const char *image_type, plist_t *result);
151
152/**
153 * Hangs up the connection to the mobile_image_mounter service.
154 * This functions has to be called before freeing up a mobile_image_mounter
155 * instance. If not, errors appear in the device's syslog.
156 *
157 * @param client The client to hang up
158 *
159 * @return MOBILE_IMAGE_MOUNTER_E_SUCCESS on success,
160 * MOBILE_IMAGE_MOUNTER_E_INVALID_ARG if client is invalid,
161 * or another error code otherwise.
162 */
63mobile_image_mounter_error_t mobile_image_mounter_hangup(mobile_image_mounter_client_t client); 163mobile_image_mounter_error_t mobile_image_mounter_hangup(mobile_image_mounter_client_t client);
64 164
65#ifdef __cplusplus 165#ifdef __cplusplus