diff options
Diffstat (limited to 'src/lockdown.c')
| -rw-r--r-- | src/lockdown.c | 279 |
1 files changed, 1 insertions, 278 deletions
diff --git a/src/lockdown.c b/src/lockdown.c index 9b579e8..cf03e0f 100644 --- a/src/lockdown.c +++ b/src/lockdown.c | |||
| @@ -154,16 +154,6 @@ static void plist_dict_add_label(plist_t plist, const char *label) | |||
| 154 | } | 154 | } |
| 155 | } | 155 | } |
| 156 | 156 | ||
| 157 | /** | ||
| 158 | * Closes the lockdownd session by sending the StopSession request. | ||
| 159 | * | ||
| 160 | * @see lockdownd_start_session | ||
| 161 | * | ||
| 162 | * @param client The lockdown client | ||
| 163 | * @param session_id The id of a running session | ||
| 164 | * | ||
| 165 | * @return LOCKDOWN_E_SUCCESS on success, NP_E_INVALID_ARG when client is NULL | ||
| 166 | */ | ||
| 167 | lockdownd_error_t lockdownd_stop_session(lockdownd_client_t client, const char *session_id) | 157 | lockdownd_error_t lockdownd_stop_session(lockdownd_client_t client, const char *session_id) |
| 168 | { | 158 | { |
| 169 | if (!client) | 159 | if (!client) |
| @@ -247,14 +237,6 @@ static lockdownd_error_t lockdownd_client_free_simple(lockdownd_client_t client) | |||
| 247 | return ret; | 237 | return ret; |
| 248 | } | 238 | } |
| 249 | 239 | ||
| 250 | /** | ||
| 251 | * Closes the lockdownd client session if one is running and frees up the | ||
| 252 | * lockdownd_client struct. | ||
| 253 | * | ||
| 254 | * @param client The lockdown client | ||
| 255 | * | ||
| 256 | * @return LOCKDOWN_E_SUCCESS on success, NP_E_INVALID_ARG when client is NULL | ||
| 257 | */ | ||
| 258 | lockdownd_error_t lockdownd_client_free(lockdownd_client_t client) | 240 | lockdownd_error_t lockdownd_client_free(lockdownd_client_t client) |
| 259 | { | 241 | { |
| 260 | if (!client) | 242 | if (!client) |
| @@ -271,13 +253,6 @@ lockdownd_error_t lockdownd_client_free(lockdownd_client_t client) | |||
| 271 | return ret; | 253 | return ret; |
| 272 | } | 254 | } |
| 273 | 255 | ||
| 274 | /** | ||
| 275 | * Sets the label to send for requests to lockdownd. | ||
| 276 | * | ||
| 277 | * @param client The lockdown client | ||
| 278 | * @param label The label to set or NULL to disable sending a label | ||
| 279 | * | ||
| 280 | */ | ||
| 281 | void lockdownd_client_set_label(lockdownd_client_t client, const char *label) | 256 | void lockdownd_client_set_label(lockdownd_client_t client, const char *label) |
| 282 | { | 257 | { |
| 283 | if (client) { | 258 | if (client) { |
| @@ -288,15 +263,6 @@ void lockdownd_client_set_label(lockdownd_client_t client, const char *label) | |||
| 288 | } | 263 | } |
| 289 | } | 264 | } |
| 290 | 265 | ||
| 291 | /** | ||
| 292 | * Receives a plist from lockdownd. | ||
| 293 | * | ||
| 294 | * @param client The lockdownd client | ||
| 295 | * @param plist The plist to store the received data | ||
| 296 | * | ||
| 297 | * @return LOCKDOWN_E_SUCCESS on success, NP_E_INVALID_ARG when client or | ||
| 298 | * plist is NULL | ||
| 299 | */ | ||
| 300 | lockdownd_error_t lockdownd_receive(lockdownd_client_t client, plist_t *plist) | 266 | lockdownd_error_t lockdownd_receive(lockdownd_client_t client, plist_t *plist) |
| 301 | { | 267 | { |
| 302 | if (!client || !plist || (plist && *plist)) | 268 | if (!client || !plist || (plist && *plist)) |
| @@ -315,18 +281,6 @@ lockdownd_error_t lockdownd_receive(lockdownd_client_t client, plist_t *plist) | |||
| 315 | return ret; | 281 | return ret; |
| 316 | } | 282 | } |
| 317 | 283 | ||
| 318 | /** | ||
| 319 | * Sends a plist to lockdownd. | ||
| 320 | * | ||
| 321 | * @note This function is low-level and should only be used if you need to send | ||
| 322 | * a new type of message. | ||
| 323 | * | ||
| 324 | * @param client The lockdownd client | ||
| 325 | * @param plist The plist to send | ||
| 326 | * | ||
| 327 | * @return LOCKDOWN_E_SUCCESS on success, NP_E_INVALID_ARG when client or | ||
| 328 | * plist is NULL | ||
| 329 | */ | ||
| 330 | lockdownd_error_t lockdownd_send(lockdownd_client_t client, plist_t plist) | 284 | lockdownd_error_t lockdownd_send(lockdownd_client_t client, plist_t plist) |
| 331 | { | 285 | { |
| 332 | if (!client || !plist) | 286 | if (!client || !plist) |
| @@ -342,15 +296,6 @@ lockdownd_error_t lockdownd_send(lockdownd_client_t client, plist_t plist) | |||
| 342 | return ret; | 296 | return ret; |
| 343 | } | 297 | } |
| 344 | 298 | ||
| 345 | /** | ||
| 346 | * Query the type of the service daemon. Depending on whether the device is | ||
| 347 | * queried in normal mode or restore mode, different types will be returned. | ||
| 348 | * | ||
| 349 | * @param client The lockdownd client | ||
| 350 | * @param type The type returned by the service daemon. Pass NULL to ignore. | ||
| 351 | * | ||
| 352 | * @return LOCKDOWN_E_SUCCESS on success, NP_E_INVALID_ARG when client is NULL | ||
| 353 | */ | ||
| 354 | lockdownd_error_t lockdownd_query_type(lockdownd_client_t client, char **type) | 299 | lockdownd_error_t lockdownd_query_type(lockdownd_client_t client, char **type) |
| 355 | { | 300 | { |
| 356 | if (!client) | 301 | if (!client) |
| @@ -396,16 +341,6 @@ lockdownd_error_t lockdownd_query_type(lockdownd_client_t client, char **type) | |||
| 396 | return ret; | 341 | return ret; |
| 397 | } | 342 | } |
| 398 | 343 | ||
| 399 | /** | ||
| 400 | * Retrieves a preferences plist using an optional domain and/or key name. | ||
| 401 | * | ||
| 402 | * @param client An initialized lockdownd client. | ||
| 403 | * @param domain The domain to query on or NULL for global domain | ||
| 404 | * @param key The key name to request or NULL to query for all keys | ||
| 405 | * @param value A plist node representing the result value node | ||
| 406 | * | ||
| 407 | * @return LOCKDOWN_E_SUCCESS on success, NP_E_INVALID_ARG when client is NULL | ||
| 408 | */ | ||
| 409 | lockdownd_error_t lockdownd_get_value(lockdownd_client_t client, const char *domain, const char *key, plist_t *value) | 344 | lockdownd_error_t lockdownd_get_value(lockdownd_client_t client, const char *domain, const char *key, plist_t *value) |
| 410 | { | 345 | { |
| 411 | if (!client) | 346 | if (!client) |
| @@ -461,17 +396,6 @@ lockdownd_error_t lockdownd_get_value(lockdownd_client_t client, const char *dom | |||
| 461 | return ret; | 396 | return ret; |
| 462 | } | 397 | } |
| 463 | 398 | ||
| 464 | /** | ||
| 465 | * Sets a preferences value using a plist and optional by domain and/or key name. | ||
| 466 | * | ||
| 467 | * @param client an initialized lockdownd client. | ||
| 468 | * @param domain the domain to query on or NULL for global domain | ||
| 469 | * @param key the key name to set the value or NULL to set a value dict plist | ||
| 470 | * @param value a plist node of any node type representing the value to set | ||
| 471 | * | ||
| 472 | * @return LOCKDOWN_E_SUCCESS on success, NP_E_INVALID_ARG when client or | ||
| 473 | * value is NULL | ||
| 474 | */ | ||
| 475 | lockdownd_error_t lockdownd_set_value(lockdownd_client_t client, const char *domain, const char *key, plist_t value) | 399 | lockdownd_error_t lockdownd_set_value(lockdownd_client_t client, const char *domain, const char *key, plist_t value) |
| 476 | { | 400 | { |
| 477 | if (!client || !value) | 401 | if (!client || !value) |
| @@ -520,17 +444,6 @@ lockdownd_error_t lockdownd_set_value(lockdownd_client_t client, const char *dom | |||
| 520 | return ret; | 444 | return ret; |
| 521 | } | 445 | } |
| 522 | 446 | ||
| 523 | /** | ||
| 524 | * Removes a preference node by domain and/or key name. | ||
| 525 | * | ||
| 526 | * @note: Use with caution as this could remove vital information on the device | ||
| 527 | * | ||
| 528 | * @param client An initialized lockdownd client. | ||
| 529 | * @param domain The domain to query on or NULL for global domain | ||
| 530 | * @param key The key name to remove or NULL remove all keys for the current domain | ||
| 531 | * | ||
| 532 | * @return LOCKDOWN_E_SUCCESS on success, NP_E_INVALID_ARG when client is NULL | ||
| 533 | */ | ||
| 534 | lockdownd_error_t lockdownd_remove_value(lockdownd_client_t client, const char *domain, const char *key) | 447 | lockdownd_error_t lockdownd_remove_value(lockdownd_client_t client, const char *domain, const char *key) |
| 535 | { | 448 | { |
| 536 | if (!client) | 449 | if (!client) |
| @@ -578,15 +491,6 @@ lockdownd_error_t lockdownd_remove_value(lockdownd_client_t client, const char * | |||
| 578 | return ret; | 491 | return ret; |
| 579 | } | 492 | } |
| 580 | 493 | ||
| 581 | /** | ||
| 582 | * Returns the unique id of the device from lockdownd. | ||
| 583 | * | ||
| 584 | * @param client An initialized lockdownd client. | ||
| 585 | * @param udid Holds the unique id of the device. The caller is responsible | ||
| 586 | * for freeing the memory. | ||
| 587 | * | ||
| 588 | * @return LOCKDOWN_E_SUCCESS on success | ||
| 589 | */ | ||
| 590 | lockdownd_error_t lockdownd_get_device_udid(lockdownd_client_t client, char **udid) | 494 | lockdownd_error_t lockdownd_get_device_udid(lockdownd_client_t client, char **udid) |
| 591 | { | 495 | { |
| 592 | lockdownd_error_t ret = LOCKDOWN_E_UNKNOWN_ERROR; | 496 | lockdownd_error_t ret = LOCKDOWN_E_UNKNOWN_ERROR; |
| @@ -633,15 +537,6 @@ static lockdownd_error_t lockdownd_get_device_public_key_as_key_data(lockdownd_c | |||
| 633 | return ret; | 537 | return ret; |
| 634 | } | 538 | } |
| 635 | 539 | ||
| 636 | /** | ||
| 637 | * Retrieves the name of the device from lockdownd set by the user. | ||
| 638 | * | ||
| 639 | * @param client An initialized lockdownd client. | ||
| 640 | * @param device_name Holds the name of the device. The caller is | ||
| 641 | * responsible for freeing the memory. | ||
| 642 | * | ||
| 643 | * @return LOCKDOWN_E_SUCCESS on success | ||
| 644 | */ | ||
| 645 | lockdownd_error_t lockdownd_get_device_name(lockdownd_client_t client, char **device_name) | 540 | lockdownd_error_t lockdownd_get_device_name(lockdownd_client_t client, char **device_name) |
| 646 | { | 541 | { |
| 647 | lockdownd_error_t ret = LOCKDOWN_E_UNKNOWN_ERROR; | 542 | lockdownd_error_t ret = LOCKDOWN_E_UNKNOWN_ERROR; |
| @@ -659,21 +554,6 @@ lockdownd_error_t lockdownd_get_device_name(lockdownd_client_t client, char **de | |||
| 659 | return ret; | 554 | return ret; |
| 660 | } | 555 | } |
| 661 | 556 | ||
| 662 | /** | ||
| 663 | * Creates a new lockdownd client for the device. | ||
| 664 | * | ||
| 665 | * @note This function does not pair with the device or start a session. This | ||
| 666 | * has to be done manually by the caller after the client is created. | ||
| 667 | * The device disconnects automatically if the lockdown connection idles | ||
| 668 | * for more than 10 seconds. Make sure to call lockdownd_client_free() as soon | ||
| 669 | * as the connection is no longer needed. | ||
| 670 | * | ||
| 671 | * @param device The device to create a lockdownd client for | ||
| 672 | * @param client The pointer to the location of the new lockdownd_client | ||
| 673 | * @param label The label to use for communication. Usually the program name. | ||
| 674 | * | ||
| 675 | * @return LOCKDOWN_E_SUCCESS on success, NP_E_INVALID_ARG when client is NULL | ||
| 676 | */ | ||
| 677 | lockdownd_error_t lockdownd_client_new(idevice_t device, lockdownd_client_t *client, const char *label) | 557 | lockdownd_error_t lockdownd_client_new(idevice_t device, lockdownd_client_t *client, const char *label) |
| 678 | { | 558 | { |
| 679 | if (!client) | 559 | if (!client) |
| @@ -707,23 +587,6 @@ lockdownd_error_t lockdownd_client_new(idevice_t device, lockdownd_client_t *cli | |||
| 707 | return LOCKDOWN_E_SUCCESS; | 587 | return LOCKDOWN_E_SUCCESS; |
| 708 | } | 588 | } |
| 709 | 589 | ||
| 710 | /** | ||
| 711 | * Creates a new lockdownd client for the device and starts initial handshake. | ||
| 712 | * The handshake consists out of query_type, validate_pair, pair and | ||
| 713 | * start_session calls. It uses the internal pairing record management. | ||
| 714 | * | ||
| 715 | * @note The device disconnects automatically if the lockdown connection idles | ||
| 716 | * for more than 10 seconds. Make sure to call lockdownd_client_free() as soon | ||
| 717 | * as the connection is no longer needed. | ||
| 718 | * | ||
| 719 | * @param device The device to create a lockdownd client for | ||
| 720 | * @param client The pointer to the location of the new lockdownd_client | ||
| 721 | * @param label The label to use for communication. Usually the program name. | ||
| 722 | * Pass NULL to disable sending the label in requests to lockdownd. | ||
| 723 | * | ||
| 724 | * @return LOCKDOWN_E_SUCCESS on success, NP_E_INVALID_ARG when client is NULL, | ||
| 725 | * LOCKDOWN_E_INVALID_CONF if configuration data is wrong | ||
| 726 | */ | ||
| 727 | lockdownd_error_t lockdownd_client_new_with_handshake(idevice_t device, lockdownd_client_t *client, const char *label) | 590 | lockdownd_error_t lockdownd_client_new_with_handshake(idevice_t device, lockdownd_client_t *client, const char *label) |
| 728 | { | 591 | { |
| 729 | if (!client) | 592 | if (!client) |
| @@ -1091,73 +954,21 @@ static lockdownd_error_t lockdownd_do_pair(lockdownd_client_t client, lockdownd_ | |||
| 1091 | return ret; | 954 | return ret; |
| 1092 | } | 955 | } |
| 1093 | 956 | ||
| 1094 | /** | ||
| 1095 | * Pairs the device using the supplied pair record. | ||
| 1096 | * | ||
| 1097 | * @param client The lockdown client to pair with. | ||
| 1098 | * @param pair_record The pair record to use for pairing. If NULL is passed, then | ||
| 1099 | * the pair records from the current machine are used. New records will be | ||
| 1100 | * generated automatically when pairing is done for the first time. | ||
| 1101 | * | ||
| 1102 | * @return LOCKDOWN_E_SUCCESS on success, NP_E_INVALID_ARG when client is NULL, | ||
| 1103 | * LOCKDOWN_E_PLIST_ERROR if the pair_record certificates are wrong, | ||
| 1104 | * LOCKDOWN_E_PAIRING_FAILED if the pairing failed, | ||
| 1105 | * LOCKDOWN_E_PASSWORD_PROTECTED if the device is password protected, | ||
| 1106 | * LOCKDOWN_E_INVALID_HOST_ID if the device does not know the caller's host id | ||
| 1107 | */ | ||
| 1108 | lockdownd_error_t lockdownd_pair(lockdownd_client_t client, lockdownd_pair_record_t pair_record) | 957 | lockdownd_error_t lockdownd_pair(lockdownd_client_t client, lockdownd_pair_record_t pair_record) |
| 1109 | { | 958 | { |
| 1110 | return lockdownd_do_pair(client, pair_record, "Pair"); | 959 | return lockdownd_do_pair(client, pair_record, "Pair"); |
| 1111 | } | 960 | } |
| 1112 | 961 | ||
| 1113 | /** | ||
| 1114 | * Validates if the device is paired with the given HostID. If succeeded them | ||
| 1115 | * specified host will become trusted host of the device indicated by the | ||
| 1116 | * lockdownd preference named TrustedHostAttached. Otherwise the host must because | ||
| 1117 | * paired using lockdownd_pair() first. | ||
| 1118 | * | ||
| 1119 | * @param client The lockdown client to pair with. | ||
| 1120 | * @param pair_record The pair record to validate pairing with. If NULL is | ||
| 1121 | * passed, then the pair record is read from the internal pairing record | ||
| 1122 | * management. | ||
| 1123 | * | ||
| 1124 | * @return LOCKDOWN_E_SUCCESS on success, NP_E_INVALID_ARG when client is NULL, | ||
| 1125 | * LOCKDOWN_E_PLIST_ERROR if the pair_record certificates are wrong, | ||
| 1126 | * LOCKDOWN_E_PAIRING_FAILED if the pairing failed, | ||
| 1127 | * LOCKDOWN_E_PASSWORD_PROTECTED if the device is password protected, | ||
| 1128 | * LOCKDOWN_E_INVALID_HOST_ID if the device does not know the caller's host id | ||
| 1129 | */ | ||
| 1130 | lockdownd_error_t lockdownd_validate_pair(lockdownd_client_t client, lockdownd_pair_record_t pair_record) | 962 | lockdownd_error_t lockdownd_validate_pair(lockdownd_client_t client, lockdownd_pair_record_t pair_record) |
| 1131 | { | 963 | { |
| 1132 | return lockdownd_do_pair(client, pair_record, "ValidatePair"); | 964 | return lockdownd_do_pair(client, pair_record, "ValidatePair"); |
| 1133 | } | 965 | } |
| 1134 | 966 | ||
| 1135 | /** | ||
| 1136 | * Unpairs the device with the given HostID and removes the pairing records | ||
| 1137 | * from the device and host if the internal pairing record management is used. | ||
| 1138 | * | ||
| 1139 | * @param client The lockdown client to pair with. | ||
| 1140 | * @param pair_record The pair record to use for unpair. If NULL is passed, then | ||
| 1141 | * the pair records from the current machine are used. | ||
| 1142 | * | ||
| 1143 | * @return LOCKDOWN_E_SUCCESS on success, NP_E_INVALID_ARG when client is NULL, | ||
| 1144 | * LOCKDOWN_E_PLIST_ERROR if the pair_record certificates are wrong, | ||
| 1145 | * LOCKDOWN_E_PAIRING_FAILED if the pairing failed, | ||
| 1146 | * LOCKDOWN_E_PASSWORD_PROTECTED if the device is password protected, | ||
| 1147 | * LOCKDOWN_E_INVALID_HOST_ID if the device does not know the caller's host id | ||
| 1148 | */ | ||
| 1149 | lockdownd_error_t lockdownd_unpair(lockdownd_client_t client, lockdownd_pair_record_t pair_record) | 967 | lockdownd_error_t lockdownd_unpair(lockdownd_client_t client, lockdownd_pair_record_t pair_record) |
| 1150 | { | 968 | { |
| 1151 | return lockdownd_do_pair(client, pair_record, "Unpair"); | 969 | return lockdownd_do_pair(client, pair_record, "Unpair"); |
| 1152 | } | 970 | } |
| 1153 | 971 | ||
| 1154 | /** | ||
| 1155 | * Tells the device to immediately enter recovery mode. | ||
| 1156 | * | ||
| 1157 | * @param client The lockdown client | ||
| 1158 | * | ||
| 1159 | * @return LOCKDOWN_E_SUCCESS on success, NP_E_INVALID_ARG when client is NULL | ||
| 1160 | */ | ||
| 1161 | lockdownd_error_t lockdownd_enter_recovery(lockdownd_client_t client) | 972 | lockdownd_error_t lockdownd_enter_recovery(lockdownd_client_t client) |
| 1162 | { | 973 | { |
| 1163 | if (!client) | 974 | if (!client) |
| @@ -1186,15 +997,6 @@ lockdownd_error_t lockdownd_enter_recovery(lockdownd_client_t client) | |||
| 1186 | return ret; | 997 | return ret; |
| 1187 | } | 998 | } |
| 1188 | 999 | ||
| 1189 | /** | ||
| 1190 | * Sends the Goodbye request to lockdownd signaling the end of communication. | ||
| 1191 | * | ||
| 1192 | * @param client The lockdown client | ||
| 1193 | * | ||
| 1194 | * @return LOCKDOWN_E_SUCCESS on success, LOCKDOWN_E_INVALID_ARG when client | ||
| 1195 | * is NULL, LOCKDOWN_E_PLIST_ERROR if the device did not acknowledge the | ||
| 1196 | * request | ||
| 1197 | */ | ||
| 1198 | lockdownd_error_t lockdownd_goodbye(lockdownd_client_t client) | 1000 | lockdownd_error_t lockdownd_goodbye(lockdownd_client_t client) |
| 1199 | { | 1001 | { |
| 1200 | if (!client) | 1002 | if (!client) |
| @@ -1228,19 +1030,6 @@ lockdownd_error_t lockdownd_goodbye(lockdownd_client_t client) | |||
| 1228 | return ret; | 1030 | return ret; |
| 1229 | } | 1031 | } |
| 1230 | 1032 | ||
| 1231 | /** | ||
| 1232 | * Opens a session with lockdownd and switches to SSL mode if device wants it. | ||
| 1233 | * | ||
| 1234 | * @param client The lockdownd client | ||
| 1235 | * @param host_id The HostID of the computer | ||
| 1236 | * @param session_id The new session_id of the created session | ||
| 1237 | * @param ssl_enabled Whether SSL communication is used in the session | ||
| 1238 | * | ||
| 1239 | * @return LOCKDOWN_E_SUCCESS on success, LOCKDOWN_E_INVALID_ARG when a client | ||
| 1240 | * or host_id is NULL, LOCKDOWN_E_PLIST_ERROR if the response plist had errors, | ||
| 1241 | * LOCKDOWN_E_INVALID_HOST_ID if the device does not know the supplied HostID, | ||
| 1242 | * LOCKDOWN_E_SSL_ERROR if enabling SSL communication failed | ||
| 1243 | */ | ||
| 1244 | lockdownd_error_t lockdownd_start_session(lockdownd_client_t client, const char *host_id, char **session_id, int *ssl_enabled) | 1033 | lockdownd_error_t lockdownd_start_session(lockdownd_client_t client, const char *host_id, char **session_id, int *ssl_enabled) |
| 1245 | { | 1034 | { |
| 1246 | lockdownd_error_t ret = LOCKDOWN_E_SUCCESS; | 1035 | lockdownd_error_t ret = LOCKDOWN_E_SUCCESS; |
| @@ -1345,18 +1134,6 @@ lockdownd_error_t lockdownd_start_session(lockdownd_client_t client, const char | |||
| 1345 | return ret; | 1134 | return ret; |
| 1346 | } | 1135 | } |
| 1347 | 1136 | ||
| 1348 | /** | ||
| 1349 | * Requests to start a service and retrieve it's port on success. | ||
| 1350 | * | ||
| 1351 | * @param client The lockdownd client | ||
| 1352 | * @param identifier The identifier of the service to start | ||
| 1353 | * @param descriptor The service descriptor on success or NULL on failure | ||
| 1354 | |||
| 1355 | * @return LOCKDOWN_E_SUCCESS on success, NP_E_INVALID_ARG if a parameter | ||
| 1356 | * is NULL, LOCKDOWN_E_INVALID_SERVICE if the requested service is not known | ||
| 1357 | * by the device, LOCKDOWN_E_START_SERVICE_FAILED if the service could not because | ||
| 1358 | * started by the device | ||
| 1359 | */ | ||
| 1360 | lockdownd_error_t lockdownd_start_service(lockdownd_client_t client, const char *identifier, lockdownd_service_descriptor_t *service) | 1137 | lockdownd_error_t lockdownd_start_service(lockdownd_client_t client, const char *identifier, lockdownd_service_descriptor_t *service) |
| 1361 | { | 1138 | { |
| 1362 | if (!client || !identifier || !service) | 1139 | if (!client || !identifier || !service) |
| @@ -1442,24 +1219,7 @@ lockdownd_error_t lockdownd_start_service(lockdownd_client_t client, const char | |||
| 1442 | return ret; | 1219 | return ret; |
| 1443 | } | 1220 | } |
| 1444 | 1221 | ||
| 1445 | /** | 1222 | lockdownd_error_t lockdownd_activate(lockdownd_client_t client, plist_t activation_record) |
| 1446 | * Activates the device. Only works within an open session. | ||
| 1447 | * The ActivationRecord plist dictionary must be obtained using the | ||
| 1448 | * activation protocol requesting from Apple's https webservice. | ||
| 1449 | * | ||
| 1450 | * @see http://iphone-docs.org/doku.php?id=docs:protocols:activation | ||
| 1451 | * | ||
| 1452 | * @param client The lockdown client | ||
| 1453 | * @param activation_record The activation record plist dictionary | ||
| 1454 | * | ||
| 1455 | * @return LOCKDOWN_E_SUCCESS on success, NP_E_INVALID_ARG when client or | ||
| 1456 | * activation_record is NULL, LOCKDOWN_E_NO_RUNNING_SESSION if no session is | ||
| 1457 | * open, LOCKDOWN_E_PLIST_ERROR if the received plist is broken, | ||
| 1458 | * LOCKDOWN_E_ACTIVATION_FAILED if the activation failed, | ||
| 1459 | * LOCKDOWN_E_INVALID_ACTIVATION_RECORD if the device reports that the | ||
| 1460 | * activation_record is invalid | ||
| 1461 | */ | ||
| 1462 | lockdownd_error_t lockdownd_activate(lockdownd_client_t client, plist_t activation_record) | ||
| 1463 | { | 1223 | { |
| 1464 | if (!client) | 1224 | if (!client) |
| 1465 | return LOCKDOWN_E_INVALID_ARG; | 1225 | return LOCKDOWN_E_INVALID_ARG; |
| @@ -1510,16 +1270,6 @@ lockdownd_error_t lockdownd_activate(lockdownd_client_t client, plist_t activati | |||
| 1510 | return ret; | 1270 | return ret; |
| 1511 | } | 1271 | } |
| 1512 | 1272 | ||
| 1513 | /** | ||
| 1514 | * Deactivates the device, returning it to the locked “Activate with iTunes” | ||
| 1515 | * screen. | ||
| 1516 | * | ||
| 1517 | * @param client The lockdown client | ||
| 1518 | * | ||
| 1519 | * @return LOCKDOWN_E_SUCCESS on success, NP_E_INVALID_ARG when client is NULL, | ||
| 1520 | * LOCKDOWN_E_NO_RUNNING_SESSION if no session is open, | ||
| 1521 | * LOCKDOWN_E_PLIST_ERROR if the received plist is broken | ||
| 1522 | */ | ||
| 1523 | lockdownd_error_t lockdownd_deactivate(lockdownd_client_t client) | 1273 | lockdownd_error_t lockdownd_deactivate(lockdownd_client_t client) |
| 1524 | { | 1274 | { |
| 1525 | if (!client) | 1275 | if (!client) |
| @@ -1567,19 +1317,6 @@ static void str_remove_spaces(char *source) | |||
| 1567 | *dest = 0; | 1317 | *dest = 0; |
| 1568 | } | 1318 | } |
| 1569 | 1319 | ||
| 1570 | /** | ||
| 1571 | * Calculates and returns the data classes the device supports from lockdownd. | ||
| 1572 | * | ||
| 1573 | * @param client An initialized lockdownd client. | ||
| 1574 | * @param classes A pointer to store an array of class names. The caller is responsible | ||
| 1575 | * for freeing the memory which can be done using mobilesync_data_classes_free(). | ||
| 1576 | * @param count The number of items in the classes array. | ||
| 1577 | * | ||
| 1578 | * @return LOCKDOWN_E_SUCCESS on success, | ||
| 1579 | * LOCKDOWN_E_INVALID_ARG when client is NULL, | ||
| 1580 | * LOCKDOWN_E_NO_RUNNING_SESSION if no session is open, | ||
| 1581 | * LOCKDOWN_E_PLIST_ERROR if the received plist is broken | ||
| 1582 | */ | ||
| 1583 | lockdownd_error_t lockdownd_get_sync_data_classes(lockdownd_client_t client, char ***classes, int *count) | 1320 | lockdownd_error_t lockdownd_get_sync_data_classes(lockdownd_client_t client, char ***classes, int *count) |
| 1584 | { | 1321 | { |
| 1585 | if (!client) | 1322 | if (!client) |
| @@ -1634,13 +1371,6 @@ lockdownd_error_t lockdownd_get_sync_data_classes(lockdownd_client_t client, cha | |||
| 1634 | } | 1371 | } |
| 1635 | 1372 | ||
| 1636 | 1373 | ||
| 1637 | /** | ||
| 1638 | * Frees memory of an allocated array of data classes as returned by lockdownd_get_sync_data_classes() | ||
| 1639 | * | ||
| 1640 | * @param classes An array of class names to free. | ||
| 1641 | * | ||
| 1642 | * @return LOCKDOWN_E_SUCCESS on success | ||
| 1643 | */ | ||
| 1644 | lockdownd_error_t lockdownd_data_classes_free(char **classes) | 1374 | lockdownd_error_t lockdownd_data_classes_free(char **classes) |
| 1645 | { | 1375 | { |
| 1646 | if (classes) { | 1376 | if (classes) { |
| @@ -1653,13 +1383,6 @@ lockdownd_error_t lockdownd_data_classes_free(char **classes) | |||
| 1653 | return LOCKDOWN_E_SUCCESS; | 1383 | return LOCKDOWN_E_SUCCESS; |
| 1654 | } | 1384 | } |
| 1655 | 1385 | ||
| 1656 | /** | ||
| 1657 | * Frees memory of a service descriptor as returned by lockdownd_start_service() | ||
| 1658 | * | ||
| 1659 | * @param sevice A service descriptor instance to free. | ||
| 1660 | * | ||
| 1661 | * @return LOCKDOWN_E_SUCCESS on success | ||
| 1662 | */ | ||
| 1663 | lockdownd_error_t lockdownd_service_descriptor_free(lockdownd_service_descriptor_t service) | 1386 | lockdownd_error_t lockdownd_service_descriptor_free(lockdownd_service_descriptor_t service) |
| 1664 | { | 1387 | { |
| 1665 | if (service) | 1388 | if (service) |
