diff options
Diffstat (limited to 'src/device_link_service.c')
-rw-r--r-- | src/device_link_service.c | 12 |
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; |