lockdown.h File Reference

## Description

Manage device preferences, start services, pairing and activation.

## Structs

struct | lockdownd_pair_record_t
| pair record holding device, host and root certificates along the host_id More...
struct | lockdownd_service_descriptor_t
| service descriptor More...

## Typedefs

typedef lockdownd_client_private * | lockdownd_client_t
| The client handle.
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)
| Callback used to supply the pairing PIN during a CU pairing session, and to report device information and pairing error messages.

## Enumerations

enum

lockdownd_error_t {
LOCKDOWN_E_SUCCESS = 0 ,
LOCKDOWN_E_INVALID_ARG = -1 ,
LOCKDOWN_E_INVALID_CONF = -2 ,
LOCKDOWN_E_PLIST_ERROR = -3 ,
LOCKDOWN_E_PAIRING_FAILED = -4 ,
LOCKDOWN_E_SSL_ERROR = -5 ,
LOCKDOWN_E_DICT_ERROR = -6 ,
LOCKDOWN_E_RECEIVE_TIMEOUT = -7 ,
LOCKDOWN_E_MUX_ERROR = -8 ,
LOCKDOWN_E_NO_RUNNING_SESSION = -9 ,
LOCKDOWN_E_INVALID_RESPONSE = -10 ,
LOCKDOWN_E_MISSING_KEY = -11 ,
LOCKDOWN_E_MISSING_VALUE = -12 ,
LOCKDOWN_E_GET_PROHIBITED = -13 ,
LOCKDOWN_E_SET_PROHIBITED = -14 ,
LOCKDOWN_E_REMOVE_PROHIBITED = -15 ,
LOCKDOWN_E_IMMUTABLE_VALUE = -16 ,
LOCKDOWN_E_PASSWORD_PROTECTED = -17 ,
LOCKDOWN_E_USER_DENIED_PAIRING = -18 ,
LOCKDOWN_E_PAIRING_DIALOG_RESPONSE_PENDING = -19 ,
LOCKDOWN_E_MISSING_HOST_ID = -20 ,
LOCKDOWN_E_INVALID_HOST_ID = -21 ,
LOCKDOWN_E_SESSION_ACTIVE = -22 ,
LOCKDOWN_E_SESSION_INACTIVE = -23 ,
LOCKDOWN_E_MISSING_SESSION_ID = -24 ,
LOCKDOWN_E_INVALID_SESSION_ID = -25 ,
LOCKDOWN_E_MISSING_SERVICE = -26 ,
LOCKDOWN_E_INVALID_SERVICE = -27 ,
LOCKDOWN_E_SERVICE_LIMIT = -28 ,
LOCKDOWN_E_MISSING_PAIR_RECORD = -29 ,
LOCKDOWN_E_SAVE_PAIR_RECORD_FAILED = -30 ,
LOCKDOWN_E_INVALID_PAIR_RECORD = -31 ,
LOCKDOWN_E_INVALID_ACTIVATION_RECORD = -32 ,
LOCKDOWN_E_MISSING_ACTIVATION_RECORD = -33 ,
LOCKDOWN_E_SERVICE_PROHIBITED = -34 ,
LOCKDOWN_E_ESCROW_LOCKED = -35 ,
LOCKDOWN_E_PAIRING_PROHIBITED_OVER_THIS_CONNECTION = -36 ,
LOCKDOWN_E_FMIP_PROTECTED = -37 ,
LOCKDOWN_E_MC_PROTECTED = -38 ,
LOCKDOWN_E_MC_CHALLENGE_REQUIRED = -39 ,
LOCKDOWN_E_UNKNOWN_ERROR = -256
}

| Error Codes.
enum | lockdownd_cu_pairing_cb_type_t { LOCKDOWN_CU_PAIRING_PIN_REQUESTED , LOCKDOWN_CU_PAIRING_DEVICE_INFO , LOCKDOWN_CU_PAIRING_ERROR }
| Callback types used in lockdownd_cu_pairing_cb_t. More...

## Functions

LIBIMOBILEDEVICE_API lockdownd_error_t | lockdownd_client_new (idevice_t device, lockdownd_client_t *client, const char *label)
| Creates a new lockdownd client for the device.
LIBIMOBILEDEVICE_API lockdownd_error_t | lockdownd_client_new_with_handshake (idevice_t device, lockdownd_client_t *client, const char *label)
| Creates a new lockdownd client for the device and starts initial handshake.
LIBIMOBILEDEVICE_API lockdownd_error_t | lockdownd_client_free (lockdownd_client_t client)
| Closes the lockdownd client session if one is running and frees up the lockdownd_client struct.
LIBIMOBILEDEVICE_API lockdownd_error_t | lockdownd_query_type (lockdownd_client_t client, char **type)
| Query the type of the service daemon.
LIBIMOBILEDEVICE_API lockdownd_error_t | lockdownd_get_value (lockdownd_client_t client, const char *domain, const char *key, plist_t *value)
| Retrieves a preferences plist using an optional domain and/or key name.
LIBIMOBILEDEVICE_API lockdownd_error_t | lockdownd_set_value (lockdownd_client_t client, const char *domain, const char *key, plist_t value)
| Sets a preferences value using a plist and optional by domain and/or key name.
LIBIMOBILEDEVICE_API lockdownd_error_t | lockdownd_remove_value (lockdownd_client_t client, const char *domain, const char *key)
| Removes a preference node by domain and/or key name.
LIBIMOBILEDEVICE_API lockdownd_error_t | lockdownd_start_service (lockdownd_client_t client, const char *identifier, lockdownd_service_descriptor_t *service)
| Requests to start a service and retrieve it's port on success.
LIBIMOBILEDEVICE_API lockdownd_error_t | lockdownd_start_service_with_escrow_bag (lockdownd_client_t client, const char *identifier, lockdownd_service_descriptor_t *service)
| Requests to start a service and retrieve it's port on success.
LIBIMOBILEDEVICE_API lockdownd_error_t | lockdownd_start_session (lockdownd_client_t client, const char *host_id, char **session_id, int *ssl_enabled)
| Opens a session with lockdownd and switches to SSL mode if device wants it.
LIBIMOBILEDEVICE_API lockdownd_error_t | lockdownd_stop_session (lockdownd_client_t client, const char *session_id)
| Closes the lockdownd session by sending the StopSession request.
LIBIMOBILEDEVICE_API lockdownd_error_t | lockdownd_send (lockdownd_client_t client, plist_t plist)
| Sends a plist to lockdownd.
LIBIMOBILEDEVICE_API lockdownd_error_t | lockdownd_receive (lockdownd_client_t client, plist_t *plist)
| Receives a plist from lockdownd.
LIBIMOBILEDEVICE_API lockdownd_error_t | lockdownd_pair (lockdownd_client_t client, lockdownd_pair_record_t pair_record)
| Pairs the device using the supplied pair record.
LIBIMOBILEDEVICE_API lockdownd_error_t | lockdownd_pair_with_options (lockdownd_client_t client, lockdownd_pair_record_t pair_record, plist_t options, plist_t *response)
| Pairs the device using the supplied pair record and passing the given options.
LIBIMOBILEDEVICE_API lockdownd_error_t | lockdownd_validate_pair (lockdownd_client_t client, lockdownd_pair_record_t pair_record)
| Validates if the device is paired with the given HostID.
LIBIMOBILEDEVICE_API lockdownd_error_t | lockdownd_unpair (lockdownd_client_t client, lockdownd_pair_record_t pair_record)
| Unpairs the device with the given HostID and removes the pairing records from the device and host if the internal pairing record management is used.
LIBIMOBILEDEVICE_API lockdownd_error_t | lockdownd_activate (lockdownd_client_t client, plist_t activation_record)
| Activates the device.
LIBIMOBILEDEVICE_API lockdownd_error_t | lockdownd_deactivate (lockdownd_client_t client)
| Deactivates the device, returning it to the locked “Activate with iTunes” screen.
LIBIMOBILEDEVICE_API lockdownd_error_t | lockdownd_enter_recovery (lockdownd_client_t client)
| Tells the device to immediately enter recovery mode.
LIBIMOBILEDEVICE_API lockdownd_error_t | lockdownd_goodbye (lockdownd_client_t client)
| Sends the Goodbye request to lockdownd signaling the end of communication.
LIBIMOBILEDEVICE_API 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)
| Creates a CU pairing session for the current lockdown client.
LIBIMOBILEDEVICE_API lockdownd_error_t | lockdownd_cu_send_request_and_get_reply (lockdownd_client_t client, const char *request, plist_t request_payload, plist_t *reply)
| Sends a request via lockdown client with established CU pairing session and attempts to retrieve a reply.
LIBIMOBILEDEVICE_API lockdownd_error_t | lockdownd_get_value_cu (lockdownd_client_t client, const char *domain, const char *key, plist_t *value)
| Retrieves a value using an optional domain and/or key name from a lockdown client with established CU pairing session.
LIBIMOBILEDEVICE_API lockdownd_error_t | lockdownd_pair_cu (lockdownd_client_t client)
| Perform a device pairing with a lockdown client that has an established CU pairing session.
LIBIMOBILEDEVICE_API void | lockdownd_client_set_label (lockdownd_client_t client, const char *label)
| Sets the label to send for requests to lockdownd.
LIBIMOBILEDEVICE_API lockdownd_error_t | lockdownd_get_device_udid (lockdownd_client_t client, char **udid)
| Returns the unique id of the device from lockdownd.
LIBIMOBILEDEVICE_API lockdownd_error_t | lockdownd_get_device_name (lockdownd_client_t client, char **device_name)
| Retrieves the name of the device from lockdownd set by the user.
LIBIMOBILEDEVICE_API lockdownd_error_t | lockdownd_get_sync_data_classes (lockdownd_client_t client, char ***classes, int *count)
| Calculates and returns the data classes the device supports from lockdownd.
LIBIMOBILEDEVICE_API lockdownd_error_t | lockdownd_data_classes_free (char **classes)
| Frees memory of an allocated array of data classes as returned by lockdownd_get_sync_data_classes().
LIBIMOBILEDEVICE_API lockdownd_error_t | lockdownd_service_descriptor_free (lockdownd_service_descriptor_t service)
| Frees memory of a service descriptor as returned by lockdownd_start_service().
LIBIMOBILEDEVICE_API const char * | lockdownd_strerror (lockdownd_error_t err)
| Gets a readable error string for a given lockdown error code.