diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/file_relay.c | 41 |
1 files changed, 39 insertions, 2 deletions
diff --git a/src/file_relay.c b/src/file_relay.c index eacaa11..3d064b9 100644 --- a/src/file_relay.c +++ b/src/file_relay.c | |||
| @@ -116,6 +116,7 @@ file_relay_error_t file_relay_client_free(file_relay_client_t client) | |||
| 116 | * data using idevice_connection_receive(). The connection will be closed | 116 | * data using idevice_connection_receive(). The connection will be closed |
| 117 | * automatically by the device, but use file_relay_client_free() to clean | 117 | * automatically by the device, but use file_relay_client_free() to clean |
| 118 | * up properly. | 118 | * up properly. |
| 119 | * @param timeout Maximum time in milliseconds to wait for data. | ||
| 119 | * | 120 | * |
| 120 | * @note WARNING: Don't call this function without reading the data afterwards. | 121 | * @note WARNING: Don't call this function without reading the data afterwards. |
| 121 | * A directory mobile_file_relay.XXXX used for creating the archive will | 122 | * A directory mobile_file_relay.XXXX used for creating the archive will |
| @@ -128,7 +129,7 @@ file_relay_error_t file_relay_client_free(file_relay_client_t client) | |||
| 128 | * sources are invalid, FILE_RELAY_E_STAGING_EMPTY if no data is available | 129 | * sources are invalid, FILE_RELAY_E_STAGING_EMPTY if no data is available |
| 129 | * for the given sources, or FILE_RELAY_E_UNKNOWN_ERROR otherwise. | 130 | * for the given sources, or FILE_RELAY_E_UNKNOWN_ERROR otherwise. |
| 130 | */ | 131 | */ |
| 131 | file_relay_error_t file_relay_request_sources(file_relay_client_t client, const char **sources, idevice_connection_t *connection) | 132 | file_relay_error_t file_relay_request_sources_timeout(file_relay_client_t client, const char **sources, idevice_connection_t *connection, unsigned int timeout) |
| 132 | { | 133 | { |
| 133 | if (!client || !client->parent || !sources || !sources[0]) { | 134 | if (!client || !client->parent || !sources || !sources[0]) { |
| 134 | return FILE_RELAY_E_INVALID_ARG; | 135 | return FILE_RELAY_E_INVALID_ARG; |
| @@ -153,7 +154,7 @@ file_relay_error_t file_relay_request_sources(file_relay_client_t client, const | |||
| 153 | plist_free(dict); | 154 | plist_free(dict); |
| 154 | 155 | ||
| 155 | dict = NULL; | 156 | dict = NULL; |
| 156 | if (property_list_service_receive_plist_with_timeout(client->parent, &dict, 60000) != PROPERTY_LIST_SERVICE_E_SUCCESS) { | 157 | if (property_list_service_receive_plist_with_timeout(client->parent, &dict, timeout) != PROPERTY_LIST_SERVICE_E_SUCCESS) { |
| 157 | debug_info("ERROR: Could not receive answer from device!"); | 158 | debug_info("ERROR: Could not receive answer from device!"); |
| 158 | err = FILE_RELAY_E_MUX_ERROR; | 159 | err = FILE_RELAY_E_MUX_ERROR; |
| 159 | goto leave; | 160 | goto leave; |
| @@ -216,3 +217,39 @@ leave: | |||
| 216 | } | 217 | } |
| 217 | return err; | 218 | return err; |
| 218 | } | 219 | } |
| 220 | |||
| 221 | /** | ||
| 222 | * Request data for the given sources. Calls file_relay_request_sources_timeout() with | ||
| 223 | * a timeout of 60000 milliseconds (60 seconds). | ||
| 224 | * | ||
| 225 | * @param client The connected file_relay client. | ||
| 226 | * @param sources A NULL-terminated list of sources to retrieve. | ||
| 227 | * Valid sources are: | ||
| 228 | * - AppleSupport | ||
| 229 | * - Network | ||
| 230 | * - VPN | ||
| 231 | * - WiFi | ||
| 232 | * - UserDatabases | ||
| 233 | * - CrashReporter | ||
| 234 | * - tmp | ||
| 235 | * - SystemConfiguration | ||
| 236 | * @param connection The connection that has to be used for receiving the | ||
| 237 | * data using idevice_connection_receive(). The connection will be closed | ||
| 238 | * automatically by the device, but use file_relay_client_free() to clean | ||
| 239 | * up properly. | ||
| 240 | * | ||
| 241 | * @note WARNING: Don't call this function without reading the data afterwards. | ||
| 242 | * A directory mobile_file_relay.XXXX used for creating the archive will | ||
| 243 | * remain in the /tmp directory otherwise. | ||
| 244 | * | ||
| 245 | * @return FILE_RELAY_E_SUCCESS on succes, FILE_RELAY_E_INVALID_ARG when one or | ||
| 246 | * more parameters are invalid, FILE_RELAY_E_MUX_ERROR if a communication | ||
| 247 | * error occurs, FILE_RELAY_E_PLIST_ERROR when the received result is NULL | ||
| 248 | * or is not a valid plist, FILE_RELAY_E_INVALID_SOURCE if one or more | ||
| 249 | * sources are invalid, FILE_RELAY_E_STAGING_EMPTY if no data is available | ||
| 250 | * for the given sources, or FILE_RELAY_E_UNKNOWN_ERROR otherwise. | ||
| 251 | */ | ||
| 252 | file_relay_error_t file_relay_request_sources(file_relay_client_t client, const char **sources, idevice_connection_t *connection) | ||
| 253 | { | ||
| 254 | return file_relay_request_sources_timeout(client, sources, connection, 60000); | ||
| 255 | } | ||
