diff options
| author | 2013-02-26 03:20:56 +0100 | |
|---|---|---|
| committer | 2013-02-26 03:20:56 +0100 | |
| commit | fcc1bb855efb6860417ed827d3b50feba24a9a8b (patch) | |
| tree | 47d3c7d6a985dc647f7962329014c8116d657cc9 /src/afc.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/afc.c')
| -rw-r--r-- | src/afc.c | 12 | 
1 files changed, 8 insertions, 4 deletions
| @@ -119,7 +119,7 @@ afc_error_t afc_client_new_from_connection(idevice_connection_t connection, afc_   * @see afc_client_new_from_connection   *    * @param device The device to connect to. - * @param port The destination port. + * @param service The service descriptor returned by lockdownd_start_service.   * @param client Pointer that will be set to a newly allocated afc_client_t   *     upon successful return.   *  @@ -127,17 +127,21 @@ afc_error_t afc_client_new_from_connection(idevice_connection_t connection, afc_   *  invalid, AFC_E_MUX_ERROR if the connection cannot be established,   *  or AFC_E_NO_MEM if there is a memory allocation problem.   */ -afc_error_t afc_client_new(idevice_t device, uint16_t port, afc_client_t * client) +afc_error_t afc_client_new(idevice_t device, lockdownd_service_descriptor_t service, afc_client_t * client)  { -	if (!device || port==0) +	if (!device || service->port == 0)  		return AFC_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 AFC_E_MUX_ERROR;  	} +	/* enable SSL if requested */ +	if (service->ssl_enabled) +		idevice_connection_enable_ssl(connection); +  	afc_error_t err = afc_client_new_from_connection(connection, client);  	if (err != AFC_E_SUCCESS) {  		idevice_disconnect(connection); | 
