summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/libimobiledevice/mobilebackup.h20
-rw-r--r--include/libimobiledevice/mobilebackup2.h12
-rw-r--r--include/libimobiledevice/mobilesync.h14
-rw-r--r--include/libimobiledevice/screenshotr.h18
-rw-r--r--src/device_link_service.c91
-rw-r--r--src/device_link_service.h22
-rw-r--r--src/mobilebackup.c5
-rw-r--r--src/mobilebackup.h1
-rw-r--r--src/mobilebackup2.c6
-rw-r--r--src/mobilebackup2.h2
-rw-r--r--src/mobilesync.c4
-rw-r--r--src/screenshotr.c6
12 files changed, 117 insertions, 84 deletions
diff --git a/include/libimobiledevice/mobilebackup.h b/include/libimobiledevice/mobilebackup.h
index 6da3bed..f22150d 100644
--- a/include/libimobiledevice/mobilebackup.h
+++ b/include/libimobiledevice/mobilebackup.h
@@ -3,8 +3,8 @@
3 * @brief Backup and restore of all device data. 3 * @brief Backup and restore of all device data.
4 * \internal 4 * \internal
5 * 5 *
6 * Copyright (c) 2009-2014 Martin Szulecki All Rights Reserved. 6 * Copyright (c) 2010-2019 Nikias Bassen, All Rights Reserved.
7 * Copyright (c) 2010 Nikias Bassen All Rights Reserved. 7 * Copyright (c) 2009-2014 Martin Szulecki, All Rights Reserved.
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public 10 * modify it under the terms of the GNU Lesser General Public
@@ -35,13 +35,15 @@ extern "C" {
35 35
36/** Error Codes */ 36/** Error Codes */
37typedef enum { 37typedef enum {
38 MOBILEBACKUP_E_SUCCESS = 0, 38 MOBILEBACKUP_E_SUCCESS = 0,
39 MOBILEBACKUP_E_INVALID_ARG = -1, 39 MOBILEBACKUP_E_INVALID_ARG = -1,
40 MOBILEBACKUP_E_PLIST_ERROR = -2, 40 MOBILEBACKUP_E_PLIST_ERROR = -2,
41 MOBILEBACKUP_E_MUX_ERROR = -3, 41 MOBILEBACKUP_E_MUX_ERROR = -3,
42 MOBILEBACKUP_E_BAD_VERSION = -4, 42 MOBILEBACKUP_E_SSL_ERROR = -4,
43 MOBILEBACKUP_E_REPLY_NOT_OK = -5, 43 MOBILEBACKUP_E_RECEIVE_TIMEOUT = -5,
44 MOBILEBACKUP_E_UNKNOWN_ERROR = -256 44 MOBILEBACKUP_E_BAD_VERSION = -6,
45 MOBILEBACKUP_E_REPLY_NOT_OK = -7,
46 MOBILEBACKUP_E_UNKNOWN_ERROR = -256
45} mobilebackup_error_t; 47} mobilebackup_error_t;
46 48
47typedef struct mobilebackup_client_private mobilebackup_client_private; 49typedef struct mobilebackup_client_private mobilebackup_client_private;
diff --git a/include/libimobiledevice/mobilebackup2.h b/include/libimobiledevice/mobilebackup2.h
index 0c42334..239c807 100644
--- a/include/libimobiledevice/mobilebackup2.h
+++ b/include/libimobiledevice/mobilebackup2.h
@@ -3,8 +3,8 @@
3 * @brief Backup and restore of all device data (mobilebackup2, iOS4+ only) 3 * @brief Backup and restore of all device data (mobilebackup2, iOS4+ only)
4 * \internal 4 * \internal
5 * 5 *
6 * Copyright (c) 2011-2014 Martin Szulecki All Rights Reserved. 6 * Copyright (c) 2010-2019 Nikias Bassen, All Rights Reserved.
7 * Copyright (c) 2010-2012 Nikias Bassen All Rights Reserved. 7 * Copyright (c) 2011-2014 Martin Szulecki, All Rights Reserved.
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public 10 * modify it under the terms of the GNU Lesser General Public
@@ -39,9 +39,11 @@ typedef enum {
39 MOBILEBACKUP2_E_INVALID_ARG = -1, 39 MOBILEBACKUP2_E_INVALID_ARG = -1,
40 MOBILEBACKUP2_E_PLIST_ERROR = -2, 40 MOBILEBACKUP2_E_PLIST_ERROR = -2,
41 MOBILEBACKUP2_E_MUX_ERROR = -3, 41 MOBILEBACKUP2_E_MUX_ERROR = -3,
42 MOBILEBACKUP2_E_BAD_VERSION = -4, 42 MOBILEBACKUP2_E_SSL_ERROR = -4,
43 MOBILEBACKUP2_E_REPLY_NOT_OK = -5, 43 MOBILEBACKUP2_E_RECEIVE_TIMEOUT = -5,
44 MOBILEBACKUP2_E_NO_COMMON_VERSION = -6, 44 MOBILEBACKUP2_E_BAD_VERSION = -6,
45 MOBILEBACKUP2_E_REPLY_NOT_OK = -7,
46 MOBILEBACKUP2_E_NO_COMMON_VERSION = -8,
45 MOBILEBACKUP2_E_UNKNOWN_ERROR = -256 47 MOBILEBACKUP2_E_UNKNOWN_ERROR = -256
46} mobilebackup2_error_t; 48} mobilebackup2_error_t;
47 49
diff --git a/include/libimobiledevice/mobilesync.h b/include/libimobiledevice/mobilesync.h
index e6885c7..005ef3f 100644
--- a/include/libimobiledevice/mobilesync.h
+++ b/include/libimobiledevice/mobilesync.h
@@ -3,8 +3,8 @@
3 * @brief Synchronize data classes with a device and computer. 3 * @brief Synchronize data classes with a device and computer.
4 * \internal 4 * \internal
5 * 5 *
6 * Copyright (c) 2010-2019 Nikias Bassen, All Rights Reserved.
6 * Copyright (c) 2010-2014 Martin Szulecki All Rights Reserved. 7 * Copyright (c) 2010-2014 Martin Szulecki All Rights Reserved.
7 * Copyright (c) 2010-2011 Nikias Bassen All Rights Reserved.
8 * Copyright (c) 2014 Christophe Fergeau All Rights Reserved. 8 * Copyright (c) 2014 Christophe Fergeau All Rights Reserved.
9 * Copyright (c) 2010 Bryan Forbes All Rights Reserved. 9 * Copyright (c) 2010 Bryan Forbes All Rights Reserved.
10 * Copyright (c) 2009 Jonathan Beck All Rights Reserved. 10 * Copyright (c) 2009 Jonathan Beck All Rights Reserved.
@@ -42,11 +42,13 @@ typedef enum {
42 MOBILESYNC_E_INVALID_ARG = -1, 42 MOBILESYNC_E_INVALID_ARG = -1,
43 MOBILESYNC_E_PLIST_ERROR = -2, 43 MOBILESYNC_E_PLIST_ERROR = -2,
44 MOBILESYNC_E_MUX_ERROR = -3, 44 MOBILESYNC_E_MUX_ERROR = -3,
45 MOBILESYNC_E_BAD_VERSION = -4, 45 MOBILESYNC_E_SSL_ERROR = -4,
46 MOBILESYNC_E_SYNC_REFUSED = -5, 46 MOBILESYNC_E_RECEIVE_TIMEOUT = -5,
47 MOBILESYNC_E_CANCELLED = -6, 47 MOBILESYNC_E_BAD_VERSION = -6,
48 MOBILESYNC_E_WRONG_DIRECTION = -7, 48 MOBILESYNC_E_SYNC_REFUSED = -7,
49 MOBILESYNC_E_NOT_READY = -8, 49 MOBILESYNC_E_CANCELLED = -8,
50 MOBILESYNC_E_WRONG_DIRECTION = -9,
51 MOBILESYNC_E_NOT_READY = -10,
50 MOBILESYNC_E_UNKNOWN_ERROR = -256 52 MOBILESYNC_E_UNKNOWN_ERROR = -256
51} mobilesync_error_t; 53} mobilesync_error_t;
52 54
diff --git a/include/libimobiledevice/screenshotr.h b/include/libimobiledevice/screenshotr.h
index c12646b..83ca96b 100644
--- a/include/libimobiledevice/screenshotr.h
+++ b/include/libimobiledevice/screenshotr.h
@@ -4,8 +4,8 @@
4 * @note Requires a mounted developer image. 4 * @note Requires a mounted developer image.
5 * \internal 5 * \internal
6 * 6 *
7 * Copyright (c) 2010-2014 Martin Szulecki All Rights Reserved. 7 * Copyright (c) 2010-2019 Nikias Bassen, All Rights Reserved.
8 * Copyright (c) 2010 Nikias Bassen All Rights Reserved. 8 * Copyright (c) 2010-2014 Martin Szulecki, All Rights Reserved.
9 * 9 *
10 * This library is free software; you can redistribute it and/or 10 * This library is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU Lesser General Public 11 * modify it under the terms of the GNU Lesser General Public
@@ -36,12 +36,14 @@ extern "C" {
36 36
37/** Error Codes */ 37/** Error Codes */
38typedef enum { 38typedef enum {
39 SCREENSHOTR_E_SUCCESS = 0, 39 SCREENSHOTR_E_SUCCESS = 0,
40 SCREENSHOTR_E_INVALID_ARG = -1, 40 SCREENSHOTR_E_INVALID_ARG = -1,
41 SCREENSHOTR_E_PLIST_ERROR = -2, 41 SCREENSHOTR_E_PLIST_ERROR = -2,
42 SCREENSHOTR_E_MUX_ERROR = -3, 42 SCREENSHOTR_E_MUX_ERROR = -3,
43 SCREENSHOTR_E_BAD_VERSION = -4, 43 SCREENSHOTR_E_SSL_ERROR = -4,
44 SCREENSHOTR_E_UNKNOWN_ERROR = -256 44 SCREENSHOTR_E_RECEIVE_TIMEOUT = -5,
45 SCREENSHOTR_E_BAD_VERSION = -6,
46 SCREENSHOTR_E_UNKNOWN_ERROR = -256
45} screenshotr_error_t; 47} screenshotr_error_t;
46 48
47typedef struct screenshotr_client_private screenshotr_client_private; 49typedef struct screenshotr_client_private screenshotr_client_private;
diff --git a/src/device_link_service.c b/src/device_link_service.c
index 007223e..856d301 100644
--- a/src/device_link_service.c
+++ b/src/device_link_service.c
@@ -2,7 +2,7 @@
2 * device_link_service.c 2 * device_link_service.c
3 * DeviceLink service implementation. 3 * DeviceLink service implementation.
4 * 4 *
5 * Copyright (c) 2010 Nikias Bassen, All Rights Reserved. 5 * Copyright (c) 2010-2019 Nikias Bassen, All Rights Reserved.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public 8 * modify it under the terms of the GNU Lesser General Public
@@ -24,6 +24,27 @@
24#include "property_list_service.h" 24#include "property_list_service.h"
25#include "common/debug.h" 25#include "common/debug.h"
26 26
27static device_link_service_error_t device_link_error(property_list_service_error_t err)
28{
29 switch (err) {
30 case PROPERTY_LIST_SERVICE_E_SUCCESS:
31 return DEVICE_LINK_SERVICE_E_SUCCESS;
32 case PROPERTY_LIST_SERVICE_E_INVALID_ARG:
33 return DEVICE_LINK_SERVICE_E_INVALID_ARG;
34 case PROPERTY_LIST_SERVICE_E_PLIST_ERROR:
35 return DEVICE_LINK_SERVICE_E_PLIST_ERROR;
36 case PROPERTY_LIST_SERVICE_E_MUX_ERROR:
37 return DEVICE_LINK_SERVICE_E_MUX_ERROR;
38 case PROPERTY_LIST_SERVICE_E_SSL_ERROR:
39 return DEVICE_LINK_SERVICE_E_SSL_ERROR;
40 case PROPERTY_LIST_SERVICE_E_RECEIVE_TIMEOUT:
41 return DEVICE_LINK_SERVICE_E_RECEIVE_TIMEOUT;
42 default:
43 break;
44 }
45 return DEVICE_LINK_SERVICE_E_UNKNOWN_ERROR;
46}
47
27/** 48/**
28 * Internally used function to extract the message string from a DL* message 49 * Internally used function to extract the message string from a DL* message
29 * plist. 50 * plist.
@@ -89,18 +110,15 @@ device_link_service_error_t device_link_service_client_new(idevice_t device, loc
89 } 110 }
90 111
91 property_list_service_client_t plistclient = NULL; 112 property_list_service_client_t plistclient = NULL;
92 if (property_list_service_client_new(device, service, &plistclient) != PROPERTY_LIST_SERVICE_E_SUCCESS) { 113 device_link_service_error_t err = device_link_error(property_list_service_client_new(device, service, &plistclient));
93 return DEVICE_LINK_SERVICE_E_MUX_ERROR; 114 if (err != DEVICE_LINK_SERVICE_E_SUCCESS) {
115 return err;
94 } 116 }
95 117
96 /* create client object */ 118 /* create client object */
97 device_link_service_client_t client_loc = (device_link_service_client_t) malloc(sizeof(struct device_link_service_client_private)); 119 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; 120 client_loc->parent = plistclient;
99 121
100 /* enable SSL if requested */
101 if (service->ssl_enabled)
102 property_list_service_enable_ssl(client_loc->parent);
103
104 /* all done, return success */ 122 /* all done, return success */
105 *client = client_loc; 123 *client = client_loc;
106 return DEVICE_LINK_SERVICE_E_SUCCESS; 124 return DEVICE_LINK_SERVICE_E_SUCCESS;
@@ -121,11 +139,10 @@ device_link_service_error_t device_link_service_client_free(device_link_service_
121 if (!client) 139 if (!client)
122 return DEVICE_LINK_SERVICE_E_INVALID_ARG; 140 return DEVICE_LINK_SERVICE_E_INVALID_ARG;
123 141
124 if (property_list_service_client_free(client->parent) != PROPERTY_LIST_SERVICE_E_SUCCESS) { 142 device_link_service_error_t err = device_link_error(property_list_service_client_free(client->parent));
125 return DEVICE_LINK_SERVICE_E_UNKNOWN_ERROR;
126 }
127 free(client); 143 free(client);
128 return DEVICE_LINK_SERVICE_E_SUCCESS; 144
145 return err;
129} 146}
130 147
131/** 148/**
@@ -157,9 +174,9 @@ device_link_service_error_t device_link_service_version_exchange(device_link_ser
157 char *msg = NULL; 174 char *msg = NULL;
158 175
159 /* receive DLMessageVersionExchange from device */ 176 /* receive DLMessageVersionExchange from device */
160 if (property_list_service_receive_plist(client->parent, &array) != PROPERTY_LIST_SERVICE_E_SUCCESS) { 177 err = device_link_error(property_list_service_receive_plist(client->parent, &array));
178 if (err != DEVICE_LINK_SERVICE_E_SUCCESS) {
161 debug_info("Did not receive initial message from device!"); 179 debug_info("Did not receive initial message from device!");
162 err = DEVICE_LINK_SERVICE_E_MUX_ERROR;
163 goto leave; 180 goto leave;
164 } 181 }
165 device_link_service_get_message(array, &msg); 182 device_link_service_get_message(array, &msg);
@@ -203,18 +220,18 @@ device_link_service_error_t device_link_service_version_exchange(device_link_ser
203 plist_array_append_item(array, plist_new_string("DLMessageVersionExchange")); 220 plist_array_append_item(array, plist_new_string("DLMessageVersionExchange"));
204 plist_array_append_item(array, plist_new_string("DLVersionsOk")); 221 plist_array_append_item(array, plist_new_string("DLVersionsOk"));
205 plist_array_append_item(array, plist_new_uint(version_major)); 222 plist_array_append_item(array, plist_new_uint(version_major));
206 if (property_list_service_send_binary_plist(client->parent, array) != PROPERTY_LIST_SERVICE_E_SUCCESS) { 223 err = device_link_error(property_list_service_send_binary_plist(client->parent, array));
224 if (err != DEVICE_LINK_SERVICE_E_SUCCESS) {
207 debug_info("Error when sending DLVersionsOk"); 225 debug_info("Error when sending DLVersionsOk");
208 err = DEVICE_LINK_SERVICE_E_MUX_ERROR;
209 goto leave; 226 goto leave;
210 } 227 }
211 plist_free(array); 228 plist_free(array);
212 229
213 /* receive DeviceReady message */ 230 /* receive DeviceReady message */
214 array = NULL; 231 array = NULL;
215 if (property_list_service_receive_plist(client->parent, &array) != PROPERTY_LIST_SERVICE_E_SUCCESS) { 232 err = device_link_error(property_list_service_receive_plist(client->parent, &array));
233 if (err != DEVICE_LINK_SERVICE_E_SUCCESS) {
216 debug_info("Error when receiving DLMessageDeviceReady!"); 234 debug_info("Error when receiving DLMessageDeviceReady!");
217 err = DEVICE_LINK_SERVICE_E_MUX_ERROR;
218 goto leave; 235 goto leave;
219 } 236 }
220 device_link_service_get_message(array, &msg); 237 device_link_service_get_message(array, &msg);
@@ -258,11 +275,9 @@ device_link_service_error_t device_link_service_disconnect(device_link_service_c
258 else 275 else
259 plist_array_append_item(array, plist_new_string("___EmptyParameterString___")); 276 plist_array_append_item(array, plist_new_string("___EmptyParameterString___"));
260 277
261 device_link_service_error_t err = DEVICE_LINK_SERVICE_E_SUCCESS; 278 device_link_service_error_t err = device_link_error(property_list_service_send_binary_plist(client->parent, array));
262 if (property_list_service_send_binary_plist(client->parent, array) != PROPERTY_LIST_SERVICE_E_SUCCESS) {
263 err = DEVICE_LINK_SERVICE_E_MUX_ERROR;
264 }
265 plist_free(array); 279 plist_free(array);
280
266 return err; 281 return err;
267} 282}
268 283
@@ -286,11 +301,9 @@ device_link_service_error_t device_link_service_send_ping(device_link_service_cl
286 plist_array_append_item(array, plist_new_string("DLMessagePing")); 301 plist_array_append_item(array, plist_new_string("DLMessagePing"));
287 plist_array_append_item(array, plist_new_string(message)); 302 plist_array_append_item(array, plist_new_string(message));
288 303
289 device_link_service_error_t err = DEVICE_LINK_SERVICE_E_SUCCESS; 304 device_link_service_error_t err = device_link_error(property_list_service_send_binary_plist(client->parent, array));
290 if (property_list_service_send_binary_plist(client->parent, array) != PROPERTY_LIST_SERVICE_E_SUCCESS) {
291 err = DEVICE_LINK_SERVICE_E_MUX_ERROR;
292 }
293 plist_free(array); 305 plist_free(array);
306
294 return err; 307 return err;
295} 308}
296 309
@@ -317,11 +330,9 @@ device_link_service_error_t device_link_service_send_process_message(device_link
317 plist_array_append_item(array, plist_new_string("DLMessageProcessMessage")); 330 plist_array_append_item(array, plist_new_string("DLMessageProcessMessage"));
318 plist_array_append_item(array, plist_copy(message)); 331 plist_array_append_item(array, plist_copy(message));
319 332
320 device_link_service_error_t err = DEVICE_LINK_SERVICE_E_SUCCESS; 333 device_link_service_error_t err = device_link_error(property_list_service_send_binary_plist(client->parent, array));
321 if (property_list_service_send_binary_plist(client->parent, array) != PROPERTY_LIST_SERVICE_E_SUCCESS) {
322 err = DEVICE_LINK_SERVICE_E_MUX_ERROR;
323 }
324 plist_free(array); 334 plist_free(array);
335
325 return err; 336 return err;
326} 337}
327 338
@@ -348,8 +359,9 @@ device_link_service_error_t device_link_service_receive_message(device_link_serv
348 return DEVICE_LINK_SERVICE_E_INVALID_ARG; 359 return DEVICE_LINK_SERVICE_E_INVALID_ARG;
349 360
350 *msg_plist = NULL; 361 *msg_plist = NULL;
351 if (property_list_service_receive_plist(client->parent, msg_plist) != PROPERTY_LIST_SERVICE_E_SUCCESS) { 362 device_link_service_error_t err = device_link_error(property_list_service_receive_plist(client->parent, msg_plist));
352 return DEVICE_LINK_SERVICE_E_MUX_ERROR; 363 if (err != DEVICE_LINK_SERVICE_E_SUCCESS) {
364 return err;
353 } 365 }
354 366
355 if (!device_link_service_get_message(*msg_plist, dlmessage)) { 367 if (!device_link_service_get_message(*msg_plist, dlmessage)) {
@@ -378,11 +390,12 @@ device_link_service_error_t device_link_service_receive_process_message(device_l
378 return DEVICE_LINK_SERVICE_E_INVALID_ARG; 390 return DEVICE_LINK_SERVICE_E_INVALID_ARG;
379 391
380 plist_t pmsg = NULL; 392 plist_t pmsg = NULL;
381 if (property_list_service_receive_plist(client->parent, &pmsg) != PROPERTY_LIST_SERVICE_E_SUCCESS) { 393 device_link_service_error_t err = device_link_error(property_list_service_receive_plist(client->parent, &pmsg));
382 return DEVICE_LINK_SERVICE_E_MUX_ERROR; 394 if (err != DEVICE_LINK_SERVICE_E_SUCCESS) {
395 return err;
383 } 396 }
384 397
385 device_link_service_error_t err = DEVICE_LINK_SERVICE_E_UNKNOWN_ERROR; 398 err = DEVICE_LINK_SERVICE_E_UNKNOWN_ERROR;
386 399
387 char *msg = NULL; 400 char *msg = NULL;
388 device_link_service_get_message(pmsg, &msg); 401 device_link_service_get_message(pmsg, &msg);
@@ -432,10 +445,7 @@ device_link_service_error_t device_link_service_send(device_link_service_client_
432 if (!client || !plist) { 445 if (!client || !plist) {
433 return DEVICE_LINK_SERVICE_E_INVALID_ARG; 446 return DEVICE_LINK_SERVICE_E_INVALID_ARG;
434 } 447 }
435 if (property_list_service_send_binary_plist(client->parent, plist) != PROPERTY_LIST_SERVICE_E_SUCCESS) { 448 return device_link_error(property_list_service_send_binary_plist(client->parent, plist));
436 return DEVICE_LINK_SERVICE_E_MUX_ERROR;
437 }
438 return DEVICE_LINK_SERVICE_E_SUCCESS;
439} 449}
440 450
441/* Generic device link service receive function. 451/* Generic device link service receive function.
@@ -455,9 +465,6 @@ device_link_service_error_t device_link_service_receive(device_link_service_clie
455 return DEVICE_LINK_SERVICE_E_INVALID_ARG; 465 return DEVICE_LINK_SERVICE_E_INVALID_ARG;
456 } 466 }
457 467
458 if (property_list_service_receive_plist(client->parent, plist) != PROPERTY_LIST_SERVICE_E_SUCCESS) { 468 return device_link_error(property_list_service_receive_plist(client->parent, plist));
459 return DEVICE_LINK_SERVICE_E_MUX_ERROR;
460 }
461 return DEVICE_LINK_SERVICE_E_SUCCESS;
462} 469}
463 470
diff --git a/src/device_link_service.h b/src/device_link_service.h
index a0c8390..eae912a 100644
--- a/src/device_link_service.h
+++ b/src/device_link_service.h
@@ -2,7 +2,7 @@
2 * device_link_service.h 2 * device_link_service.h
3 * Definitions for the DeviceLink service 3 * Definitions for the DeviceLink service
4 * 4 *
5 * Copyright (c) 2010 Nikias Bassen, All Rights Reserved. 5 * Copyright (c) 2010-2019 Nikias Bassen, All Rights Reserved.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public 8 * modify it under the terms of the GNU Lesser General Public
@@ -25,16 +25,16 @@
25#include "property_list_service.h" 25#include "property_list_service.h"
26 26
27/* Error Codes */ 27/* Error Codes */
28#define DEVICE_LINK_SERVICE_E_SUCCESS 0 28typedef enum {
29#define DEVICE_LINK_SERVICE_E_INVALID_ARG -1 29 DEVICE_LINK_SERVICE_E_SUCCESS = 0,
30#define DEVICE_LINK_SERVICE_E_PLIST_ERROR -2 30 DEVICE_LINK_SERVICE_E_INVALID_ARG = -1,
31#define DEVICE_LINK_SERVICE_E_MUX_ERROR -3 31 DEVICE_LINK_SERVICE_E_PLIST_ERROR = -2,
32#define DEVICE_LINK_SERVICE_E_BAD_VERSION -4 32 DEVICE_LINK_SERVICE_E_MUX_ERROR = -3,
33 33 DEVICE_LINK_SERVICE_E_SSL_ERROR = -4,
34#define DEVICE_LINK_SERVICE_E_UNKNOWN_ERROR -256 34 DEVICE_LINK_SERVICE_E_RECEIVE_TIMEOUT = -5,
35 35 DEVICE_LINK_SERVICE_E_BAD_VERSION = -6,
36/** Represents an error code. */ 36 DEVICE_LINK_SERVICE_E_UNKNOWN_ERROR = -256
37typedef int16_t device_link_service_error_t; 37} device_link_service_error_t;
38 38
39struct device_link_service_client_private { 39struct device_link_service_client_private {
40 property_list_service_client_t parent; 40 property_list_service_client_t parent;
diff --git a/src/mobilebackup.c b/src/mobilebackup.c
index b32e0ba..2682a6f 100644
--- a/src/mobilebackup.c
+++ b/src/mobilebackup.c
@@ -2,6 +2,7 @@
2 * mobilebackup.c 2 * mobilebackup.c
3 * Contains functions for the built-in MobileBackup client. 3 * Contains functions for the built-in MobileBackup client.
4 * 4 *
5 * Copyright (c) 2010-2019 Nikias Bassen, All Rights Reserved.
5 * Copyright (c) 2009 Martin Szulecki All Rights Reserved. 6 * Copyright (c) 2009 Martin Szulecki All Rights Reserved.
6 * 7 *
7 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
@@ -52,6 +53,10 @@ static mobilebackup_error_t mobilebackup_error(device_link_service_error_t err)
52 return MOBILEBACKUP_E_PLIST_ERROR; 53 return MOBILEBACKUP_E_PLIST_ERROR;
53 case DEVICE_LINK_SERVICE_E_MUX_ERROR: 54 case DEVICE_LINK_SERVICE_E_MUX_ERROR:
54 return MOBILEBACKUP_E_MUX_ERROR; 55 return MOBILEBACKUP_E_MUX_ERROR;
56 case DEVICE_LINK_SERVICE_E_SSL_ERROR:
57 return MOBILEBACKUP_E_SSL_ERROR;
58 case DEVICE_LINK_SERVICE_E_RECEIVE_TIMEOUT:
59 return MOBILEBACKUP_E_RECEIVE_TIMEOUT;
55 case DEVICE_LINK_SERVICE_E_BAD_VERSION: 60 case DEVICE_LINK_SERVICE_E_BAD_VERSION:
56 return MOBILEBACKUP_E_BAD_VERSION; 61 return MOBILEBACKUP_E_BAD_VERSION;
57 default: 62 default:
diff --git a/src/mobilebackup.h b/src/mobilebackup.h
index 19b9999..edda70f 100644
--- a/src/mobilebackup.h
+++ b/src/mobilebackup.h
@@ -2,6 +2,7 @@
2 * mobilebackup.h 2 * mobilebackup.h
3 * Definitions for the mobilebackup service 3 * Definitions for the mobilebackup service
4 * 4 *
5 * Copyright (c) 2010-2019 Nikias Bassen, All Rights Reserved.
5 * Copyright (c) 2009 Martin Szulecki All Rights Reserved. 6 * Copyright (c) 2009 Martin Szulecki All Rights Reserved.
6 * 7 *
7 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
diff --git a/src/mobilebackup2.c b/src/mobilebackup2.c
index 08ce22b..e7cc581 100644
--- a/src/mobilebackup2.c
+++ b/src/mobilebackup2.c
@@ -2,7 +2,7 @@
2 * mobilebackup2.c 2 * mobilebackup2.c
3 * Contains functions for the built-in MobileBackup2 client (iOS4+ only) 3 * Contains functions for the built-in MobileBackup2 client (iOS4+ only)
4 * 4 *
5 * Copyright (c) 2010 Nikias Bassen All Rights Reserved. 5 * Copyright (c) 2010-2019 Nikias Bassen, All Rights Reserved.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public 8 * modify it under the terms of the GNU Lesser General Public
@@ -53,6 +53,10 @@ static mobilebackup2_error_t mobilebackup2_error(device_link_service_error_t err
53 return MOBILEBACKUP2_E_PLIST_ERROR; 53 return MOBILEBACKUP2_E_PLIST_ERROR;
54 case DEVICE_LINK_SERVICE_E_MUX_ERROR: 54 case DEVICE_LINK_SERVICE_E_MUX_ERROR:
55 return MOBILEBACKUP2_E_MUX_ERROR; 55 return MOBILEBACKUP2_E_MUX_ERROR;
56 case DEVICE_LINK_SERVICE_E_SSL_ERROR:
57 return MOBILEBACKUP2_E_SSL_ERROR;
58 case DEVICE_LINK_SERVICE_E_RECEIVE_TIMEOUT:
59 return MOBILEBACKUP2_E_RECEIVE_TIMEOUT;
56 case DEVICE_LINK_SERVICE_E_BAD_VERSION: 60 case DEVICE_LINK_SERVICE_E_BAD_VERSION:
57 return MOBILEBACKUP2_E_BAD_VERSION; 61 return MOBILEBACKUP2_E_BAD_VERSION;
58 default: 62 default:
diff --git a/src/mobilebackup2.h b/src/mobilebackup2.h
index 4dba22a..025b6bf 100644
--- a/src/mobilebackup2.h
+++ b/src/mobilebackup2.h
@@ -2,7 +2,7 @@
2 * mobilebackup2.h 2 * mobilebackup2.h
3 * Definitions for the mobilebackup2 service (iOS4+) 3 * Definitions for the mobilebackup2 service (iOS4+)
4 * 4 *
5 * Copyright (c) 2010 Nikias Bassen All Rights Reserved. 5 * Copyright (c) 2010-2019 Nikias Bassen, All Rights Reserved.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public 8 * modify it under the terms of the GNU Lesser General Public
diff --git a/src/mobilesync.c b/src/mobilesync.c
index d903cfe..b0efc80 100644
--- a/src/mobilesync.c
+++ b/src/mobilesync.c
@@ -57,6 +57,10 @@ static mobilesync_error_t mobilesync_error(device_link_service_error_t err)
57 return MOBILESYNC_E_PLIST_ERROR; 57 return MOBILESYNC_E_PLIST_ERROR;
58 case DEVICE_LINK_SERVICE_E_MUX_ERROR: 58 case DEVICE_LINK_SERVICE_E_MUX_ERROR:
59 return MOBILESYNC_E_MUX_ERROR; 59 return MOBILESYNC_E_MUX_ERROR;
60 case DEVICE_LINK_SERVICE_E_SSL_ERROR:
61 return MOBILESYNC_E_SSL_ERROR;
62 case DEVICE_LINK_SERVICE_E_RECEIVE_TIMEOUT:
63 return MOBILESYNC_E_RECEIVE_TIMEOUT;
60 case DEVICE_LINK_SERVICE_E_BAD_VERSION: 64 case DEVICE_LINK_SERVICE_E_BAD_VERSION:
61 return MOBILESYNC_E_BAD_VERSION; 65 return MOBILESYNC_E_BAD_VERSION;
62 default: 66 default:
diff --git a/src/screenshotr.c b/src/screenshotr.c
index 5c4a53f..ddb9d6e 100644
--- a/src/screenshotr.c
+++ b/src/screenshotr.c
@@ -2,7 +2,7 @@
2 * screenshotr.c 2 * screenshotr.c
3 * com.apple.mobile.screenshotr service implementation. 3 * com.apple.mobile.screenshotr service implementation.
4 * 4 *
5 * Copyright (c) 2010 Nikias Bassen All Rights Reserved. 5 * Copyright (c) 2010-2019 Nikias Bassen, All Rights Reserved.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public 8 * modify it under the terms of the GNU Lesser General Public
@@ -50,6 +50,10 @@ static screenshotr_error_t screenshotr_error(device_link_service_error_t err)
50 return SCREENSHOTR_E_PLIST_ERROR; 50 return SCREENSHOTR_E_PLIST_ERROR;
51 case DEVICE_LINK_SERVICE_E_MUX_ERROR: 51 case DEVICE_LINK_SERVICE_E_MUX_ERROR:
52 return SCREENSHOTR_E_MUX_ERROR; 52 return SCREENSHOTR_E_MUX_ERROR;
53 case DEVICE_LINK_SERVICE_E_SSL_ERROR:
54 return SCREENSHOTR_E_SSL_ERROR;
55 case DEVICE_LINK_SERVICE_E_RECEIVE_TIMEOUT:
56 return SCREENSHOTR_E_RECEIVE_TIMEOUT;
53 case DEVICE_LINK_SERVICE_E_BAD_VERSION: 57 case DEVICE_LINK_SERVICE_E_BAD_VERSION:
54 return SCREENSHOTR_E_BAD_VERSION; 58 return SCREENSHOTR_E_BAD_VERSION;
55 default: 59 default: