@mcesystems/apple-kit 1.0.24 → 1.0.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (114) hide show
  1. package/README.md +284 -250
  2. package/dist/index.js +156 -22
  3. package/dist/index.js.map +3 -3
  4. package/dist/index.mjs +156 -24
  5. package/dist/index.mjs.map +3 -3
  6. package/dist/resources/bin/darwin/idevice_id +0 -0
  7. package/dist/resources/bin/darwin/idevicedebug +0 -0
  8. package/dist/resources/bin/darwin/idevicediagnostics +0 -0
  9. package/dist/resources/bin/darwin/ideviceinfo +0 -0
  10. package/dist/resources/bin/darwin/ideviceinstaller +0 -0
  11. package/dist/resources/bin/darwin/idevicename +0 -0
  12. package/dist/resources/bin/darwin/idevicepair +0 -0
  13. package/dist/resources/bin/darwin/idevicescreenshot +0 -0
  14. package/dist/resources/bin/darwin/idevicesyslog +0 -0
  15. package/dist/resources/bin/darwin/iproxy +0 -0
  16. package/dist/resources/bin/darwin/libcrypto.3.dylib +0 -0
  17. package/dist/resources/bin/darwin/libimobiledevice-1.0.6.dylib +0 -0
  18. package/dist/resources/bin/darwin/libimobiledevice-glue-1.0.0.dylib +0 -0
  19. package/dist/resources/bin/darwin/liblzma.5.dylib +0 -0
  20. package/dist/resources/bin/darwin/libplist-2.0.4.dylib +0 -0
  21. package/dist/resources/bin/darwin/libssl.3.dylib +0 -0
  22. package/dist/resources/bin/darwin/libusbmuxd-2.0.7.dylib +0 -0
  23. package/dist/resources/bin/darwin/libzip.5.dylib +0 -0
  24. package/dist/resources/bin/darwin/libzstd.1.dylib +0 -0
  25. package/{resources → dist/resources}/licenses/LGPL-2.1.txt +33 -33
  26. package/dist/types/logic/actions/device.d.ts.map +1 -1
  27. package/dist/types/logic/actions/proxy.d.ts.map +1 -1
  28. package/dist/types/logic/appleDeviceKit.d.ts +1 -1
  29. package/dist/types/logic/appleDeviceKit.d.ts.map +1 -1
  30. package/package.json +7 -4
  31. package/scripts/README.md +209 -0
  32. package/scripts/build-windows.sh.template +134 -0
  33. package/scripts/export-resources.ts +444 -0
  34. package/dist/types/utils/portManager.d.ts +0 -68
  35. package/dist/types/utils/portManager.d.ts.map +0 -1
  36. package/resources/bin/windows/bz2.dll +0 -0
  37. package/resources/bin/windows/getopt.dll +0 -0
  38. package/resources/bin/windows/iconv-2.dll +0 -0
  39. package/resources/bin/windows/idevice_id.exe +0 -0
  40. package/resources/bin/windows/ideviceactivation.exe +0 -0
  41. package/resources/bin/windows/idevicedebug.exe +0 -0
  42. package/resources/bin/windows/ideviceinfo.exe +0 -0
  43. package/resources/bin/windows/ideviceinstaller.exe +0 -0
  44. package/resources/bin/windows/idevicepair.exe +0 -0
  45. package/resources/bin/windows/imobiledevice.dll +0 -0
  46. package/resources/bin/windows/iproxy.exe +0 -0
  47. package/resources/bin/windows/libcrypto-1_1-x64.dll +0 -0
  48. package/resources/bin/windows/libcurl.dll +0 -0
  49. package/resources/bin/windows/libideviceactivation-1.0.dll +0 -0
  50. package/resources/bin/windows/libimobiledevice-1.0.dll +0 -0
  51. package/resources/bin/windows/libimobiledevice-glue-1.0.dll +0 -0
  52. package/resources/bin/windows/libplist-2.0.dll +0 -0
  53. package/resources/bin/windows/libssl-1_1-x64.dll +0 -0
  54. package/resources/bin/windows/libusb-1.0.dll +0 -0
  55. package/resources/bin/windows/libusb0.dll +0 -0
  56. package/resources/bin/windows/libusbmuxd-2.0.dll +0 -0
  57. package/resources/bin/windows/libxml2.dll +0 -0
  58. package/resources/bin/windows/lzma.dll +0 -0
  59. package/resources/bin/windows/pcre.dll +0 -0
  60. package/resources/bin/windows/pcreposix.dll +0 -0
  61. package/resources/bin/windows/plist.dll +0 -0
  62. package/resources/bin/windows/pthreadVC3.dll +0 -0
  63. package/resources/bin/windows/readline.dll +0 -0
  64. package/resources/bin/windows/usbmuxd.dll +0 -0
  65. package/resources/bin/windows/usbmuxd.exe +0 -0
  66. package/resources/bin/windows/vcruntime140.dll +0 -0
  67. package/resources/bin/windows/zip.dll +0 -0
  68. package/resources/bin/windows/zlib1.dll +0 -0
  69. package/resources/lib/include/libimobiledevice/afc.h +0 -413
  70. package/resources/lib/include/libimobiledevice/bt_packet_logger.h +0 -156
  71. package/resources/lib/include/libimobiledevice/companion_proxy.h +0 -212
  72. package/resources/lib/include/libimobiledevice/debugserver.h +0 -272
  73. package/resources/lib/include/libimobiledevice/diagnostics_relay.h +0 -228
  74. package/resources/lib/include/libimobiledevice/file_relay.h +0 -166
  75. package/resources/lib/include/libimobiledevice/heartbeat.h +0 -137
  76. package/resources/lib/include/libimobiledevice/house_arrest.h +0 -180
  77. package/resources/lib/include/libimobiledevice/installation_proxy.h +0 -505
  78. package/resources/lib/include/libimobiledevice/libimobiledevice.h +0 -444
  79. package/resources/lib/include/libimobiledevice/lockdown.h +0 -577
  80. package/resources/lib/include/libimobiledevice/misagent.h +0 -168
  81. package/resources/lib/include/libimobiledevice/mobile_image_mounter.h +0 -275
  82. package/resources/lib/include/libimobiledevice/mobileactivation.h +0 -192
  83. package/resources/lib/include/libimobiledevice/mobilebackup.h +0 -246
  84. package/resources/lib/include/libimobiledevice/mobilebackup2.h +0 -214
  85. package/resources/lib/include/libimobiledevice/mobilesync.h +0 -359
  86. package/resources/lib/include/libimobiledevice/notification_proxy.h +0 -202
  87. package/resources/lib/include/libimobiledevice/ostrace.h +0 -198
  88. package/resources/lib/include/libimobiledevice/preboard.h +0 -187
  89. package/resources/lib/include/libimobiledevice/property_list_service.h +0 -184
  90. package/resources/lib/include/libimobiledevice/restore.h +0 -179
  91. package/resources/lib/include/libimobiledevice/reverse_proxy.h +0 -213
  92. package/resources/lib/include/libimobiledevice/sbservices.h +0 -175
  93. package/resources/lib/include/libimobiledevice/screenshotr.h +0 -118
  94. package/resources/lib/include/libimobiledevice/service.h +0 -202
  95. package/resources/lib/include/libimobiledevice/syslog_relay.h +0 -184
  96. package/resources/lib/include/libimobiledevice/webinspector.h +0 -137
  97. package/resources/lib/include/plist/Array.h +0 -80
  98. package/resources/lib/include/plist/Boolean.h +0 -48
  99. package/resources/lib/include/plist/Data.h +0 -50
  100. package/resources/lib/include/plist/Date.h +0 -54
  101. package/resources/lib/include/plist/Dictionary.h +0 -73
  102. package/resources/lib/include/plist/Integer.h +0 -54
  103. package/resources/lib/include/plist/Key.h +0 -49
  104. package/resources/lib/include/plist/Node.h +0 -57
  105. package/resources/lib/include/plist/Real.h +0 -48
  106. package/resources/lib/include/plist/String.h +0 -52
  107. package/resources/lib/include/plist/Structure.h +0 -62
  108. package/resources/lib/include/plist/Uid.h +0 -48
  109. package/resources/lib/include/plist/plist++.h +0 -39
  110. package/resources/lib/include/plist/plist.h +0 -1448
  111. package/resources/lib/libimobiledevice-1.0.dll +0 -0
  112. package/resources/lib/libimobiledevice-1.0.dll.a +0 -0
  113. package/resources/lib/libplist-2.0.dll +0 -0
  114. package/resources/lib/libplist-2.0.dll.a +0 -0
@@ -1,577 +0,0 @@
1
- /**
2
- * @file libimobiledevice/lockdown.h
3
- * @brief Manage device preferences, start services, pairing and activation.
4
- * \internal
5
- *
6
- * Copyright (c) 2009-2014 Martin S. All Rights Reserved.
7
- * Copyright (c) 2014 Koby Boyango All Rights Reserved.
8
- * Copyright (c) 2010 Bryan Forbes All Rights Reserved.
9
- * Copyright (c) 2008 Zach C. All Rights Reserved.
10
- *
11
- * This library is free software; you can redistribute it and/or
12
- * modify it under the terms of the GNU Lesser General Public
13
- * License as published by the Free Software Foundation; either
14
- * version 2.1 of the License, or (at your option) any later version.
15
- *
16
- * This library is distributed in the hope that it will be useful,
17
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
18
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19
- * Lesser General Public License for more details.
20
- *
21
- * You should have received a copy of the GNU Lesser General Public
22
- * License along with this library; if not, write to the Free Software
23
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
24
- */
25
-
26
- #ifndef ILOCKDOWN_H
27
- #define ILOCKDOWN_H
28
-
29
- #ifdef __cplusplus
30
- extern "C" {
31
- #endif
32
-
33
- #include <libimobiledevice/libimobiledevice.h>
34
-
35
- /** Error Codes */
36
- typedef enum {
37
- /* custom */
38
- LOCKDOWN_E_SUCCESS = 0,
39
- LOCKDOWN_E_INVALID_ARG = -1,
40
- LOCKDOWN_E_INVALID_CONF = -2,
41
- LOCKDOWN_E_PLIST_ERROR = -3,
42
- LOCKDOWN_E_PAIRING_FAILED = -4,
43
- LOCKDOWN_E_SSL_ERROR = -5,
44
- LOCKDOWN_E_DICT_ERROR = -6,
45
- LOCKDOWN_E_RECEIVE_TIMEOUT = -7,
46
- LOCKDOWN_E_MUX_ERROR = -8,
47
- LOCKDOWN_E_NO_RUNNING_SESSION = -9,
48
- /* native */
49
- LOCKDOWN_E_INVALID_RESPONSE = -10,
50
- LOCKDOWN_E_MISSING_KEY = -11,
51
- LOCKDOWN_E_MISSING_VALUE = -12,
52
- LOCKDOWN_E_GET_PROHIBITED = -13,
53
- LOCKDOWN_E_SET_PROHIBITED = -14,
54
- LOCKDOWN_E_REMOVE_PROHIBITED = -15,
55
- LOCKDOWN_E_IMMUTABLE_VALUE = -16,
56
- LOCKDOWN_E_PASSWORD_PROTECTED = -17,
57
- LOCKDOWN_E_USER_DENIED_PAIRING = -18,
58
- LOCKDOWN_E_PAIRING_DIALOG_RESPONSE_PENDING = -19,
59
- LOCKDOWN_E_MISSING_HOST_ID = -20,
60
- LOCKDOWN_E_INVALID_HOST_ID = -21,
61
- LOCKDOWN_E_SESSION_ACTIVE = -22,
62
- LOCKDOWN_E_SESSION_INACTIVE = -23,
63
- LOCKDOWN_E_MISSING_SESSION_ID = -24,
64
- LOCKDOWN_E_INVALID_SESSION_ID = -25,
65
- LOCKDOWN_E_MISSING_SERVICE = -26,
66
- LOCKDOWN_E_INVALID_SERVICE = -27,
67
- LOCKDOWN_E_SERVICE_LIMIT = -28,
68
- LOCKDOWN_E_MISSING_PAIR_RECORD = -29,
69
- LOCKDOWN_E_SAVE_PAIR_RECORD_FAILED = -30,
70
- LOCKDOWN_E_INVALID_PAIR_RECORD = -31,
71
- LOCKDOWN_E_INVALID_ACTIVATION_RECORD = -32,
72
- LOCKDOWN_E_MISSING_ACTIVATION_RECORD = -33,
73
- LOCKDOWN_E_SERVICE_PROHIBITED = -34,
74
- LOCKDOWN_E_ESCROW_LOCKED = -35,
75
- LOCKDOWN_E_PAIRING_PROHIBITED_OVER_THIS_CONNECTION = -36,
76
- LOCKDOWN_E_FMIP_PROTECTED = -37,
77
- LOCKDOWN_E_MC_PROTECTED = -38,
78
- LOCKDOWN_E_MC_CHALLENGE_REQUIRED = -39,
79
- LOCKDOWN_E_UNKNOWN_ERROR = -256
80
- } lockdownd_error_t;
81
-
82
- typedef struct lockdownd_client_private lockdownd_client_private; /**< \private */
83
- typedef lockdownd_client_private *lockdownd_client_t; /**< The client handle. */
84
-
85
- struct lockdownd_pair_record {
86
- char *device_certificate; /**< The device certificate */
87
- char *host_certificate; /**< The host certificate */
88
- char *root_certificate; /**< The root certificate */
89
- char *host_id; /**< A unique HostID for the host computer */
90
- char *system_buid; /**< A unique system id */
91
- };
92
- /** pair record holding device, host and root certificates along the host_id */
93
- typedef struct lockdownd_pair_record *lockdownd_pair_record_t; /**< pair record */
94
-
95
- /** service descriptor */
96
- struct lockdownd_service_descriptor {
97
- uint16_t port; /**< port number the service was started on */
98
- uint8_t ssl_enabled; /**< an indicator if the service requires SSL */
99
- char* identifier; /**< identifier of the service */
100
- };
101
- typedef struct lockdownd_service_descriptor *lockdownd_service_descriptor_t;
102
-
103
- /** Callback types used in #lockdownd_cu_pairing_cb_t */
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
-
116
- /* Interface */
117
-
118
- /**
119
- * Creates a new lockdownd client for the device.
120
- *
121
- * @note This function does not pair with the device or start a session. This
122
- * has to be done manually by the caller after the client is created.
123
- * The device disconnects automatically if the lockdown connection idles
124
- * for more than 10 seconds. Make sure to call lockdownd_client_free() as soon
125
- * as the connection is no longer needed.
126
- *
127
- * @param device The device to create a lockdownd client for
128
- * @param client The pointer to the location of the new lockdownd_client
129
- * @param label The label to use for communication. Usually the program name.
130
- *
131
- * @return LOCKDOWN_E_SUCCESS on success, LOCKDOWN_E_INVALID_ARG when client is NULL
132
- */
133
- LIBIMOBILEDEVICE_API lockdownd_error_t lockdownd_client_new(idevice_t device, lockdownd_client_t *client, const char *label);
134
-
135
- /**
136
- * Creates a new lockdownd client for the device and starts initial handshake.
137
- * The handshake consists out of query_type, validate_pair, pair and
138
- * start_session calls. It uses the internal pairing record management.
139
- *
140
- * @note The device disconnects automatically if the lockdown connection idles
141
- * for more than 10 seconds. Make sure to call lockdownd_client_free() as soon
142
- * as the connection is no longer needed.
143
- *
144
- * @param device The device to create a lockdownd client for
145
- * @param client The pointer to the location of the new lockdownd_client
146
- * @param label The label to use for communication. Usually the program name.
147
- * Pass NULL to disable sending the label in requests to lockdownd.
148
- *
149
- * @return LOCKDOWN_E_SUCCESS on success, LOCKDOWN_E_INVALID_ARG when client is NULL,
150
- * LOCKDOWN_E_INVALID_CONF if configuration data is wrong
151
- */
152
- LIBIMOBILEDEVICE_API lockdownd_error_t lockdownd_client_new_with_handshake(idevice_t device, lockdownd_client_t *client, const char *label);
153
-
154
- /**
155
- * Closes the lockdownd client session if one is running and frees up the
156
- * lockdownd_client struct.
157
- *
158
- * @param client The lockdown client
159
- *
160
- * @return LOCKDOWN_E_SUCCESS on success, LOCKDOWN_E_INVALID_ARG when client is NULL
161
- */
162
- LIBIMOBILEDEVICE_API lockdownd_error_t lockdownd_client_free(lockdownd_client_t client);
163
-
164
-
165
- /**
166
- * Query the type of the service daemon. Depending on whether the device is
167
- * queried in normal mode or restore mode, different types will be returned.
168
- *
169
- * @param client The lockdownd client
170
- * @param type The type returned by the service daemon. Pass NULL to ignore.
171
- *
172
- * @return LOCKDOWN_E_SUCCESS on success, LOCKDOWN_E_INVALID_ARG when client is NULL
173
- */
174
- LIBIMOBILEDEVICE_API lockdownd_error_t lockdownd_query_type(lockdownd_client_t client, char **type);
175
-
176
- /**
177
- * Retrieves a preferences plist using an optional domain and/or key name.
178
- *
179
- * @param client An initialized lockdownd client.
180
- * @param domain The domain to query on or NULL for global domain
181
- * @param key The key name to request or NULL to query for all keys
182
- * @param value A plist node representing the result value node
183
- *
184
- * @return LOCKDOWN_E_SUCCESS on success, LOCKDOWN_E_INVALID_ARG when client is NULL
185
- */
186
- LIBIMOBILEDEVICE_API lockdownd_error_t lockdownd_get_value(lockdownd_client_t client, const char *domain, const char *key, plist_t *value);
187
-
188
- /**
189
- * Sets a preferences value using a plist and optional by domain and/or key name.
190
- *
191
- * @param client an initialized lockdownd client.
192
- * @param domain the domain to query on or NULL for global domain
193
- * @param key the key name to set the value or NULL to set a value dict plist
194
- * @param value a plist node of any node type representing the value to set
195
- *
196
- * @return LOCKDOWN_E_SUCCESS on success, LOCKDOWN_E_INVALID_ARG when client or
197
- * value is NULL
198
- */
199
- LIBIMOBILEDEVICE_API lockdownd_error_t lockdownd_set_value(lockdownd_client_t client, const char *domain, const char *key, plist_t value);
200
-
201
- /**
202
- * Removes a preference node by domain and/or key name.
203
- *
204
- * @note: Use with caution as this could remove vital information on the device
205
- *
206
- * @param client An initialized lockdownd client.
207
- * @param domain The domain to query on or NULL for global domain
208
- * @param key The key name to remove or NULL remove all keys for the current domain
209
- *
210
- * @return LOCKDOWN_E_SUCCESS on success, LOCKDOWN_E_INVALID_ARG when client is NULL
211
- */
212
- LIBIMOBILEDEVICE_API lockdownd_error_t lockdownd_remove_value(lockdownd_client_t client, const char *domain, const char *key);
213
-
214
- /**
215
- * Requests to start a service and retrieve it's port on success.
216
- *
217
- * @param client The lockdownd client
218
- * @param identifier The identifier of the service to start
219
- * @param service The service descriptor on success or NULL on failure
220
- *
221
- * @return LOCKDOWN_E_SUCCESS on success, LOCKDOWN_E_INVALID_ARG if a parameter
222
- * is NULL, LOCKDOWN_E_INVALID_SERVICE if the requested service is not known
223
- * by the device, LOCKDOWN_E_START_SERVICE_FAILED if the service could not be
224
- * started by the device
225
- */
226
- LIBIMOBILEDEVICE_API lockdownd_error_t lockdownd_start_service(lockdownd_client_t client, const char *identifier, lockdownd_service_descriptor_t *service);
227
-
228
- /**
229
- * Requests to start a service and retrieve it's port on success.
230
- * Sends the escrow bag from the device's pair record.
231
- *
232
- * @param client The lockdownd client
233
- * @param identifier The identifier of the service to start
234
- * @param service The service descriptor on success or NULL on failure
235
- *
236
- * @return LOCKDOWN_E_SUCCESS on success, LOCKDOWN_E_INVALID_ARG if a parameter
237
- * is NULL, LOCKDOWN_E_INVALID_SERVICE if the requested service is not known
238
- * by the device, LOCKDOWN_E_START_SERVICE_FAILED if the service could not because
239
- * started by the device, LOCKDOWN_E_INVALID_CONF if the host id or escrow bag are
240
- * missing from the device record.
241
- */
242
- LIBIMOBILEDEVICE_API lockdownd_error_t lockdownd_start_service_with_escrow_bag(lockdownd_client_t client, const char *identifier, lockdownd_service_descriptor_t *service);
243
-
244
- /**
245
- * Opens a session with lockdownd and switches to SSL mode if device wants it.
246
- *
247
- * @param client The lockdownd client
248
- * @param host_id The HostID of the computer
249
- * @param session_id The new session_id of the created session
250
- * @param ssl_enabled Whether SSL communication is used in the session
251
- *
252
- * @return LOCKDOWN_E_SUCCESS on success, LOCKDOWN_E_INVALID_ARG when a client
253
- * or host_id is NULL, LOCKDOWN_E_PLIST_ERROR if the response plist had errors,
254
- * LOCKDOWN_E_INVALID_HOST_ID if the device does not know the supplied HostID,
255
- * LOCKDOWN_E_SSL_ERROR if enabling SSL communication failed
256
- */
257
- LIBIMOBILEDEVICE_API lockdownd_error_t lockdownd_start_session(lockdownd_client_t client, const char *host_id, char **session_id, int *ssl_enabled);
258
-
259
- /**
260
- * Closes the lockdownd session by sending the StopSession request.
261
- *
262
- * @see lockdownd_start_session
263
- *
264
- * @param client The lockdown client
265
- * @param session_id The id of a running session
266
- *
267
- * @return LOCKDOWN_E_SUCCESS on success, LOCKDOWN_E_INVALID_ARG when client is NULL
268
- */
269
- LIBIMOBILEDEVICE_API lockdownd_error_t lockdownd_stop_session(lockdownd_client_t client, const char *session_id);
270
-
271
- /**
272
- * Sends a plist to lockdownd.
273
- *
274
- * @note This function is low-level and should only be used if you need to send
275
- * a new type of message.
276
- *
277
- * @param client The lockdownd client
278
- * @param plist The plist to send
279
- *
280
- * @return LOCKDOWN_E_SUCCESS on success, LOCKDOWN_E_INVALID_ARG when client or
281
- * plist is NULL
282
- */
283
- LIBIMOBILEDEVICE_API lockdownd_error_t lockdownd_send(lockdownd_client_t client, plist_t plist);
284
-
285
- /**
286
- * Receives a plist from lockdownd.
287
- *
288
- * @param client The lockdownd client
289
- * @param plist The plist to store the received data
290
- *
291
- * @return LOCKDOWN_E_SUCCESS on success, LOCKDOWN_E_INVALID_ARG when client or
292
- * plist is NULL
293
- */
294
- LIBIMOBILEDEVICE_API lockdownd_error_t lockdownd_receive(lockdownd_client_t client, plist_t *plist);
295
-
296
- /**
297
- * Pairs the device using the supplied pair record.
298
- *
299
- * @param client The lockdown client
300
- * @param pair_record The pair record to use for pairing. If NULL is passed, then
301
- * the pair records from the current machine are used. New records will be
302
- * generated automatically when pairing is done for the first time.
303
- *
304
- * @return LOCKDOWN_E_SUCCESS on success, LOCKDOWN_E_INVALID_ARG when client is NULL,
305
- * LOCKDOWN_E_PLIST_ERROR if the pair_record certificates are wrong,
306
- * LOCKDOWN_E_PAIRING_FAILED if the pairing failed,
307
- * LOCKDOWN_E_PASSWORD_PROTECTED if the device is password protected,
308
- * LOCKDOWN_E_INVALID_HOST_ID if the device does not know the caller's host id
309
- */
310
- LIBIMOBILEDEVICE_API lockdownd_error_t lockdownd_pair(lockdownd_client_t client, lockdownd_pair_record_t pair_record);
311
-
312
- /**
313
- * Pairs the device using the supplied pair record and passing the given options.
314
- *
315
- * @param client The lockdown client
316
- * @param pair_record The pair record to use for pairing. If NULL is passed, then
317
- * the pair records from the current machine are used. New records will be
318
- * generated automatically when pairing is done for the first time.
319
- * @param options The pairing options to pass. Can be NULL for no options.
320
- * @param response If non-NULL a pointer to lockdownd's response dictionary is returned.
321
- * The caller is responsible to free the response dictionary with plist_free().
322
- *
323
- * @return LOCKDOWN_E_SUCCESS on success, LOCKDOWN_E_INVALID_ARG when client is NULL,
324
- * LOCKDOWN_E_PLIST_ERROR if the pair_record certificates are wrong,
325
- * LOCKDOWN_E_PAIRING_FAILED if the pairing failed,
326
- * LOCKDOWN_E_PASSWORD_PROTECTED if the device is password protected,
327
- * LOCKDOWN_E_INVALID_HOST_ID if the device does not know the caller's host id
328
- */
329
- 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);
330
-
331
- /**
332
- * Validates if the device is paired with the given HostID. If successful the
333
- * specified host will become trusted host of the device indicated by the
334
- * lockdownd preference named TrustedHostAttached. Otherwise the host must be
335
- * paired using lockdownd_pair() first.
336
- *
337
- * @param client The lockdown client
338
- * @param pair_record The pair record to validate pairing with. If NULL is
339
- * passed, then the pair record is read from the internal pairing record
340
- * management.
341
- *
342
- * @return LOCKDOWN_E_SUCCESS on success, LOCKDOWN_E_INVALID_ARG when client is NULL,
343
- * LOCKDOWN_E_PLIST_ERROR if the pair_record certificates are wrong,
344
- * LOCKDOWN_E_PAIRING_FAILED if the pairing failed,
345
- * LOCKDOWN_E_PASSWORD_PROTECTED if the device is password protected,
346
- * LOCKDOWN_E_INVALID_HOST_ID if the device does not know the caller's host id
347
- */
348
- LIBIMOBILEDEVICE_API lockdownd_error_t lockdownd_validate_pair(lockdownd_client_t client, lockdownd_pair_record_t pair_record);
349
-
350
- /**
351
- * Unpairs the device with the given HostID and removes the pairing records
352
- * from the device and host if the internal pairing record management is used.
353
- *
354
- * @param client The lockdown client
355
- * @param pair_record The pair record to use for unpair. If NULL is passed, then
356
- * the pair records from the current machine are used.
357
- *
358
- * @return LOCKDOWN_E_SUCCESS on success, LOCKDOWN_E_INVALID_ARG when client is NULL,
359
- * LOCKDOWN_E_PLIST_ERROR if the pair_record certificates are wrong,
360
- * LOCKDOWN_E_PAIRING_FAILED if the pairing failed,
361
- * LOCKDOWN_E_PASSWORD_PROTECTED if the device is password protected,
362
- * LOCKDOWN_E_INVALID_HOST_ID if the device does not know the caller's host id
363
- */
364
- LIBIMOBILEDEVICE_API lockdownd_error_t lockdownd_unpair(lockdownd_client_t client, lockdownd_pair_record_t pair_record);
365
-
366
- /**
367
- * Activates the device. Only works within an open session.
368
- * The ActivationRecord plist dictionary must be obtained using the
369
- * activation protocol requesting from Apple's https webservice.
370
- *
371
- * @param client The lockdown client
372
- * @param activation_record The activation record plist dictionary
373
- *
374
- * @return LOCKDOWN_E_SUCCESS on success, LOCKDOWN_E_INVALID_ARG when client or
375
- * activation_record is NULL, LOCKDOWN_E_NO_RUNNING_SESSION if no session is
376
- * open, LOCKDOWN_E_PLIST_ERROR if the received plist is broken,
377
- * LOCKDOWN_E_ACTIVATION_FAILED if the activation failed,
378
- * LOCKDOWN_E_INVALID_ACTIVATION_RECORD if the device reports that the
379
- * activation_record is invalid
380
- */
381
- LIBIMOBILEDEVICE_API lockdownd_error_t lockdownd_activate(lockdownd_client_t client, plist_t activation_record);
382
-
383
- /**
384
- * Deactivates the device, returning it to the locked “Activate with iTunes”
385
- * screen.
386
- *
387
- * @param client The lockdown client
388
- *
389
- * @return LOCKDOWN_E_SUCCESS on success, LOCKDOWN_E_INVALID_ARG when client is NULL,
390
- * LOCKDOWN_E_NO_RUNNING_SESSION if no session is open,
391
- * LOCKDOWN_E_PLIST_ERROR if the received plist is broken
392
- */
393
- LIBIMOBILEDEVICE_API lockdownd_error_t lockdownd_deactivate(lockdownd_client_t client);
394
-
395
- /**
396
- * Tells the device to immediately enter recovery mode.
397
- *
398
- * @param client The lockdown client
399
- *
400
- * @return LOCKDOWN_E_SUCCESS on success, LOCKDOWN_E_INVALID_ARG when client is NULL
401
- */
402
- LIBIMOBILEDEVICE_API lockdownd_error_t lockdownd_enter_recovery(lockdownd_client_t client);
403
-
404
- /**
405
- * Sends the Goodbye request to lockdownd signaling the end of communication.
406
- *
407
- * @param client The lockdown client
408
- *
409
- * @return LOCKDOWN_E_SUCCESS on success, LOCKDOWN_E_INVALID_ARG when client
410
- * is NULL, LOCKDOWN_E_PLIST_ERROR if the device did not acknowledge the
411
- * request
412
- */
413
- LIBIMOBILEDEVICE_API lockdownd_error_t lockdownd_goodbye(lockdownd_client_t client);
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
- 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);
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
- 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);
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
- LIBIMOBILEDEVICE_API 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
- LIBIMOBILEDEVICE_API lockdownd_error_t lockdownd_pair_cu(lockdownd_client_t client);
496
-
497
-
498
- /* Helper */
499
-
500
- /**
501
- * Sets the label to send for requests to lockdownd.
502
- *
503
- * @param client The lockdown client
504
- * @param label The label to set or NULL to disable sending a label
505
- *
506
- */
507
- LIBIMOBILEDEVICE_API void lockdownd_client_set_label(lockdownd_client_t client, const char *label);
508
-
509
- /**
510
- * Returns the unique id of the device from lockdownd.
511
- *
512
- * @param client An initialized lockdownd client.
513
- * @param udid Holds the unique id of the device. The caller is responsible
514
- * for freeing the memory.
515
- *
516
- * @return LOCKDOWN_E_SUCCESS on success
517
- */
518
- LIBIMOBILEDEVICE_API lockdownd_error_t lockdownd_get_device_udid(lockdownd_client_t client, char **udid);
519
-
520
- /**
521
- * Retrieves the name of the device from lockdownd set by the user.
522
- *
523
- * @param client An initialized lockdownd client.
524
- * @param device_name Holds the name of the device. The caller is
525
- * responsible for freeing the memory.
526
- *
527
- * @return LOCKDOWN_E_SUCCESS on success
528
- */
529
- LIBIMOBILEDEVICE_API lockdownd_error_t lockdownd_get_device_name(lockdownd_client_t client, char **device_name);
530
-
531
- /**
532
- * Calculates and returns the data classes the device supports from lockdownd.
533
- *
534
- * @param client An initialized lockdownd client.
535
- * @param classes A pointer to store an array of class names. The caller is responsible
536
- * for freeing the memory which can be done using mobilesync_data_classes_free().
537
- * @param count The number of items in the classes array.
538
- *
539
- * @return LOCKDOWN_E_SUCCESS on success,
540
- * LOCKDOWN_E_INVALID_ARG when client is NULL,
541
- * LOCKDOWN_E_NO_RUNNING_SESSION if no session is open,
542
- * LOCKDOWN_E_PLIST_ERROR if the received plist is broken
543
- */
544
- LIBIMOBILEDEVICE_API lockdownd_error_t lockdownd_get_sync_data_classes(lockdownd_client_t client, char ***classes, int *count);
545
-
546
- /**
547
- * Frees memory of an allocated array of data classes as returned by lockdownd_get_sync_data_classes()
548
- *
549
- * @param classes An array of class names to free.
550
- *
551
- * @return LOCKDOWN_E_SUCCESS on success
552
- */
553
- LIBIMOBILEDEVICE_API lockdownd_error_t lockdownd_data_classes_free(char **classes);
554
-
555
- /**
556
- * Frees memory of a service descriptor as returned by lockdownd_start_service()
557
- *
558
- * @param service A service descriptor instance to free.
559
- *
560
- * @return LOCKDOWN_E_SUCCESS on success
561
- */
562
- LIBIMOBILEDEVICE_API lockdownd_error_t lockdownd_service_descriptor_free(lockdownd_service_descriptor_t service);
563
-
564
- /**
565
- * Gets a readable error string for a given lockdown error code.
566
- *
567
- * @param err A lockdownd error code
568
- *
569
- * @returns A readable error string
570
- */
571
- LIBIMOBILEDEVICE_API const char* lockdownd_strerror(lockdownd_error_t err);
572
-
573
- #ifdef __cplusplus
574
- }
575
- #endif
576
-
577
- #endif