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)
74 * Creates a new device link service client. 74 * Creates a new device link service client.
75 * 75 *
76 * @param device The device to connect to. 76 * @param device The device to connect to.
77 * @param port Port on device to connect to. 77 * @param service The service descriptor returned by lockdownd_start_service.
78 * @param client Reference that will point to a newly allocated 78 * @param client Reference that will point to a newly allocated
79 * device_link_service_client_t upon successful return. 79 * device_link_service_client_t upon successful return.
80 * 80 *
@@ -82,14 +82,14 @@ static int device_link_service_get_message(plist_t dl_msg, char **message)
82 * DEVICE_LINK_SERVICE_E_INVALID_ARG when one of the parameters is invalid, 82 * DEVICE_LINK_SERVICE_E_INVALID_ARG when one of the parameters is invalid,
83 * or DEVICE_LINK_SERVICE_E_MUX_ERROR when the connection failed. 83 * or DEVICE_LINK_SERVICE_E_MUX_ERROR when the connection failed.
84 */ 84 */
85device_link_service_error_t device_link_service_client_new(idevice_t device, uint16_t port, device_link_service_client_t *client) 85device_link_service_error_t device_link_service_client_new(idevice_t device, lockdownd_service_descriptor_t service, device_link_service_client_t *client)
86{ 86{
87 if (!device || port == 0 || !client || *client) { 87 if (!device || service->port == 0 || !client || *client) {
88 return DEVICE_LINK_SERVICE_E_INVALID_ARG; 88 return DEVICE_LINK_SERVICE_E_INVALID_ARG;
89 } 89 }
90 90
91 property_list_service_client_t plistclient = NULL; 91 property_list_service_client_t plistclient = NULL;
92 if (property_list_service_client_new(device, port, &plistclient) != PROPERTY_LIST_SERVICE_E_SUCCESS) { 92 if (property_list_service_client_new(device, service, &plistclient) != PROPERTY_LIST_SERVICE_E_SUCCESS) {
93 return DEVICE_LINK_SERVICE_E_MUX_ERROR; 93 return DEVICE_LINK_SERVICE_E_MUX_ERROR;
94 } 94 }
95 95
@@ -97,6 +97,10 @@ device_link_service_error_t device_link_service_client_new(idevice_t device, uin
97 device_link_service_client_t client_loc = (device_link_service_client_t) malloc(sizeof(struct device_link_service_client_private)); 97 device_link_service_client_t client_loc = (device_link_service_client_t) malloc(sizeof(struct device_link_service_client_private));
98 client_loc->parent = plistclient; 98 client_loc->parent = plistclient;
99 99
100 /* enable SSL if requested */
101 if (service->ssl_enabled)
102 property_list_service_enable_ssl(client_loc->parent);
103
100 /* all done, return success */ 104 /* all done, return success */
101 *client = client_loc; 105 *client = client_loc;
102 return DEVICE_LINK_SERVICE_E_SUCCESS; 106 return DEVICE_LINK_SERVICE_E_SUCCESS;