summaryrefslogtreecommitdiffstats
path: root/src/property_list_service.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/property_list_service.c')
-rw-r--r--src/property_list_service.c34
1 files changed, 17 insertions, 17 deletions
diff --git a/src/property_list_service.c b/src/property_list_service.c
index dbf02d6..68aa455 100644
--- a/src/property_list_service.c
+++ b/src/property_list_service.c
@@ -24,26 +24,26 @@
24#include <arpa/inet.h> 24#include <arpa/inet.h>
25 25
26#include "property_list_service.h" 26#include "property_list_service.h"
27#include "iphone.h" 27#include "idevice.h"
28#include "debug.h" 28#include "debug.h"
29 29
30/** 30/**
31 * Convert an iphone_error_t value to an property_list_service_error_t value. 31 * Convert an idevice_error_t value to an property_list_service_error_t value.
32 * Used internally to get correct error codes. 32 * Used internally to get correct error codes.
33 * 33 *
34 * @param err An iphone_error_t error code 34 * @param err An idevice_error_t error code
35 * 35 *
36 * @return A matching property_list_service_error_t error code, 36 * @return A matching property_list_service_error_t error code,
37 * PROPERTY_LIST_SERVICE_E_UNKNOWN_ERROR otherwise. 37 * PROPERTY_LIST_SERVICE_E_UNKNOWN_ERROR otherwise.
38 */ 38 */
39static property_list_service_error_t iphone_to_property_list_service_error(iphone_error_t err) 39static property_list_service_error_t idevice_to_property_list_service_error(idevice_error_t err)
40{ 40{
41 switch (err) { 41 switch (err) {
42 case IPHONE_E_SUCCESS: 42 case IDEVICE_E_SUCCESS:
43 return PROPERTY_LIST_SERVICE_E_SUCCESS; 43 return PROPERTY_LIST_SERVICE_E_SUCCESS;
44 case IPHONE_E_INVALID_ARG: 44 case IDEVICE_E_INVALID_ARG:
45 return PROPERTY_LIST_SERVICE_E_INVALID_ARG; 45 return PROPERTY_LIST_SERVICE_E_INVALID_ARG;
46 case IPHONE_E_SSL_ERROR: 46 case IDEVICE_E_SSL_ERROR:
47 return PROPERTY_LIST_SERVICE_E_SSL_ERROR; 47 return PROPERTY_LIST_SERVICE_E_SSL_ERROR;
48 default: 48 default:
49 break; 49 break;
@@ -64,14 +64,14 @@ static property_list_service_error_t iphone_to_property_list_service_error(iphon
64 * PROPERTY_LIST_SERVICE_E_INVALID_ARG when one of the arguments is invalid, 64 * PROPERTY_LIST_SERVICE_E_INVALID_ARG when one of the arguments is invalid,
65 * or PROPERTY_LIST_SERVICE_E_MUX_ERROR when connecting to the device failed. 65 * or PROPERTY_LIST_SERVICE_E_MUX_ERROR when connecting to the device failed.
66 */ 66 */
67property_list_service_error_t property_list_service_client_new(iphone_device_t device, uint16_t port, property_list_service_client_t *client) 67property_list_service_error_t property_list_service_client_new(idevice_t device, uint16_t port, property_list_service_client_t *client)
68{ 68{
69 if (!device || port == 0 || !client || *client) 69 if (!device || port == 0 || !client || *client)
70 return PROPERTY_LIST_SERVICE_E_INVALID_ARG; 70 return PROPERTY_LIST_SERVICE_E_INVALID_ARG;
71 71
72 /* Attempt connection */ 72 /* Attempt connection */
73 iphone_connection_t connection = NULL; 73 idevice_connection_t connection = NULL;
74 if (iphone_device_connect(device, port, &connection) != IPHONE_E_SUCCESS) { 74 if (idevice_connect(device, port, &connection) != IDEVICE_E_SUCCESS) {
75 return PROPERTY_LIST_SERVICE_E_MUX_ERROR; 75 return PROPERTY_LIST_SERVICE_E_MUX_ERROR;
76 } 76 }
77 77
@@ -98,7 +98,7 @@ property_list_service_error_t property_list_service_client_free(property_list_se
98 if (!client) 98 if (!client)
99 return PROPERTY_LIST_SERVICE_E_INVALID_ARG; 99 return PROPERTY_LIST_SERVICE_E_INVALID_ARG;
100 100
101 property_list_service_error_t err = iphone_to_property_list_service_error(iphone_device_disconnect(client->connection)); 101 property_list_service_error_t err = idevice_to_property_list_service_error(idevice_disconnect(client->connection));
102 free(client); 102 free(client);
103 return err; 103 return err;
104} 104}
@@ -141,9 +141,9 @@ static property_list_service_error_t internal_plist_send(property_list_service_c
141 141
142 nlen = htonl(length); 142 nlen = htonl(length);
143 debug_info("sending %d bytes", length); 143 debug_info("sending %d bytes", length);
144 iphone_connection_send(client->connection, (const char*)&nlen, sizeof(nlen), (uint32_t*)&bytes); 144 idevice_connection_send(client->connection, (const char*)&nlen, sizeof(nlen), (uint32_t*)&bytes);
145 if (bytes == sizeof(nlen)) { 145 if (bytes == sizeof(nlen)) {
146 iphone_connection_send(client->connection, content, length, (uint32_t*)&bytes); 146 idevice_connection_send(client->connection, content, length, (uint32_t*)&bytes);
147 if (bytes > 0) { 147 if (bytes > 0) {
148 debug_info("sent %d bytes", bytes); 148 debug_info("sent %d bytes", bytes);
149 debug_plist(plist); 149 debug_plist(plist);
@@ -221,7 +221,7 @@ static property_list_service_error_t internal_plist_receive_timeout(property_lis
221 return PROPERTY_LIST_SERVICE_E_INVALID_ARG; 221 return PROPERTY_LIST_SERVICE_E_INVALID_ARG;
222 } 222 }
223 223
224 iphone_connection_receive_timeout(client->connection, (char*)&pktlen, sizeof(pktlen), &bytes, timeout); 224 idevice_connection_receive_timeout(client->connection, (char*)&pktlen, sizeof(pktlen), &bytes, timeout);
225 debug_info("initial read=%i", bytes); 225 debug_info("initial read=%i", bytes);
226 if (bytes < 4) { 226 if (bytes < 4) {
227 debug_info("initial read failed!"); 227 debug_info("initial read failed!");
@@ -235,7 +235,7 @@ static property_list_service_error_t internal_plist_receive_timeout(property_lis
235 content = (char*)malloc(pktlen); 235 content = (char*)malloc(pktlen);
236 236
237 while (curlen < pktlen) { 237 while (curlen < pktlen) {
238 iphone_connection_receive(client->connection, content+curlen, pktlen-curlen, &bytes); 238 idevice_connection_receive(client->connection, content+curlen, pktlen-curlen, &bytes);
239 if (bytes <= 0) { 239 if (bytes <= 0) {
240 res = PROPERTY_LIST_SERVICE_E_MUX_ERROR; 240 res = PROPERTY_LIST_SERVICE_E_MUX_ERROR;
241 break; 241 break;
@@ -324,7 +324,7 @@ property_list_service_error_t property_list_service_enable_ssl(property_list_ser
324{ 324{
325 if (!client || !client->connection) 325 if (!client || !client->connection)
326 return PROPERTY_LIST_SERVICE_E_INVALID_ARG; 326 return PROPERTY_LIST_SERVICE_E_INVALID_ARG;
327 return iphone_to_property_list_service_error(iphone_connection_enable_ssl(client->connection)); 327 return idevice_to_property_list_service_error(idevice_connection_enable_ssl(client->connection));
328} 328}
329 329
330/** 330/**
@@ -341,6 +341,6 @@ property_list_service_error_t property_list_service_disable_ssl(property_list_se
341{ 341{
342 if (!client || !client->connection) 342 if (!client || !client->connection)
343 return PROPERTY_LIST_SERVICE_E_INVALID_ARG; 343 return PROPERTY_LIST_SERVICE_E_INVALID_ARG;
344 return iphone_to_property_list_service_error(iphone_connection_disable_ssl(client->connection)); 344 return idevice_to_property_list_service_error(idevice_connection_disable_ssl(client->connection));
345} 345}
346 346