summaryrefslogtreecommitdiffstats
path: root/src/installation_proxy.c
diff options
context:
space:
mode:
authorGravatar Aaron Burghardt2014-03-27 10:07:09 -0400
committerGravatar Aaron Burghardt2014-03-27 21:40:43 -0400
commit2342dc5b4ef148b993fbe3816f3facdef8365546 (patch)
tree69f812d91b2fc07db0fad5dcba6c80d2f8b6849e /src/installation_proxy.c
parentee82e861a8c942b5013accd7589cf898d1f97167 (diff)
downloadlibimobiledevice-2342dc5b4ef148b993fbe3816f3facdef8365546.tar.gz
libimobiledevice-2342dc5b4ef148b993fbe3816f3facdef8365546.tar.bz2
Moved Doxygen comments from source files to public headers.
Conflicts: include/libimobiledevice/afc.h
Diffstat (limited to 'src/installation_proxy.c')
-rw-r--r--src/installation_proxy.c232
1 files changed, 0 insertions, 232 deletions
diff --git a/src/installation_proxy.c b/src/installation_proxy.c
index 109df10..e3a8103 100644
--- a/src/installation_proxy.c
+++ b/src/installation_proxy.c
@@ -86,17 +86,6 @@ static instproxy_error_t instproxy_error(property_list_service_error_t err)
86 return INSTPROXY_E_UNKNOWN_ERROR; 86 return INSTPROXY_E_UNKNOWN_ERROR;
87} 87}
88 88
89/**
90 * Connects to the installation_proxy service on the specified device.
91 *
92 * @param device The device to connect to
93 * @param service The service descriptor returned by lockdownd_start_service.
94 * @param client Pointer that will be set to a newly allocated
95 * instproxy_client_t upon successful return.
96 *
97 * @return INSTPROXY_E_SUCCESS on success, or an INSTPROXY_E_* error value
98 * when an error occured.
99 */
100instproxy_error_t instproxy_client_new(idevice_t device, lockdownd_service_descriptor_t service, instproxy_client_t *client) 89instproxy_error_t instproxy_client_new(idevice_t device, lockdownd_service_descriptor_t service, instproxy_client_t *client)
101{ 90{
102 property_list_service_client_t plistclient = NULL; 91 property_list_service_client_t plistclient = NULL;
@@ -114,19 +103,6 @@ instproxy_error_t instproxy_client_new(idevice_t device, lockdownd_service_descr
114 return INSTPROXY_E_SUCCESS; 103 return INSTPROXY_E_SUCCESS;
115} 104}
116 105
117/**
118 * Starts a new installation_proxy service on the specified device and connects to it.
119 *
120 * @param device The device to connect to.
121 * @param client Pointer that will point to a newly allocated
122 * instproxy_client_t upon successful return. Must be freed using
123 * instproxy_client_free() after use.
124 * @param label The label to use for communication. Usually the program name.
125 * Pass NULL to disable sending the label in requests to lockdownd.
126 *
127 * @return INSTPROXY_E_SUCCESS on success, or an INSTPROXY_E_* error
128 * code otherwise.
129 */
130instproxy_error_t instproxy_client_start_service(idevice_t device, instproxy_client_t * client, const char* label) 106instproxy_error_t instproxy_client_start_service(idevice_t device, instproxy_client_t * client, const char* label)
131{ 107{
132 instproxy_error_t err = INSTPROXY_E_UNKNOWN_ERROR; 108 instproxy_error_t err = INSTPROXY_E_UNKNOWN_ERROR;
@@ -134,15 +110,6 @@ instproxy_error_t instproxy_client_start_service(idevice_t device, instproxy_cli
134 return err; 110 return err;
135} 111}
136 112
137/**
138 * Disconnects an installation_proxy client from the device and frees up the
139 * installation_proxy client data.
140 *
141 * @param client The installation_proxy client to disconnect and free.
142 *
143 * @return INSTPROXY_E_SUCCESS on success
144 * or INSTPROXY_E_INVALID_ARG if client is NULL.
145 */
146instproxy_error_t instproxy_client_free(instproxy_client_t client) 113instproxy_error_t instproxy_client_free(instproxy_client_t client)
147{ 114{
148 if (!client) 115 if (!client)
@@ -195,20 +162,6 @@ static instproxy_error_t instproxy_send_command(instproxy_client_t client, const
195 return err; 162 return err;
196} 163}
197 164
198/**
199 * List installed applications. This function runs synchronously.
200 *
201 * @param client The connected installation_proxy client
202 * @param client_options The client options to use, as PLIST_DICT, or NULL.
203 * Valid client options include:
204 * "ApplicationType" -> "User"
205 * "ApplicationType" -> "System"
206 * @param result Pointer that will be set to a plist that will hold an array
207 * of PLIST_DICT holding information about the applications found.
208 *
209 * @return INSTPROXY_E_SUCCESS on success or an INSTPROXY_E_* error value if
210 * an error occured.
211 */
212instproxy_error_t instproxy_browse(instproxy_client_t client, plist_t client_options, plist_t *result) 165instproxy_error_t instproxy_browse(instproxy_client_t client, plist_t client_options, plist_t *result)
213{ 166{
214 if (!client || !client->parent || !result) 167 if (!client || !client->parent || !result)
@@ -461,85 +414,16 @@ static instproxy_error_t instproxy_install_or_upgrade(instproxy_client_t client,
461 return instproxy_create_status_updater(client, status_cb, command, user_data); 414 return instproxy_create_status_updater(client, status_cb, command, user_data);
462} 415}
463 416
464/**
465 * Install an application on the device.
466 *
467 * @param client The connected installation_proxy client
468 * @param pkg_path Path of the installation package (inside the AFC jail)
469 * @param client_options The client options to use, as PLIST_DICT, or NULL.
470 * Valid options include:
471 * "iTunesMetadata" -> PLIST_DATA
472 * "ApplicationSINF" -> PLIST_DATA
473 * "PackageType" -> "Developer"
474 * If PackageType -> Developer is specified, then pkg_path points to
475 * an .app directory instead of an install package.
476 * @param status_cb Callback function for progress and status information. If
477 * NULL is passed, this function will run synchronously.
478 * @param user_data Callback data passed to status_cb.
479 *
480 * @return INSTPROXY_E_SUCCESS on success or an INSTPROXY_E_* error value if
481 * an error occured.
482 *
483 * @note If a callback function is given (async mode), this function returns
484 * INSTPROXY_E_SUCCESS immediately if the status updater thread has been
485 * created successfully; any error occuring during the operation has to be
486 * handled inside the specified callback function.
487 */
488instproxy_error_t instproxy_install(instproxy_client_t client, const char *pkg_path, plist_t client_options, instproxy_status_cb_t status_cb, void *user_data) 417instproxy_error_t instproxy_install(instproxy_client_t client, const char *pkg_path, plist_t client_options, instproxy_status_cb_t status_cb, void *user_data)
489{ 418{
490 return instproxy_install_or_upgrade(client, pkg_path, client_options, status_cb, "Install", user_data); 419 return instproxy_install_or_upgrade(client, pkg_path, client_options, status_cb, "Install", user_data);
491} 420}
492 421
493/**
494 * Upgrade an application on the device. This function is nearly the same as
495 * instproxy_install; the difference is that the installation progress on the
496 * device is faster if the application is already installed.
497 *
498 * @param client The connected installation_proxy client
499 * @param pkg_path Path of the installation package (inside the AFC jail)
500 * @param client_options The client options to use, as PLIST_DICT, or NULL.
501 * Valid options include:
502 * "iTunesMetadata" -> PLIST_DATA
503 * "ApplicationSINF" -> PLIST_DATA
504 * "PackageType" -> "Developer"
505 * If PackageType -> Developer is specified, then pkg_path points to
506 * an .app directory instead of an install package.
507 * @param status_cb Callback function for progress and status information. If
508 * NULL is passed, this function will run synchronously.
509 * @param user_data Callback data passed to status_cb.
510 *
511 * @return INSTPROXY_E_SUCCESS on success or an INSTPROXY_E_* error value if
512 * an error occured.
513 *
514 * @note If a callback function is given (async mode), this function returns
515 * INSTPROXY_E_SUCCESS immediately if the status updater thread has been
516 * created successfully; any error occuring during the operation has to be
517 * handled inside the specified callback function.
518 */
519instproxy_error_t instproxy_upgrade(instproxy_client_t client, const char *pkg_path, plist_t client_options, instproxy_status_cb_t status_cb, void *user_data) 422instproxy_error_t instproxy_upgrade(instproxy_client_t client, const char *pkg_path, plist_t client_options, instproxy_status_cb_t status_cb, void *user_data)
520{ 423{
521 return instproxy_install_or_upgrade(client, pkg_path, client_options, status_cb, "Upgrade", user_data); 424 return instproxy_install_or_upgrade(client, pkg_path, client_options, status_cb, "Upgrade", user_data);
522} 425}
523 426
524/**
525 * Uninstall an application from the device.
526 *
527 * @param client The connected installation proxy client
528 * @param appid ApplicationIdentifier of the app to uninstall
529 * @param client_options The client options to use, as PLIST_DICT, or NULL.
530 * Currently there are no known client options, so pass NULL here.
531 * @param status_cb Callback function for progress and status information. If
532 * NULL is passed, this function will run synchronously.
533 * @param user_data Callback data passed to status_cb.
534 *
535 * @return INSTPROXY_E_SUCCESS on success or an INSTPROXY_E_* error value if
536 * an error occured.
537 *
538 * @note If a callback function is given (async mode), this function returns
539 * INSTPROXY_E_SUCCESS immediately if the status updater thread has been
540 * created successfully; any error occuring during the operation has to be
541 * handled inside the specified callback function.
542 */
543instproxy_error_t instproxy_uninstall(instproxy_client_t client, const char *appid, plist_t client_options, instproxy_status_cb_t status_cb, void *user_data) 427instproxy_error_t instproxy_uninstall(instproxy_client_t client, const char *appid, plist_t client_options, instproxy_status_cb_t status_cb, void *user_data)
544{ 428{
545 if (!client || !client->parent || !appid) { 429 if (!client || !client->parent || !appid) {
@@ -564,20 +448,6 @@ instproxy_error_t instproxy_uninstall(instproxy_client_t client, const char *app
564 return instproxy_create_status_updater(client, status_cb, "Uninstall", user_data); 448 return instproxy_create_status_updater(client, status_cb, "Uninstall", user_data);
565} 449}
566 450
567/**
568 * List archived applications. This function runs synchronously.
569 *
570 * @see instproxy_archive
571 *
572 * @param client The connected installation_proxy client
573 * @param client_options The client options to use, as PLIST_DICT, or NULL.
574 * Currently there are no known client options, so pass NULL here.
575 * @param result Pointer that will be set to a plist containing a PLIST_DICT
576 * holding information about the archived applications found.
577 *
578 * @return INSTPROXY_E_SUCCESS on success or an INSTPROXY_E_* error value if
579 * an error occured.
580 */
581instproxy_error_t instproxy_lookup_archives(instproxy_client_t client, plist_t client_options, plist_t *result) 451instproxy_error_t instproxy_lookup_archives(instproxy_client_t client, plist_t client_options, plist_t *result)
582{ 452{
583 if (!client || !client->parent || !result) 453 if (!client || !client->parent || !result)
@@ -604,30 +474,6 @@ leave_unlock:
604 return res; 474 return res;
605} 475}
606 476
607/**
608 * Archive an application on the device.
609 * This function tells the device to make an archive of the specified
610 * application. This results in the device creating a ZIP archive in the
611 * 'ApplicationArchives' directory and uninstalling the application.
612 *
613 * @param client The connected installation proxy client
614 * @param appid ApplicationIdentifier of the app to archive.
615 * @param client_options The client options to use, as PLIST_DICT, or NULL.
616 * Valid options include:
617 * "SkipUninstall" -> Boolean
618 * "ArchiveType" -> "ApplicationOnly"
619 * @param status_cb Callback function for progress and status information. If
620 * NULL is passed, this function will run synchronously.
621 * @param user_data Callback data passed to status_cb.
622 *
623 * @return INSTPROXY_E_SUCCESS on success or an INSTPROXY_E_* error value if
624 * an error occured.
625 *
626 * @note If a callback function is given (async mode), this function returns
627 * INSTPROXY_E_SUCCESS immediately if the status updater thread has been
628 * created successfully; any error occuring during the operation has to be
629 * handled inside the specified callback function.
630 */
631instproxy_error_t instproxy_archive(instproxy_client_t client, const char *appid, plist_t client_options, instproxy_status_cb_t status_cb, void *user_data) 477instproxy_error_t instproxy_archive(instproxy_client_t client, const char *appid, plist_t client_options, instproxy_status_cb_t status_cb, void *user_data)
632{ 478{
633 if (!client || !client->parent || !appid) 479 if (!client || !client->parent || !appid)
@@ -648,27 +494,6 @@ instproxy_error_t instproxy_archive(instproxy_client_t client, const char *appid
648 return instproxy_create_status_updater(client, status_cb, "Archive", user_data); 494 return instproxy_create_status_updater(client, status_cb, "Archive", user_data);
649} 495}
650 496
651/**
652 * Restore a previously archived application on the device.
653 * This function is the counterpart to instproxy_archive.
654 * @see instproxy_archive
655 *
656 * @param client The connected installation proxy client
657 * @param appid ApplicationIdentifier of the app to restore.
658 * @param client_options The client options to use, as PLIST_DICT, or NULL.
659 * Currently there are no known client options, so pass NULL here.
660 * @param status_cb Callback function for progress and status information. If
661 * NULL is passed, this function will run synchronously.
662 * @param user_data Callback data passed to status_cb.
663 *
664 * @return INSTPROXY_E_SUCCESS on success or an INSTPROXY_E_* error value if
665 * an error occured.
666 *
667 * @note If a callback function is given (async mode), this function returns
668 * INSTPROXY_E_SUCCESS immediately if the status updater thread has been
669 * created successfully; any error occuring during the operation has to be
670 * handled inside the specified callback function.
671 */
672instproxy_error_t instproxy_restore(instproxy_client_t client, const char *appid, plist_t client_options, instproxy_status_cb_t status_cb, void *user_data) 497instproxy_error_t instproxy_restore(instproxy_client_t client, const char *appid, plist_t client_options, instproxy_status_cb_t status_cb, void *user_data)
673{ 498{
674 if (!client || !client->parent || !appid) 499 if (!client || !client->parent || !appid)
@@ -689,27 +514,6 @@ instproxy_error_t instproxy_restore(instproxy_client_t client, const char *appid
689 return instproxy_create_status_updater(client, status_cb, "Restore", user_data); 514 return instproxy_create_status_updater(client, status_cb, "Restore", user_data);
690} 515}
691 516
692/**
693 * Removes a previously archived application from the device.
694 * This function removes the ZIP archive from the 'ApplicationArchives'
695 * directory.
696 *
697 * @param client The connected installation proxy client
698 * @param appid ApplicationIdentifier of the archived app to remove.
699 * @param client_options The client options to use, as PLIST_DICT, or NULL.
700 * Currently there are no known client options, so passing NULL is fine.
701 * @param status_cb Callback function for progress and status information. If
702 * NULL is passed, this function will run synchronously.
703 * @param user_data Callback data passed to status_cb.
704 *
705 * @return INSTPROXY_E_SUCCESS on success or an INSTPROXY_E_* error value if
706 * an error occured.
707 *
708 * @note If a callback function is given (async mode), this function returns
709 * INSTPROXY_E_SUCCESS immediately if the status updater thread has been
710 * created successfully; any error occuring during the operation has to be
711 * handled inside the specified callback function.
712 */
713instproxy_error_t instproxy_remove_archive(instproxy_client_t client, const char *appid, plist_t client_options, instproxy_status_cb_t status_cb, void *user_data) 517instproxy_error_t instproxy_remove_archive(instproxy_client_t client, const char *appid, plist_t client_options, instproxy_status_cb_t status_cb, void *user_data)
714{ 518{
715 if (!client || !client->parent || !appid) 519 if (!client || !client->parent || !appid)
@@ -730,26 +534,11 @@ instproxy_error_t instproxy_remove_archive(instproxy_client_t client, const char
730 return instproxy_create_status_updater(client, status_cb, "RemoveArchive", user_data); 534 return instproxy_create_status_updater(client, status_cb, "RemoveArchive", user_data);
731} 535}
732 536
733/**
734 * Create a new client_options plist.
735 *
736 * @return A new plist_t of type PLIST_DICT.
737 */
738plist_t instproxy_client_options_new() 537plist_t instproxy_client_options_new()
739{ 538{
740 return plist_new_dict(); 539 return plist_new_dict();
741} 540}
742 541
743/**
744 * Add one or more new key:value pairs to the given client_options.
745 *
746 * @param client_options The client options to modify.
747 * @param ... KEY, VALUE, [KEY, VALUE], NULL
748 *
749 * @note The keys and values passed are expected to be strings, except for the
750 * keys "ApplicationSINF", "iTunesMetadata", "ReturnAttributes" which are
751 * expecting a plist_t node as value and "SkipUninstall" expects int.
752 */
753void instproxy_client_options_add(plist_t client_options, ...) 542void instproxy_client_options_add(plist_t client_options, ...)
754{ 543{
755 if (!client_options) 544 if (!client_options)
@@ -783,12 +572,6 @@ void instproxy_client_options_add(plist_t client_options, ...)
783 va_end(args); 572 va_end(args);
784} 573}
785 574
786/**
787 * Free client_options plist.
788 *
789 * @param client_options The client options plist to free. Does nothing if NULL
790 * is passed.
791 */
792void instproxy_client_options_free(plist_t client_options) 575void instproxy_client_options_free(plist_t client_options)
793{ 576{
794 if (client_options) { 577 if (client_options) {
@@ -796,21 +579,6 @@ void instproxy_client_options_free(plist_t client_options)
796 } 579 }
797} 580}
798 581
799/**
800 * Query the device for the path of an application.
801 *
802 * @param client The connected installation proxy client.
803 * @param appid ApplicationIdentifier of app to retrieve the path for.
804 * @param path Pointer to store the device path for the application
805 * which is set to NULL if it could not be determined.
806 *
807 * @return INSTPROXY_E_SUCCESS on success, INSTPROXY_E_OP_FAILED if
808 * the path could not be determined or an INSTPROXY_E_* error
809 * value if an error occured.
810 *
811 * @note This implementation browses all applications and matches the
812 * right entry by the application identifier.
813 */
814instproxy_error_t instproxy_client_get_path_for_bundle_identifier(instproxy_client_t client, const char* appid, char** path) 582instproxy_error_t instproxy_client_get_path_for_bundle_identifier(instproxy_client_t client, const char* appid, char** path)
815{ 583{
816 if (!client || !client->parent || !appid) 584 if (!client || !client->parent || !appid)