summaryrefslogtreecommitdiffstats
path: root/include/libimobiledevice/house_arrest.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/libimobiledevice/house_arrest.h')
-rw-r--r--include/libimobiledevice/house_arrest.h114
1 files changed, 114 insertions, 0 deletions
diff --git a/include/libimobiledevice/house_arrest.h b/include/libimobiledevice/house_arrest.h
index ccd6ac7..170cad2 100644
--- a/include/libimobiledevice/house_arrest.h
+++ b/include/libimobiledevice/house_arrest.h
@@ -51,14 +51,128 @@ typedef struct house_arrest_client_private house_arrest_client_private;
51typedef house_arrest_client_private *house_arrest_client_t; /**< The client handle. */ 51typedef house_arrest_client_private *house_arrest_client_t; /**< The client handle. */
52 52
53/* Interface */ 53/* Interface */
54
55/**
56 * Connects to the house_arrest 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 point to a newly allocated
61 * housearrest_client_t upon successful return.
62 *
63 * @return HOUSE_ARREST_E_SUCCESS on success, HOUSE_ARREST_E_INVALID_ARG when
64 * client is NULL, or an HOUSE_ARREST_E_* error code otherwise.
65 */
54house_arrest_error_t house_arrest_client_new(idevice_t device, lockdownd_service_descriptor_t service, house_arrest_client_t *client); 66house_arrest_error_t house_arrest_client_new(idevice_t device, lockdownd_service_descriptor_t service, house_arrest_client_t *client);
67
68/**
69 * Starts a new house_arrest service on the specified device and connects to it.
70 *
71 * @param device The device to connect to.
72 * @param client Pointer that will point to a newly allocated
73 * house_arrest_client_t upon successful return. Must be freed using
74 * house_arrest_client_free() after use.
75 * @param label The label to use for communication. Usually the program name.
76 * Pass NULL to disable sending the label in requests to lockdownd.
77 *
78 * @return HOUSE_ARREST_E_SUCCESS on success, or an HOUSE_ARREST_E_* error
79 * code otherwise.
80 */
55house_arrest_error_t house_arrest_client_start_service(idevice_t device, house_arrest_client_t* client, const char* label); 81house_arrest_error_t house_arrest_client_start_service(idevice_t device, house_arrest_client_t* client, const char* label);
82
83/**
84 * Disconnects an house_arrest client from the device and frees up the
85 * house_arrest client data.
86 *
87 * @note After using afc_client_new_from_house_arrest_client(), make sure
88 * you call afc_client_free() before calling this function to ensure
89 * a proper cleanup. Do not call this function if you still need to
90 * perform AFC operations since it will close the connection.
91 *
92 * @param client The house_arrest client to disconnect and free.
93 *
94 * @return HOUSE_ARREST_E_SUCCESS on success, HOUSE_ARREST_E_INVALID_ARG when
95 * client is NULL, or an HOUSE_ARREST_E_* error code otherwise.
96 */
56house_arrest_error_t house_arrest_client_free(house_arrest_client_t client); 97house_arrest_error_t house_arrest_client_free(house_arrest_client_t client);
57 98
99
100/**
101 * Sends a generic request to the connected house_arrest service.
102 *
103 * @param client The house_arrest client to use.
104 * @param dict The request to send as a plist of type PLIST_DICT.
105 *
106 * @note If this function returns HOUSE_ARREST_E_SUCCESS it does not mean
107 * that the request was successful. To check for success or failure you
108 * need to call house_arrest_get_result().
109 * @see house_arrest_get_result
110 *
111 * @return HOUSE_ARREST_E_SUCCESS if the request was successfully sent,
112 * HOUSE_ARREST_E_INVALID_ARG if client or dict is invalid,
113 * HOUSE_ARREST_E_PLIST_ERROR if dict is not a plist of type PLIST_DICT,
114 * HOUSE_ARREST_E_INVALID_MODE if the client is not in the correct mode,
115 * or HOUSE_ARREST_E_CONN_FAILED if a connection error occured.
116 */
58house_arrest_error_t house_arrest_send_request(house_arrest_client_t client, plist_t dict); 117house_arrest_error_t house_arrest_send_request(house_arrest_client_t client, plist_t dict);
118
119/**
120 * Send a command to the connected house_arrest service.
121 * Calls house_arrest_send_request() internally.
122 *
123 * @param client The house_arrest client to use.
124 * @param command The command to send. Currently, only VendContainer and
125 * VendDocuments are known.
126 * @param appid The application identifier to pass along with the .
127 *
128 * @note If this function returns HOUSE_ARREST_E_SUCCESS it does not mean
129 * that the command was successful. To check for success or failure you
130 * need to call house_arrest_get_result().
131 * @see house_arrest_get_result
132 *
133 * @return HOUSE_ARREST_E_SUCCESS if the command was successfully sent,
134 * HOUSE_ARREST_E_INVALID_ARG if client, command, or appid is invalid,
135 * HOUSE_ARREST_E_INVALID_MODE if the client is not in the correct mode,
136 * or HOUSE_ARREST_E_CONN_FAILED if a connection error occured.
137 */
59house_arrest_error_t house_arrest_send_command(house_arrest_client_t client, const char *command, const char *appid); 138house_arrest_error_t house_arrest_send_command(house_arrest_client_t client, const char *command, const char *appid);
139
140/**
141 * Retrieves the result of a previously sent house_arrest_request_* request.
142 *
143 * @param client The house_arrest client to use
144 * @param dict Pointer that will be set to a plist containing the result to
145 * the last performed operation. It holds a key 'Status' with the value
146 * 'Complete' on success or a key 'Error' with an error description as
147 * value. The caller is responsible for freeing the returned plist.
148 *
149 * @return HOUSE_ARREST_E_SUCCESS if a result plist was retrieved,
150 * HOUSE_ARREST_E_INVALID_ARG if client is invalid,
151 * HOUSE_ARREST_E_INVALID_MODE if the client is not in the correct mode,
152 * or HOUSE_ARREST_E_CONN_FAILED if a connection error occured.
153 */
60house_arrest_error_t house_arrest_get_result(house_arrest_client_t client, plist_t *dict); 154house_arrest_error_t house_arrest_get_result(house_arrest_client_t client, plist_t *dict);
61 155
156
157/**
158 * Creates an AFC client using the given house_arrest client's connection
159 * allowing file access to a specific application directory requested by
160 * functions like house_arrest_request_vendor_documents().
161 *
162 * @param client The house_arrest client to use.
163 * @param afc_client Pointer that will be set to a newly allocated afc_client_t
164 * upon successful return.
165 *
166 * @note After calling this function the house_arrest client will go in an
167 * AFC mode that will only allow calling house_arrest_client_free().
168 * Only call house_arrest_client_free() if all AFC operations have
169 * completed since it will close the connection.
170 *
171 * @return AFC_E_SUCCESS if the afc client was successfully created,
172 * AFC_E_INVALID_ARG if client is invalid or was already used to create
173 * an afc client, or an AFC_E_* error code returned by
174 * afc_client_new_with_service_client().
175 */
62afc_error_t afc_client_new_from_house_arrest_client(house_arrest_client_t client, afc_client_t *afc_client); 176afc_error_t afc_client_new_from_house_arrest_client(house_arrest_client_t client, afc_client_t *afc_client);
63 177
64#ifdef __cplusplus 178#ifdef __cplusplus