diff options
Diffstat (limited to 'src/diagnostics_relay.c')
| -rw-r--r-- | src/diagnostics_relay.c | 86 |
1 files changed, 0 insertions, 86 deletions
diff --git a/src/diagnostics_relay.c b/src/diagnostics_relay.c index de3781c..cc9c645 100644 --- a/src/diagnostics_relay.c +++ b/src/diagnostics_relay.c | |||
| @@ -69,18 +69,6 @@ static int diagnostics_relay_check_result(plist_t dict) | |||
| 69 | return ret; | 69 | return ret; |
| 70 | } | 70 | } |
| 71 | 71 | ||
| 72 | /** | ||
| 73 | * Connects to the diagnostics_relay service on the specified device. | ||
| 74 | * | ||
| 75 | * @param device The device to connect to. | ||
| 76 | * @param service The service descriptor returned by lockdownd_start_service. | ||
| 77 | * @param client Reference that will point to a newly allocated | ||
| 78 | * diagnostics_relay_client_t upon successful return. | ||
| 79 | * | ||
| 80 | * @return DIAGNOSTICS_RELAY_E_SUCCESS on success, | ||
| 81 | * DIAGNOSTICS_RELAY_E_INVALID_ARG when one of the parameters is invalid, | ||
| 82 | * or DIAGNOSTICS_RELAY_E_MUX_ERROR when the connection failed. | ||
| 83 | */ | ||
| 84 | diagnostics_relay_error_t diagnostics_relay_client_new(idevice_t device, lockdownd_service_descriptor_t service, diagnostics_relay_client_t *client) | 72 | diagnostics_relay_error_t diagnostics_relay_client_new(idevice_t device, lockdownd_service_descriptor_t service, diagnostics_relay_client_t *client) |
| 85 | { | 73 | { |
| 86 | if (!device || !service || service->port == 0 || !client || *client) { | 74 | if (!device || !service || service->port == 0 || !client || *client) { |
| @@ -101,19 +89,6 @@ diagnostics_relay_error_t diagnostics_relay_client_new(idevice_t device, lockdow | |||
| 101 | return DIAGNOSTICS_RELAY_E_SUCCESS; | 89 | return DIAGNOSTICS_RELAY_E_SUCCESS; |
| 102 | } | 90 | } |
| 103 | 91 | ||
| 104 | /** | ||
| 105 | * Starts a new diagnostics_relay service on the specified device and connects to it. | ||
| 106 | * | ||
| 107 | * @param device The device to connect to. | ||
| 108 | * @param client Pointer that will point to a newly allocated | ||
| 109 | * diagnostics_relay_client_t upon successful return. Must be freed using | ||
| 110 | * diagnostics_relay_client_free() after use. | ||
| 111 | * @param label The label to use for communication. Usually the program name. | ||
| 112 | * Pass NULL to disable sending the label in requests to lockdownd. | ||
| 113 | * | ||
| 114 | * @return DIAGNOSTICS_RELAY_E_SUCCESS on success, or an DIAGNOSTICS_RELAY_E_* error | ||
| 115 | * code otherwise. | ||
| 116 | */ | ||
| 117 | diagnostics_relay_error_t diagnostics_relay_client_start_service(idevice_t device, diagnostics_relay_client_t * client, const char* label) | 92 | diagnostics_relay_error_t diagnostics_relay_client_start_service(idevice_t device, diagnostics_relay_client_t * client, const char* label) |
| 118 | { | 93 | { |
| 119 | diagnostics_relay_error_t err = DIAGNOSTICS_RELAY_E_UNKNOWN_ERROR; | 94 | diagnostics_relay_error_t err = DIAGNOSTICS_RELAY_E_UNKNOWN_ERROR; |
| @@ -121,17 +96,6 @@ diagnostics_relay_error_t diagnostics_relay_client_start_service(idevice_t devic | |||
| 121 | return err; | 96 | return err; |
| 122 | } | 97 | } |
| 123 | 98 | ||
| 124 | /** | ||
| 125 | * Disconnects a diagnostics_relay client from the device and frees up the | ||
| 126 | * diagnostics_relay client data. | ||
| 127 | * | ||
| 128 | * @param client The diagnostics_relay client to disconnect and free. | ||
| 129 | * | ||
| 130 | * @return DIAGNOSTICS_RELAY_E_SUCCESS on success, | ||
| 131 | * DIAGNOSTICS_RELAY_E_INVALID_ARG when one of client or client->parent | ||
| 132 | * is invalid, or DIAGNOSTICS_RELAY_E_UNKNOWN_ERROR when the was an | ||
| 133 | * error freeing the parent property_list_service client. | ||
| 134 | */ | ||
| 135 | diagnostics_relay_error_t diagnostics_relay_client_free(diagnostics_relay_client_t client) | 99 | diagnostics_relay_error_t diagnostics_relay_client_free(diagnostics_relay_client_t client) |
| 136 | { | 100 | { |
| 137 | if (!client) | 101 | if (!client) |
| @@ -198,16 +162,6 @@ static diagnostics_relay_error_t diagnostics_relay_send(diagnostics_relay_client | |||
| 198 | return ret; | 162 | return ret; |
| 199 | } | 163 | } |
| 200 | 164 | ||
| 201 | /** | ||
| 202 | * Sends the Goodbye request signaling the end of communication. | ||
| 203 | * | ||
| 204 | * @param client The diagnostics_relay client | ||
| 205 | * | ||
| 206 | * @return DIAGNOSTICS_RELAY_E_SUCCESS on success, | ||
| 207 | * DIAGNOSTICS_RELAY_E_INVALID_ARG when client is NULL, | ||
| 208 | * DIAGNOSTICS_RELAY_E_PLIST_ERROR if the device did not acknowledge the | ||
| 209 | * request | ||
| 210 | */ | ||
| 211 | diagnostics_relay_error_t diagnostics_relay_goodbye(diagnostics_relay_client_t client) | 165 | diagnostics_relay_error_t diagnostics_relay_goodbye(diagnostics_relay_client_t client) |
| 212 | { | 166 | { |
| 213 | if (!client) | 167 | if (!client) |
| @@ -242,16 +196,6 @@ diagnostics_relay_error_t diagnostics_relay_goodbye(diagnostics_relay_client_t c | |||
| 242 | return ret; | 196 | return ret; |
| 243 | } | 197 | } |
| 244 | 198 | ||
| 245 | /** | ||
| 246 | * Puts the device into deep sleep mode and disconnects from host. | ||
| 247 | * | ||
| 248 | * @param client The diagnostics_relay client | ||
| 249 | * | ||
| 250 | * @return DIAGNOSTICS_RELAY_E_SUCCESS on success, | ||
| 251 | * DIAGNOSTICS_RELAY_E_INVALID_ARG when client is NULL, | ||
| 252 | * DIAGNOSTICS_RELAY_E_PLIST_ERROR if the device did not acknowledge the | ||
| 253 | * request | ||
| 254 | */ | ||
| 255 | diagnostics_relay_error_t diagnostics_relay_sleep(diagnostics_relay_client_t client) | 199 | diagnostics_relay_error_t diagnostics_relay_sleep(diagnostics_relay_client_t client) |
| 256 | { | 200 | { |
| 257 | if (!client) | 201 | if (!client) |
| @@ -328,41 +272,11 @@ static diagnostics_relay_error_t internal_diagnostics_relay_action(diagnostics_r | |||
| 328 | return ret; | 272 | return ret; |
| 329 | } | 273 | } |
| 330 | 274 | ||
| 331 | /** | ||
| 332 | * Restart the device and optionally show a user notification. | ||
| 333 | * | ||
| 334 | * @param client The diagnostics_relay client | ||
| 335 | * @param flags A binary flag combination of | ||
| 336 | * DIAGNOSTICS_RELAY_ACTION_FLAG_WAIT_FOR_DISCONNECT to wait until | ||
| 337 | * diagnostics_relay_client_free() disconnects before execution and | ||
| 338 | * DIAGNOSTICS_RELAY_ACTION_FLAG_DISPLAY_FAIL to show a "FAIL" dialog | ||
| 339 | * or DIAGNOSTICS_RELAY_ACTION_FLAG_DISPLAY_PASS to show an "OK" dialog | ||
| 340 | * | ||
| 341 | * @return DIAGNOSTICS_RELAY_E_SUCCESS on success, | ||
| 342 | * DIAGNOSTICS_RELAY_E_INVALID_ARG when client is NULL, | ||
| 343 | * DIAGNOSTICS_RELAY_E_PLIST_ERROR if the device did not acknowledge the | ||
| 344 | * request | ||
| 345 | */ | ||
| 346 | diagnostics_relay_error_t diagnostics_relay_restart(diagnostics_relay_client_t client, int flags) | 275 | diagnostics_relay_error_t diagnostics_relay_restart(diagnostics_relay_client_t client, int flags) |
| 347 | { | 276 | { |
| 348 | return internal_diagnostics_relay_action(client, "Restart", flags); | 277 | return internal_diagnostics_relay_action(client, "Restart", flags); |
| 349 | } | 278 | } |
| 350 | 279 | ||
| 351 | /** | ||
| 352 | * Shutdown of the device and optionally show a user notification. | ||
| 353 | * | ||
| 354 | * @param client The diagnostics_relay client | ||
| 355 | * @param flags A binary flag combination of | ||
| 356 | * DIAGNOSTICS_RELAY_ACTION_FLAG_WAIT_FOR_DISCONNECT to wait until | ||
| 357 | * diagnostics_relay_client_free() disconnects before execution and | ||
| 358 | * DIAGNOSTICS_RELAY_ACTION_FLAG_DISPLAY_FAIL to show a "FAIL" dialog | ||
| 359 | * or DIAGNOSTICS_RELAY_ACTION_FLAG_DISPLAY_PASS to show an "OK" dialog | ||
| 360 | * | ||
| 361 | * @return DIAGNOSTICS_RELAY_E_SUCCESS on success, | ||
| 362 | * DIAGNOSTICS_RELAY_E_INVALID_ARG when client is NULL, | ||
| 363 | * DIAGNOSTICS_RELAY_E_PLIST_ERROR if the device did not acknowledge the | ||
| 364 | * request | ||
| 365 | */ | ||
| 366 | diagnostics_relay_error_t diagnostics_relay_shutdown(diagnostics_relay_client_t client, int flags) | 280 | diagnostics_relay_error_t diagnostics_relay_shutdown(diagnostics_relay_client_t client, int flags) |
| 367 | { | 281 | { |
| 368 | return internal_diagnostics_relay_action(client, "Shutdown", flags); | 282 | return internal_diagnostics_relay_action(client, "Shutdown", flags); |
