summaryrefslogtreecommitdiffstats
path: root/src/device_link_service.c
diff options
context:
space:
mode:
authorGravatar Martin Szulecki2013-02-26 03:20:56 +0100
committerGravatar Martin Szulecki2013-02-26 03:20:56 +0100
commitfcc1bb855efb6860417ed827d3b50feba24a9a8b (patch)
tree47d3c7d6a985dc647f7962329014c8116d657cc9 /src/device_link_service.c
parent3b54aac30447bc02fafd721a63a752968628e7e0 (diff)
downloadlibimobiledevice-fcc1bb855efb6860417ed827d3b50feba24a9a8b.tar.gz
libimobiledevice-fcc1bb855efb6860417ed827d3b50feba24a9a8b.tar.bz2
Refactor port number use into service descriptor to enable SSL for services
This is a major change which breaks API but is required in order to support SSL communication for services as used by network connections.
Diffstat (limited to 'src/device_link_service.c')
-rw-r--r--src/device_link_service.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/device_link_service.c b/src/device_link_service.c
index 5825f0c..ac89211 100644
--- a/src/device_link_service.c
+++ b/src/device_link_service.c
@@ -74,7 +74,7 @@ static int device_link_service_get_message(plist_t dl_msg, char **message)
* Creates a new device link service client.
*
* @param device The device to connect to.
- * @param port Port on device to connect to.
+ * @param service The service descriptor returned by lockdownd_start_service.
* @param client Reference that will point to a newly allocated
* device_link_service_client_t upon successful return.
*
@@ -82,14 +82,14 @@ static int device_link_service_get_message(plist_t dl_msg, char **message)
* DEVICE_LINK_SERVICE_E_INVALID_ARG when one of the parameters is invalid,
* or DEVICE_LINK_SERVICE_E_MUX_ERROR when the connection failed.
*/
-device_link_service_error_t device_link_service_client_new(idevice_t device, uint16_t port, device_link_service_client_t *client)
+device_link_service_error_t device_link_service_client_new(idevice_t device, lockdownd_service_descriptor_t service, device_link_service_client_t *client)
{
- if (!device || port == 0 || !client || *client) {
+ if (!device || service->port == 0 || !client || *client) {
return DEVICE_LINK_SERVICE_E_INVALID_ARG;
}
property_list_service_client_t plistclient = NULL;
- if (property_list_service_client_new(device, port, &plistclient) != PROPERTY_LIST_SERVICE_E_SUCCESS) {
+ if (property_list_service_client_new(device, service, &plistclient) != PROPERTY_LIST_SERVICE_E_SUCCESS) {
return DEVICE_LINK_SERVICE_E_MUX_ERROR;
}
@@ -97,6 +97,10 @@ device_link_service_error_t device_link_service_client_new(idevice_t device, uin
device_link_service_client_t client_loc = (device_link_service_client_t) malloc(sizeof(struct device_link_service_client_private));
client_loc->parent = plistclient;
+ /* enable SSL if requested */
+ if (service->ssl_enabled)
+ property_list_service_enable_ssl(client_loc->parent);
+
/* all done, return success */
*client = client_loc;
return DEVICE_LINK_SERVICE_E_SUCCESS;