summaryrefslogtreecommitdiffstats
path: root/include/libimobiledevice/mobilesync.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/libimobiledevice/mobilesync.h')
-rw-r--r--include/libimobiledevice/mobilesync.h43
1 files changed, 43 insertions, 0 deletions
diff --git a/include/libimobiledevice/mobilesync.h b/include/libimobiledevice/mobilesync.h
index 7af3aef..4943f66 100644
--- a/include/libimobiledevice/mobilesync.h
+++ b/include/libimobiledevice/mobilesync.h
@@ -3,6 +3,7 @@
3 * @brief MobileSync Implementation 3 * @brief MobileSync Implementation
4 * \internal 4 * \internal
5 * 5 *
6 * Copyright (c) 2010 Bryan Forbes All Rights Reserved.
6 * Copyright (c) 2009 Jonathan Beck All Rights Reserved. 7 * Copyright (c) 2009 Jonathan Beck All Rights Reserved.
7 * 8 *
8 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
@@ -28,6 +29,7 @@ extern "C" {
28#endif 29#endif
29 30
30#include <libimobiledevice/libimobiledevice.h> 31#include <libimobiledevice/libimobiledevice.h>
32#include <glib.h>
31 33
32/** @name Error Codes */ 34/** @name Error Codes */
33/*@{*/ 35/*@{*/
@@ -36,21 +38,62 @@ extern "C" {
36#define MOBILESYNC_E_PLIST_ERROR -2 38#define MOBILESYNC_E_PLIST_ERROR -2
37#define MOBILESYNC_E_MUX_ERROR -3 39#define MOBILESYNC_E_MUX_ERROR -3
38#define MOBILESYNC_E_BAD_VERSION -4 40#define MOBILESYNC_E_BAD_VERSION -4
41#define MOBILESYNC_E_SYNC_REFUSED -5
42#define MOBILESYNC_E_CANCELLED -6
43#define MOBILESYNC_E_WRONG_DIRECTION -7
44#define MOBILESYNC_E_NOT_READY -8
39 45
40#define MOBILESYNC_E_UNKNOWN_ERROR -256 46#define MOBILESYNC_E_UNKNOWN_ERROR -256
41/*@}*/ 47/*@}*/
42 48
49typedef enum {
50 MOBILESYNC_SYNC_TYPE_FAST,
51 MOBILESYNC_SYNC_TYPE_SLOW,
52 MOBILESYNC_SYNC_TYPE_RESET
53} mobilesync_sync_type_t;
54
43/** Represents an error code. */ 55/** Represents an error code. */
44typedef int16_t mobilesync_error_t; 56typedef int16_t mobilesync_error_t;
45 57
46typedef struct mobilesync_client_private mobilesync_client_private; 58typedef struct mobilesync_client_private mobilesync_client_private;
47typedef mobilesync_client_private *mobilesync_client_t; /**< The client handle */ 59typedef mobilesync_client_private *mobilesync_client_t; /**< The client handle */
48 60
61typedef struct {
62 char *device_anchor;
63 char *computer_anchor;
64} mobilesync_anchors;
65typedef mobilesync_anchors *mobilesync_anchors_t;
66
67/* Interface */
49mobilesync_error_t mobilesync_client_new(idevice_t device, uint16_t port, mobilesync_client_t * client); 68mobilesync_error_t mobilesync_client_new(idevice_t device, uint16_t port, mobilesync_client_t * client);
50mobilesync_error_t mobilesync_client_free(mobilesync_client_t client); 69mobilesync_error_t mobilesync_client_free(mobilesync_client_t client);
70
51mobilesync_error_t mobilesync_receive(mobilesync_client_t client, plist_t *plist); 71mobilesync_error_t mobilesync_receive(mobilesync_client_t client, plist_t *plist);
52mobilesync_error_t mobilesync_send(mobilesync_client_t client, plist_t plist); 72mobilesync_error_t mobilesync_send(mobilesync_client_t client, plist_t plist);
53 73
74mobilesync_error_t mobilesync_start(mobilesync_client_t client, const char *data_class, mobilesync_anchors_t anchors, mobilesync_sync_type_t *sync_type, uint64_t *data_class_version);
75mobilesync_error_t mobilesync_cancel(mobilesync_client_t client, const char* reason);
76mobilesync_error_t mobilesync_finish(mobilesync_client_t client);
77
78mobilesync_error_t mobilesync_get_all_records_from_device(mobilesync_client_t client);
79mobilesync_error_t mobilesync_get_changes_from_device(mobilesync_client_t client);
80
81mobilesync_error_t mobilesync_receive_changes(mobilesync_client_t client, plist_t *entities, uint8_t *is_last_record, plist_t *actions);
82mobilesync_error_t mobilesync_acknowledge_changes_from_device(mobilesync_client_t client);
83
84mobilesync_error_t mobilesync_ready_to_send_changes_from_computer(mobilesync_client_t client);
85
86mobilesync_error_t mobilesync_send_changes(mobilesync_client_t client, plist_t entities, uint8_t is_last_record, plist_t actions);
87mobilesync_error_t mobilesync_remap_identifiers(mobilesync_client_t client, plist_t *mapping);
88
89/* Helper */
90mobilesync_anchors_t mobilesync_anchors_new(const char *device_anchor, const char *computer_anchor);
91void mobilesync_anchors_free(mobilesync_anchors_t anchors);
92
93plist_t mobilesync_actions_new();
94void mobilesync_actions_add(plist_t actions, ...) G_GNUC_NULL_TERMINATED;
95void mobilesync_actions_free(plist_t actions);
96
54#ifdef __cplusplus 97#ifdef __cplusplus
55} 98}
56#endif 99#endif