diff options
Diffstat (limited to 'include/libimobiledevice/lockdown.h')
-rw-r--r-- | include/libimobiledevice/lockdown.h | 96 |
1 files changed, 96 insertions, 0 deletions
diff --git a/include/libimobiledevice/lockdown.h b/include/libimobiledevice/lockdown.h index c35e5e9..1569f44 100644 --- a/include/libimobiledevice/lockdown.h +++ b/include/libimobiledevice/lockdown.h | |||
@@ -100,6 +100,19 @@ struct lockdownd_service_descriptor { | |||
100 | }; | 100 | }; |
101 | typedef struct lockdownd_service_descriptor *lockdownd_service_descriptor_t; | 101 | typedef struct lockdownd_service_descriptor *lockdownd_service_descriptor_t; |
102 | 102 | ||
103 | |||
104 | typedef enum { | ||
105 | LOCKDOWN_CU_PAIRING_PIN_REQUESTED, /**< PIN requested: data_ptr is a char* buffer, and data_size points to the size of this buffer that must not be exceeded and has to be updated to the actual number of characters filled into the buffer. */ | ||
106 | LOCKDOWN_CU_PAIRING_DEVICE_INFO, /**< device information available: data_ptr is a plist_t, and data_size is ignored. The plist_t has to be copied if required, since it is freed when the callback function returns. */ | ||
107 | LOCKDOWN_CU_PAIRING_ERROR /**< pairing error message available: data_ptr is a NULL-terminated char* buffer containing the error message, and data_size is ignored. Buffer needs to be copied if it shall persist outside the callback. */ | ||
108 | } lockdownd_cu_pairing_cb_type_t; | ||
109 | |||
110 | /* CU pairing callback function prototype */ | ||
111 | /** Callback used to supply the pairing PIN during a CU pairing session, | ||
112 | * and to report device information and pairing error messages. */ | ||
113 | typedef void (*lockdownd_cu_pairing_cb_t) (lockdownd_cu_pairing_cb_type_t cb_type, void *user_data, void* data_ptr, unsigned int* data_size); | ||
114 | |||
115 | |||
103 | /* Interface */ | 116 | /* Interface */ |
104 | 117 | ||
105 | /** | 118 | /** |
@@ -399,6 +412,89 @@ lockdownd_error_t lockdownd_enter_recovery(lockdownd_client_t client); | |||
399 | */ | 412 | */ |
400 | lockdownd_error_t lockdownd_goodbye(lockdownd_client_t client); | 413 | lockdownd_error_t lockdownd_goodbye(lockdownd_client_t client); |
401 | 414 | ||
415 | /** | ||
416 | * Creates a CU pairing session for the current lockdown client. | ||
417 | * This is required to allow lockdownd_cu_send_request_and_get_reply(), | ||
418 | * lockdownd_get_value_cu() and lockdonwd_pair_cu() requests, and eventually | ||
419 | * allows to perform an actual wireless pairing. | ||
420 | * | ||
421 | * Through the callback function, the PIN displayed on the device has to be | ||
422 | * supplied during the process. Currently, only AppleTV devices have this | ||
423 | * capability. | ||
424 | * | ||
425 | * @param client The lockdown client to perform the CU pairing for | ||
426 | * @param pairing_callback Callback function that is used to supply the PIN | ||
427 | * for the pairing process, but also to receive device information or | ||
428 | * pairing error messages. | ||
429 | * @param cb_user_data User data that will be passed as additional argument | ||
430 | * to the callback function. | ||
431 | * @param host_info (Optional) A dictionary containing host information to | ||
432 | * send to the device when finalizing the CU pairing. The supplied | ||
433 | * values will override the default values gathered for the current host. | ||
434 | * @param acl (Optional) A dictionary containing ACL information. Currently | ||
435 | * only com.apple.ScreenCapture:true and com.apple.developer:true are known | ||
436 | * valid ACL values, which are used as default when NULL is passed. | ||
437 | * | ||
438 | * @return LOCKDOWN_E_SUCCESS on success, LOCKDOWN_E_INVALID_ARG if one of the | ||
439 | * parameters is invalid, LOCKDOWN_E_PAIRING_FAILED if the pairing failed, | ||
440 | * or a LOCKDOWN_E_* error code otherwise. | ||
441 | */ | ||
442 | lockdownd_error_t lockdownd_cu_pairing_create(lockdownd_client_t client, lockdownd_cu_pairing_cb_t pairing_callback, void* cb_user_data, plist_t host_info, plist_t acl); | ||
443 | |||
444 | /** | ||
445 | * Sends a request via lockdown client with established CU pairing session | ||
446 | * and attempts to retrieve a reply. This function is used internally | ||
447 | * by lockdownd_get_value_cu() and lockdownd_pair_cu(), but exposed here to | ||
448 | * allow custom requests being sent and their replies being received. | ||
449 | * | ||
450 | * @param client A lockdown client with an established CU pairing. | ||
451 | * @param request The request to perform. | ||
452 | * @param request_payload The payload for the request. | ||
453 | * @param reply (Optional) If not NULL, the plist_t will be set to the reply | ||
454 | * dictionary that has been received. Consumer is responsible to free it | ||
455 | * using plist_free() when no longer required. | ||
456 | * | ||
457 | * @return LOCKDOWN_E_SUCCESS on success, LOCKDOWN_E_INVALID_ARG if one of the | ||
458 | * parameters is invalid, LOCKDOWN_E_NO_RUNNING_SESSION if the current | ||
459 | * lockdown client does not have an established CU pairing session, | ||
460 | * or a LOCKDOWN_E_* error code otherwise. | ||
461 | */ | ||
462 | lockdownd_error_t lockdownd_cu_send_request_and_get_reply(lockdownd_client_t client, const char* request, plist_t request_payload, plist_t* reply); | ||
463 | |||
464 | /** | ||
465 | * Retrieves a value using an optional domain and/or key name from a lockdown | ||
466 | * client with established CU pairing session. | ||
467 | * | ||
468 | * This is used to retrieve values that are only accessible after a CU pairing | ||
469 | * has been established, and would otherwise only be accessible with a valid | ||
470 | * device pairing. | ||
471 | * | ||
472 | * @param client A lockdown client with an established CU pairing. | ||
473 | * @param domain The domain to query on or NULL for global domain | ||
474 | * @param key The key name to request or NULL to query for all keys | ||
475 | * @param value A plist node representing the result value node | ||
476 | * | ||
477 | * @return LOCKDOWN_E_SUCCESS on success, LOCKDOWN_E_INVALID_ARG if one of the | ||
478 | * parameters is invalid, LOCKDOWN_E_NO_RUNNING_SESSION if the current | ||
479 | * lockdown client does not have an established CU pairing session, | ||
480 | * or a LOCKDOWN_E_* error code otherwise. | ||
481 | */ | ||
482 | lockdownd_error_t lockdownd_get_value_cu(lockdownd_client_t client, const char* domain, const char* key, plist_t* value); | ||
483 | |||
484 | /** | ||
485 | * Perform a device pairing with a lockdown client that has an established | ||
486 | * CU pairing session. | ||
487 | * | ||
488 | * @param client A lockdown client with an established CU pairing. | ||
489 | * | ||
490 | * @return LOCKDOWN_E_SUCCESS on success, LOCKDOWN_E_INVALID_ARG when client | ||
491 | * is NULL, LOCKDOWN_E_NO_RUNNING_SESSION if the current lockdown client | ||
492 | * does not have an established CU pairing session, or a LOCKDOWN_E_* error | ||
493 | * code otherwise. | ||
494 | */ | ||
495 | lockdownd_error_t lockdownd_pair_cu(lockdownd_client_t client); | ||
496 | |||
497 | |||
402 | /* Helper */ | 498 | /* Helper */ |
403 | 499 | ||
404 | /** | 500 | /** |