diff options
Diffstat (limited to 'src/house_arrest.c')
| -rw-r--r-- | src/house_arrest.c | 107 |
1 files changed, 0 insertions, 107 deletions
diff --git a/src/house_arrest.c b/src/house_arrest.c index 9aaad34..4158368 100644 --- a/src/house_arrest.c +++ b/src/house_arrest.c | |||
| @@ -55,17 +55,6 @@ static house_arrest_error_t house_arrest_error(property_list_service_error_t err | |||
| 55 | return HOUSE_ARREST_E_UNKNOWN_ERROR; | 55 | return HOUSE_ARREST_E_UNKNOWN_ERROR; |
| 56 | } | 56 | } |
| 57 | 57 | ||
| 58 | /** | ||
| 59 | * Connects to the house_arrest service on the specified device. | ||
| 60 | * | ||
| 61 | * @param device The device to connect to. | ||
| 62 | * @param service The service descriptor returned by lockdownd_start_service. | ||
| 63 | * @param client Pointer that will point to a newly allocated | ||
| 64 | * housearrest_client_t upon successful return. | ||
| 65 | * | ||
| 66 | * @return HOUSE_ARREST_E_SUCCESS on success, HOUSE_ARREST_E_INVALID_ARG when | ||
| 67 | * client is NULL, or an HOUSE_ARREST_E_* error code otherwise. | ||
| 68 | */ | ||
| 69 | house_arrest_error_t house_arrest_client_new(idevice_t device, lockdownd_service_descriptor_t service, house_arrest_client_t *client) | 58 | house_arrest_error_t house_arrest_client_new(idevice_t device, lockdownd_service_descriptor_t service, house_arrest_client_t *client) |
| 70 | { | 59 | { |
| 71 | property_list_service_client_t plistclient = NULL; | 60 | property_list_service_client_t plistclient = NULL; |
| @@ -82,19 +71,6 @@ house_arrest_error_t house_arrest_client_new(idevice_t device, lockdownd_service | |||
| 82 | return HOUSE_ARREST_E_SUCCESS; | 71 | return HOUSE_ARREST_E_SUCCESS; |
| 83 | } | 72 | } |
| 84 | 73 | ||
| 85 | /** | ||
| 86 | * Starts a new house_arrest service on the specified device and connects to it. | ||
| 87 | * | ||
| 88 | * @param device The device to connect to. | ||
| 89 | * @param client Pointer that will point to a newly allocated | ||
| 90 | * house_arrest_client_t upon successful return. Must be freed using | ||
| 91 | * house_arrest_client_free() after use. | ||
| 92 | * @param label The label to use for communication. Usually the program name. | ||
| 93 | * Pass NULL to disable sending the label in requests to lockdownd. | ||
| 94 | * | ||
| 95 | * @return HOUSE_ARREST_E_SUCCESS on success, or an HOUSE_ARREST_E_* error | ||
| 96 | * code otherwise. | ||
| 97 | */ | ||
| 98 | house_arrest_error_t house_arrest_client_start_service(idevice_t device, house_arrest_client_t * client, const char* label) | 74 | house_arrest_error_t house_arrest_client_start_service(idevice_t device, house_arrest_client_t * client, const char* label) |
| 99 | { | 75 | { |
| 100 | house_arrest_error_t err = HOUSE_ARREST_E_UNKNOWN_ERROR; | 76 | house_arrest_error_t err = HOUSE_ARREST_E_UNKNOWN_ERROR; |
| @@ -102,20 +78,6 @@ house_arrest_error_t house_arrest_client_start_service(idevice_t device, house_a | |||
| 102 | return err; | 78 | return err; |
| 103 | } | 79 | } |
| 104 | 80 | ||
| 105 | /** | ||
| 106 | * Disconnects an house_arrest client from the device and frees up the | ||
| 107 | * house_arrest client data. | ||
| 108 | * | ||
| 109 | * @note After using afc_client_new_from_house_arrest_client(), make sure | ||
| 110 | * you call afc_client_free() before calling this function to ensure | ||
| 111 | * a proper cleanup. Do not call this function if you still need to | ||
| 112 | * perform AFC operations since it will close the connection. | ||
| 113 | * | ||
| 114 | * @param client The house_arrest client to disconnect and free. | ||
| 115 | * | ||
| 116 | * @return HOUSE_ARREST_E_SUCCESS on success, HOUSE_ARREST_E_INVALID_ARG when | ||
| 117 | * client is NULL, or an HOUSE_ARREST_E_* error code otherwise. | ||
| 118 | */ | ||
| 119 | house_arrest_error_t house_arrest_client_free(house_arrest_client_t client) | 81 | house_arrest_error_t house_arrest_client_free(house_arrest_client_t client) |
| 120 | { | 82 | { |
| 121 | if (!client) | 83 | if (!client) |
| @@ -131,23 +93,6 @@ house_arrest_error_t house_arrest_client_free(house_arrest_client_t client) | |||
| 131 | return err; | 93 | return err; |
| 132 | } | 94 | } |
| 133 | 95 | ||
| 134 | /** | ||
| 135 | * Sends a generic request to the connected house_arrest service. | ||
| 136 | * | ||
| 137 | * @param client The house_arrest client to use. | ||
| 138 | * @param dict The request to send as a plist of type PLIST_DICT. | ||
| 139 | * | ||
| 140 | * @note If this function returns HOUSE_ARREST_E_SUCCESS it does not mean | ||
| 141 | * that the request was successful. To check for success or failure you | ||
| 142 | * need to call house_arrest_get_result(). | ||
| 143 | * @see house_arrest_get_result | ||
| 144 | * | ||
| 145 | * @return HOUSE_ARREST_E_SUCCESS if the request was successfully sent, | ||
| 146 | * HOUSE_ARREST_E_INVALID_ARG if client or dict is invalid, | ||
| 147 | * HOUSE_ARREST_E_PLIST_ERROR if dict is not a plist of type PLIST_DICT, | ||
| 148 | * HOUSE_ARREST_E_INVALID_MODE if the client is not in the correct mode, | ||
| 149 | * or HOUSE_ARREST_E_CONN_FAILED if a connection error occured. | ||
| 150 | */ | ||
| 151 | house_arrest_error_t house_arrest_send_request(house_arrest_client_t client, plist_t dict) | 96 | house_arrest_error_t house_arrest_send_request(house_arrest_client_t client, plist_t dict) |
| 152 | { | 97 | { |
| 153 | if (!client || !client->parent || !dict) | 98 | if (!client || !client->parent || !dict) |
| @@ -164,25 +109,6 @@ house_arrest_error_t house_arrest_send_request(house_arrest_client_t client, pli | |||
| 164 | return res; | 109 | return res; |
| 165 | } | 110 | } |
| 166 | 111 | ||
| 167 | /** | ||
| 168 | * Send a command to the connected house_arrest service. | ||
| 169 | * Calls house_arrest_send_request() internally. | ||
| 170 | * | ||
| 171 | * @param client The house_arrest client to use. | ||
| 172 | * @param command The command to send. Currently, only VendContainer and | ||
| 173 | * VendDocuments are known. | ||
| 174 | * @param appid The application identifier to pass along with the . | ||
| 175 | * | ||
| 176 | * @note If this function returns HOUSE_ARREST_E_SUCCESS it does not mean | ||
| 177 | * that the command was successful. To check for success or failure you | ||
| 178 | * need to call house_arrest_get_result(). | ||
| 179 | * @see house_arrest_get_result | ||
| 180 | * | ||
| 181 | * @return HOUSE_ARREST_E_SUCCESS if the command was successfully sent, | ||
| 182 | * HOUSE_ARREST_E_INVALID_ARG if client, command, or appid is invalid, | ||
| 183 | * HOUSE_ARREST_E_INVALID_MODE if the client is not in the correct mode, | ||
| 184 | * or HOUSE_ARREST_E_CONN_FAILED if a connection error occured. | ||
| 185 | */ | ||
| 186 | house_arrest_error_t house_arrest_send_command(house_arrest_client_t client, const char *command, const char *appid) | 112 | house_arrest_error_t house_arrest_send_command(house_arrest_client_t client, const char *command, const char *appid) |
| 187 | { | 113 | { |
| 188 | if (!client || !client->parent || !command || !appid) | 114 | if (!client || !client->parent || !command || !appid) |
| @@ -203,20 +129,6 @@ house_arrest_error_t house_arrest_send_command(house_arrest_client_t client, con | |||
| 203 | return res; | 129 | return res; |
| 204 | } | 130 | } |
| 205 | 131 | ||
| 206 | /** | ||
| 207 | * Retrieves the result of a previously sent house_arrest_request_* request. | ||
| 208 | * | ||
| 209 | * @param client The house_arrest client to use | ||
| 210 | * @param dict Pointer that will be set to a plist containing the result to | ||
| 211 | * the last performed operation. It holds a key 'Status' with the value | ||
| 212 | * 'Complete' on success or a key 'Error' with an error description as | ||
| 213 | * value. The caller is responsible for freeing the returned plist. | ||
| 214 | * | ||
| 215 | * @return HOUSE_ARREST_E_SUCCESS if a result plist was retrieved, | ||
| 216 | * HOUSE_ARREST_E_INVALID_ARG if client is invalid, | ||
| 217 | * HOUSE_ARREST_E_INVALID_MODE if the client is not in the correct mode, | ||
| 218 | * or HOUSE_ARREST_E_CONN_FAILED if a connection error occured. | ||
| 219 | */ | ||
| 220 | house_arrest_error_t house_arrest_get_result(house_arrest_client_t client, plist_t *dict) | 132 | house_arrest_error_t house_arrest_get_result(house_arrest_client_t client, plist_t *dict) |
| 221 | { | 133 | { |
| 222 | if (!client || !client->parent) | 134 | if (!client || !client->parent) |
| @@ -235,25 +147,6 @@ house_arrest_error_t house_arrest_get_result(house_arrest_client_t client, plist | |||
| 235 | return res; | 147 | return res; |
| 236 | } | 148 | } |
| 237 | 149 | ||
| 238 | /** | ||
| 239 | * Creates an AFC client using the given house_arrest client's connection | ||
| 240 | * allowing file access to a specific application directory requested by | ||
| 241 | * functions like house_arrest_request_vendor_documents(). | ||
| 242 | * | ||
| 243 | * @param client The house_arrest client to use. | ||
| 244 | * @param afc_client Pointer that will be set to a newly allocated afc_client_t | ||
| 245 | * upon successful return. | ||
| 246 | * | ||
| 247 | * @note After calling this function the house_arrest client will go in an | ||
| 248 | * AFC mode that will only allow calling house_arrest_client_free(). | ||
| 249 | * Only call house_arrest_client_free() if all AFC operations have | ||
| 250 | * completed since it will close the connection. | ||
| 251 | * | ||
| 252 | * @return AFC_E_SUCCESS if the afc client was successfully created, | ||
| 253 | * AFC_E_INVALID_ARG if client is invalid or was already used to create | ||
| 254 | * an afc client, or an AFC_E_* error code returned by | ||
| 255 | * afc_client_new_with_service_client(). | ||
| 256 | */ | ||
| 257 | afc_error_t afc_client_new_from_house_arrest_client(house_arrest_client_t client, afc_client_t *afc_client) | 150 | afc_error_t afc_client_new_from_house_arrest_client(house_arrest_client_t client, afc_client_t *afc_client) |
| 258 | { | 151 | { |
| 259 | if (!client || !client->parent || (client->mode == HOUSE_ARREST_CLIENT_MODE_AFC)) { | 152 | if (!client || !client->parent || (client->mode == HOUSE_ARREST_CLIENT_MODE_AFC)) { |
