diff options
author | Martin Szulecki | 2013-02-26 03:20:56 +0100 |
---|---|---|
committer | Martin Szulecki | 2013-02-26 03:20:56 +0100 |
commit | fcc1bb855efb6860417ed827d3b50feba24a9a8b (patch) | |
tree | 47d3c7d6a985dc647f7962329014c8116d657cc9 /src/property_list_service.c | |
parent | 3b54aac30447bc02fafd721a63a752968628e7e0 (diff) | |
download | libimobiledevice-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/property_list_service.c')
-rw-r--r-- | src/property_list_service.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/property_list_service.c b/src/property_list_service.c index c9a8edf..15adbc8 100644 --- a/src/property_list_service.c +++ b/src/property_list_service.c @@ -57,8 +57,7 @@ static property_list_service_error_t idevice_to_property_list_service_error(idev * Creates a new property list service for the specified port. * * @param device The device to connect to. - * @param port The port on the device to connect to, usually opened by a call to - * lockdownd_start_service. + * @param service The service descriptor returned by lockdownd_start_service. * @param client Pointer that will be set to a newly allocated * property_list_service_client_t upon successful return. * @@ -66,14 +65,14 @@ static property_list_service_error_t idevice_to_property_list_service_error(idev * PROPERTY_LIST_SERVICE_E_INVALID_ARG when one of the arguments is invalid, * or PROPERTY_LIST_SERVICE_E_MUX_ERROR when connecting to the device failed. */ -property_list_service_error_t property_list_service_client_new(idevice_t device, uint16_t port, property_list_service_client_t *client) +property_list_service_error_t property_list_service_client_new(idevice_t device, lockdownd_service_descriptor_t service, property_list_service_client_t *client) { - if (!device || port == 0 || !client || *client) + if (!device || (service->port == 0) || !client || *client) return PROPERTY_LIST_SERVICE_E_INVALID_ARG; /* Attempt connection */ idevice_connection_t connection = NULL; - if (idevice_connect(device, port, &connection) != IDEVICE_E_SUCCESS) { + if (idevice_connect(device, service->port, &connection) != IDEVICE_E_SUCCESS) { return PROPERTY_LIST_SERVICE_E_MUX_ERROR; } @@ -81,8 +80,12 @@ property_list_service_error_t property_list_service_client_new(idevice_t device, property_list_service_client_t client_loc = (property_list_service_client_t)malloc(sizeof(struct property_list_service_client_private)); client_loc->connection = connection; - *client = client_loc; + /* enable SSL if requested */ + if (service->ssl_enabled == 1) + property_list_service_enable_ssl(client_loc); + /* all done, return success */ + *client = client_loc; return PROPERTY_LIST_SERVICE_E_SUCCESS; } |