summaryrefslogtreecommitdiffstats
path: root/src/mobilesync.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mobilesync.c')
-rw-r--r--src/mobilesync.c42
1 files changed, 21 insertions, 21 deletions
diff --git a/src/mobilesync.c b/src/mobilesync.c
index e50226c..9b81a49 100644
--- a/src/mobilesync.c
+++ b/src/mobilesync.c
@@ -71,7 +71,7 @@ static mobilesync_error_t mobilesync_error(device_link_service_error_t err)
71 return MOBILESYNC_E_UNKNOWN_ERROR; 71 return MOBILESYNC_E_UNKNOWN_ERROR;
72} 72}
73 73
74LIBIMOBILEDEVICE_API mobilesync_error_t mobilesync_client_new(idevice_t device, lockdownd_service_descriptor_t service, 74mobilesync_error_t mobilesync_client_new(idevice_t device, lockdownd_service_descriptor_t service,
75 mobilesync_client_t * client) 75 mobilesync_client_t * client)
76{ 76{
77 if (!device || !service || service->port == 0 || !client || *client) 77 if (!device || !service || service->port == 0 || !client || *client)
@@ -101,14 +101,14 @@ LIBIMOBILEDEVICE_API mobilesync_error_t mobilesync_client_new(idevice_t device,
101 return ret; 101 return ret;
102} 102}
103 103
104LIBIMOBILEDEVICE_API mobilesync_error_t mobilesync_client_start_service(idevice_t device, mobilesync_client_t * client, const char* label) 104mobilesync_error_t mobilesync_client_start_service(idevice_t device, mobilesync_client_t * client, const char* label)
105{ 105{
106 mobilesync_error_t err = MOBILESYNC_E_UNKNOWN_ERROR; 106 mobilesync_error_t err = MOBILESYNC_E_UNKNOWN_ERROR;
107 service_client_factory_start_service(device, MOBILESYNC_SERVICE_NAME, (void**)client, label, SERVICE_CONSTRUCTOR(mobilesync_client_new), &err); 107 service_client_factory_start_service(device, MOBILESYNC_SERVICE_NAME, (void**)client, label, SERVICE_CONSTRUCTOR(mobilesync_client_new), &err);
108 return err; 108 return err;
109} 109}
110 110
111LIBIMOBILEDEVICE_API mobilesync_error_t mobilesync_client_free(mobilesync_client_t client) 111mobilesync_error_t mobilesync_client_free(mobilesync_client_t client)
112{ 112{
113 if (!client) 113 if (!client)
114 return MOBILESYNC_E_INVALID_ARG; 114 return MOBILESYNC_E_INVALID_ARG;
@@ -118,7 +118,7 @@ LIBIMOBILEDEVICE_API mobilesync_error_t mobilesync_client_free(mobilesync_client
118 return err; 118 return err;
119} 119}
120 120
121LIBIMOBILEDEVICE_API mobilesync_error_t mobilesync_receive(mobilesync_client_t client, plist_t * plist) 121mobilesync_error_t mobilesync_receive(mobilesync_client_t client, plist_t * plist)
122{ 122{
123 if (!client) 123 if (!client)
124 return MOBILESYNC_E_INVALID_ARG; 124 return MOBILESYNC_E_INVALID_ARG;
@@ -126,14 +126,14 @@ LIBIMOBILEDEVICE_API mobilesync_error_t mobilesync_receive(mobilesync_client_t c
126 return ret; 126 return ret;
127} 127}
128 128
129LIBIMOBILEDEVICE_API mobilesync_error_t mobilesync_send(mobilesync_client_t client, plist_t plist) 129mobilesync_error_t mobilesync_send(mobilesync_client_t client, plist_t plist)
130{ 130{
131 if (!client || !plist) 131 if (!client || !plist)
132 return MOBILESYNC_E_INVALID_ARG; 132 return MOBILESYNC_E_INVALID_ARG;
133 return mobilesync_error(device_link_service_send(client->parent, plist)); 133 return mobilesync_error(device_link_service_send(client->parent, plist));
134} 134}
135 135
136LIBIMOBILEDEVICE_API mobilesync_error_t mobilesync_start(mobilesync_client_t client, const char *data_class, mobilesync_anchors_t anchors, uint64_t computer_data_class_version, mobilesync_sync_type_t *sync_type, uint64_t *device_data_class_version, char** error_description) 136mobilesync_error_t mobilesync_start(mobilesync_client_t client, const char *data_class, mobilesync_anchors_t anchors, uint64_t computer_data_class_version, mobilesync_sync_type_t *sync_type, uint64_t *device_data_class_version, char** error_description)
137{ 137{
138 if (!client || client->data_class || !data_class || 138 if (!client || client->data_class || !data_class ||
139 !anchors || !anchors->computer_anchor) { 139 !anchors || !anchors->computer_anchor) {
@@ -259,7 +259,7 @@ LIBIMOBILEDEVICE_API mobilesync_error_t mobilesync_start(mobilesync_client_t cli
259 return err; 259 return err;
260} 260}
261 261
262LIBIMOBILEDEVICE_API mobilesync_error_t mobilesync_finish(mobilesync_client_t client) 262mobilesync_error_t mobilesync_finish(mobilesync_client_t client)
263{ 263{
264 if (!client || !client->data_class) { 264 if (!client || !client->data_class) {
265 return MOBILESYNC_E_INVALID_ARG; 265 return MOBILESYNC_E_INVALID_ARG;
@@ -344,17 +344,17 @@ static mobilesync_error_t mobilesync_get_records(mobilesync_client_t client, con
344 return err; 344 return err;
345} 345}
346 346
347LIBIMOBILEDEVICE_API mobilesync_error_t mobilesync_get_all_records_from_device(mobilesync_client_t client) 347mobilesync_error_t mobilesync_get_all_records_from_device(mobilesync_client_t client)
348{ 348{
349 return mobilesync_get_records(client, "SDMessageGetAllRecordsFromDevice"); 349 return mobilesync_get_records(client, "SDMessageGetAllRecordsFromDevice");
350} 350}
351 351
352LIBIMOBILEDEVICE_API mobilesync_error_t mobilesync_get_changes_from_device(mobilesync_client_t client) 352mobilesync_error_t mobilesync_get_changes_from_device(mobilesync_client_t client)
353{ 353{
354 return mobilesync_get_records(client, "SDMessageGetChangesFromDevice"); 354 return mobilesync_get_records(client, "SDMessageGetChangesFromDevice");
355} 355}
356 356
357LIBIMOBILEDEVICE_API mobilesync_error_t mobilesync_receive_changes(mobilesync_client_t client, plist_t *entities, uint8_t *is_last_record, plist_t *actions) 357mobilesync_error_t mobilesync_receive_changes(mobilesync_client_t client, plist_t *entities, uint8_t *is_last_record, plist_t *actions)
358{ 358{
359 if (!client || !client->data_class) { 359 if (!client || !client->data_class) {
360 return MOBILESYNC_E_INVALID_ARG; 360 return MOBILESYNC_E_INVALID_ARG;
@@ -421,7 +421,7 @@ LIBIMOBILEDEVICE_API mobilesync_error_t mobilesync_receive_changes(mobilesync_cl
421 return err; 421 return err;
422} 422}
423 423
424LIBIMOBILEDEVICE_API mobilesync_error_t mobilesync_clear_all_records_on_device(mobilesync_client_t client) 424mobilesync_error_t mobilesync_clear_all_records_on_device(mobilesync_client_t client)
425{ 425{
426 if (!client || !client->data_class) { 426 if (!client || !client->data_class) {
427 return MOBILESYNC_E_INVALID_ARG; 427 return MOBILESYNC_E_INVALID_ARG;
@@ -490,7 +490,7 @@ LIBIMOBILEDEVICE_API mobilesync_error_t mobilesync_clear_all_records_on_device(m
490 return err; 490 return err;
491} 491}
492 492
493LIBIMOBILEDEVICE_API mobilesync_error_t mobilesync_acknowledge_changes_from_device(mobilesync_client_t client) 493mobilesync_error_t mobilesync_acknowledge_changes_from_device(mobilesync_client_t client)
494{ 494{
495 if (!client || !client->data_class) { 495 if (!client || !client->data_class) {
496 return MOBILESYNC_E_INVALID_ARG; 496 return MOBILESYNC_E_INVALID_ARG;
@@ -524,7 +524,7 @@ static plist_t create_process_changes_message(const char *data_class, plist_t en
524 return msg; 524 return msg;
525} 525}
526 526
527LIBIMOBILEDEVICE_API mobilesync_error_t mobilesync_ready_to_send_changes_from_computer(mobilesync_client_t client) 527mobilesync_error_t mobilesync_ready_to_send_changes_from_computer(mobilesync_client_t client)
528{ 528{
529 if (!client || !client->data_class) { 529 if (!client || !client->data_class) {
530 return MOBILESYNC_E_INVALID_ARG; 530 return MOBILESYNC_E_INVALID_ARG;
@@ -591,7 +591,7 @@ LIBIMOBILEDEVICE_API mobilesync_error_t mobilesync_ready_to_send_changes_from_co
591 return err; 591 return err;
592} 592}
593 593
594LIBIMOBILEDEVICE_API mobilesync_error_t mobilesync_send_changes(mobilesync_client_t client, plist_t entities, uint8_t is_last_record, plist_t actions) 594mobilesync_error_t mobilesync_send_changes(mobilesync_client_t client, plist_t entities, uint8_t is_last_record, plist_t actions)
595{ 595{
596 if (!client || !client->data_class || !entities) { 596 if (!client || !client->data_class || !entities) {
597 return MOBILESYNC_E_INVALID_ARG; 597 return MOBILESYNC_E_INVALID_ARG;
@@ -619,7 +619,7 @@ LIBIMOBILEDEVICE_API mobilesync_error_t mobilesync_send_changes(mobilesync_clien
619 return err; 619 return err;
620} 620}
621 621
622LIBIMOBILEDEVICE_API mobilesync_error_t mobilesync_remap_identifiers(mobilesync_client_t client, plist_t *mapping) 622mobilesync_error_t mobilesync_remap_identifiers(mobilesync_client_t client, plist_t *mapping)
623{ 623{
624 if (!client || !client->data_class) { 624 if (!client || !client->data_class) {
625 return MOBILESYNC_E_INVALID_ARG; 625 return MOBILESYNC_E_INVALID_ARG;
@@ -688,7 +688,7 @@ LIBIMOBILEDEVICE_API mobilesync_error_t mobilesync_remap_identifiers(mobilesync_
688 return err; 688 return err;
689} 689}
690 690
691LIBIMOBILEDEVICE_API mobilesync_error_t mobilesync_cancel(mobilesync_client_t client, const char* reason) 691mobilesync_error_t mobilesync_cancel(mobilesync_client_t client, const char* reason)
692{ 692{
693 if (!client || !client->data_class || !reason) { 693 if (!client || !client->data_class || !reason) {
694 return MOBILESYNC_E_INVALID_ARG; 694 return MOBILESYNC_E_INVALID_ARG;
@@ -714,7 +714,7 @@ LIBIMOBILEDEVICE_API mobilesync_error_t mobilesync_cancel(mobilesync_client_t cl
714 return err; 714 return err;
715} 715}
716 716
717LIBIMOBILEDEVICE_API mobilesync_anchors_t mobilesync_anchors_new(const char *device_anchor, const char *computer_anchor) 717mobilesync_anchors_t mobilesync_anchors_new(const char *device_anchor, const char *computer_anchor)
718{ 718{
719 mobilesync_anchors_t anchors = (mobilesync_anchors_t) malloc(sizeof(mobilesync_anchors)); 719 mobilesync_anchors_t anchors = (mobilesync_anchors_t) malloc(sizeof(mobilesync_anchors));
720 if (device_anchor != NULL) { 720 if (device_anchor != NULL) {
@@ -731,7 +731,7 @@ LIBIMOBILEDEVICE_API mobilesync_anchors_t mobilesync_anchors_new(const char *dev
731 return anchors; 731 return anchors;
732} 732}
733 733
734LIBIMOBILEDEVICE_API void mobilesync_anchors_free(mobilesync_anchors_t anchors) 734void mobilesync_anchors_free(mobilesync_anchors_t anchors)
735{ 735{
736 if (anchors->device_anchor != NULL) { 736 if (anchors->device_anchor != NULL) {
737 free(anchors->device_anchor); 737 free(anchors->device_anchor);
@@ -745,12 +745,12 @@ LIBIMOBILEDEVICE_API void mobilesync_anchors_free(mobilesync_anchors_t anchors)
745 anchors = NULL; 745 anchors = NULL;
746} 746}
747 747
748LIBIMOBILEDEVICE_API plist_t mobilesync_actions_new(void) 748plist_t mobilesync_actions_new(void)
749{ 749{
750 return plist_new_dict(); 750 return plist_new_dict();
751} 751}
752 752
753LIBIMOBILEDEVICE_API void mobilesync_actions_add(plist_t actions, ...) 753void mobilesync_actions_add(plist_t actions, ...)
754{ 754{
755 if (!actions) 755 if (!actions)
756 return; 756 return;
@@ -782,7 +782,7 @@ LIBIMOBILEDEVICE_API void mobilesync_actions_add(plist_t actions, ...)
782 va_end(args); 782 va_end(args);
783} 783}
784 784
785LIBIMOBILEDEVICE_API void mobilesync_actions_free(plist_t actions) 785void mobilesync_actions_free(plist_t actions)
786{ 786{
787 if (actions) { 787 if (actions) {
788 plist_free(actions); 788 plist_free(actions);