diff options
| -rwxr-xr-x | dev/msync.py | 2 | ||||
| -rw-r--r-- | dev/msyncclient.c | 109 | ||||
| -rw-r--r-- | include/Makefile.am | 6 | ||||
| -rw-r--r-- | include/libiphone/libiphone.h | 9 | ||||
| -rw-r--r-- | src/MobileSync.c | 125 | ||||
| -rw-r--r-- | src/MobileSync.h | 8 | ||||
| -rw-r--r-- | swig/iphone.i | 15 |
7 files changed, 134 insertions, 140 deletions
diff --git a/dev/msync.py b/dev/msync.py index 17e3121..fe7f1fd 100755 --- a/dev/msync.py +++ b/dev/msync.py | |||
| @@ -12,7 +12,7 @@ def GetMobileSyncClient() : | |||
| 12 | if not lckd : | 12 | if not lckd : |
| 13 | print "Failed to start lockdown service.\n" | 13 | print "Failed to start lockdown service.\n" |
| 14 | return None | 14 | return None |
| 15 | msync = lckd.get_mobile_sync_client() | 15 | msync = lckd.get_mobilesync_client() |
| 16 | if not msync : | 16 | if not msync : |
| 17 | print "Failed to start mobilesync service.\n" | 17 | print "Failed to start mobilesync service.\n" |
| 18 | return None | 18 | return None |
diff --git a/dev/msyncclient.c b/dev/msyncclient.c index e06a5fe..5eb105d 100644 --- a/dev/msyncclient.c +++ b/dev/msyncclient.c | |||
| @@ -26,6 +26,107 @@ | |||
| 26 | 26 | ||
| 27 | #include <libiphone/libiphone.h> | 27 | #include <libiphone/libiphone.h> |
| 28 | #include <libiphone/lockdown.h> | 28 | #include <libiphone/lockdown.h> |
| 29 | #include <libiphone/mobilesync.h> | ||
| 30 | |||
| 31 | static iphone_error_t mobilesync_get_all_contacts(mobilesync_client_t client) | ||
| 32 | { | ||
| 33 | if (!client) | ||
| 34 | return IPHONE_E_INVALID_ARG; | ||
| 35 | |||
| 36 | iphone_error_t ret = IPHONE_E_UNKNOWN_ERROR; | ||
| 37 | plist_t array = NULL; | ||
| 38 | |||
| 39 | array = plist_new_array(); | ||
| 40 | plist_add_sub_string_el(array, "SDMessageSyncDataClassWithDevice"); | ||
| 41 | plist_add_sub_string_el(array, "com.apple.Contacts"); | ||
| 42 | plist_add_sub_string_el(array, "---"); | ||
| 43 | plist_add_sub_string_el(array, "2009-01-09 18:03:58 +0100"); | ||
| 44 | plist_add_sub_uint_el(array, 106); | ||
| 45 | plist_add_sub_string_el(array, "___EmptyParameterString___"); | ||
| 46 | |||
| 47 | ret = mobilesync_send(client, array); | ||
| 48 | plist_free(array); | ||
| 49 | array = NULL; | ||
| 50 | |||
| 51 | ret = mobilesync_recv(client, &array); | ||
| 52 | |||
| 53 | plist_t rep_node = plist_find_node_by_string(array, "SDSyncTypeSlow"); | ||
| 54 | |||
| 55 | if (!rep_node) | ||
| 56 | return ret; | ||
| 57 | |||
| 58 | plist_free(array); | ||
| 59 | array = NULL; | ||
| 60 | |||
| 61 | array = plist_new_array(); | ||
| 62 | plist_add_sub_string_el(array, "SDMessageGetAllRecordsFromDevice"); | ||
| 63 | plist_add_sub_string_el(array, "com.apple.Contacts"); | ||
| 64 | |||
| 65 | |||
| 66 | ret = mobilesync_send(client, array); | ||
| 67 | plist_free(array); | ||
| 68 | array = NULL; | ||
| 69 | |||
| 70 | ret = mobilesync_recv(client, &array); | ||
| 71 | |||
| 72 | plist_t contact_node; | ||
| 73 | plist_t switch_node; | ||
| 74 | |||
| 75 | contact_node = plist_find_node_by_string(array, "com.apple.Contacts"); | ||
| 76 | switch_node = plist_find_node_by_string(array, "SDMessageDeviceReadyToReceiveChanges"); | ||
| 77 | |||
| 78 | while (NULL == switch_node) { | ||
| 79 | |||
| 80 | plist_free(array); | ||
| 81 | array = NULL; | ||
| 82 | |||
| 83 | array = plist_new_array(); | ||
| 84 | plist_add_sub_string_el(array, "SDMessageAcknowledgeChangesFromDevice"); | ||
| 85 | plist_add_sub_string_el(array, "com.apple.Contacts"); | ||
| 86 | |||
| 87 | ret = mobilesync_send(client, array); | ||
| 88 | plist_free(array); | ||
| 89 | array = NULL; | ||
| 90 | |||
| 91 | ret = mobilesync_recv(client, &array); | ||
| 92 | |||
| 93 | contact_node = plist_find_node_by_string(array, "com.apple.Contacts"); | ||
| 94 | switch_node = plist_find_node_by_string(array, "SDMessageDeviceReadyToReceiveChanges"); | ||
| 95 | } | ||
| 96 | |||
| 97 | array = plist_new_array(); | ||
| 98 | plist_add_sub_string_el(array, "DLMessagePing"); | ||
| 99 | plist_add_sub_string_el(array, "Preparing to get changes for device"); | ||
| 100 | |||
| 101 | ret = mobilesync_send(client, array); | ||
| 102 | plist_free(array); | ||
| 103 | array = NULL; | ||
| 104 | |||
| 105 | array = plist_new_array(); | ||
| 106 | plist_add_sub_string_el(array, "SDMessageProcessChanges"); | ||
| 107 | plist_add_sub_string_el(array, "com.apple.Contacts"); | ||
| 108 | plist_add_sub_node(array, plist_new_dict()); | ||
| 109 | plist_add_sub_bool_el(array, 0); | ||
| 110 | plist_t dict = plist_new_dict(); | ||
| 111 | plist_add_sub_node(array, dict); | ||
| 112 | plist_add_sub_key_el(dict, "SyncDeviceLinkEntityNamesKey"); | ||
| 113 | plist_t array2 = plist_new_array(); | ||
| 114 | plist_add_sub_string_el(array2, "com.apple.contacts.Contact"); | ||
| 115 | plist_add_sub_string_el(array2, "com.apple.contacts.Group"); | ||
| 116 | plist_add_sub_key_el(dict, "SyncDeviceLinkAllRecordsOfPulledEntityTypeSentKey"); | ||
| 117 | plist_add_sub_bool_el(dict, 0); | ||
| 118 | |||
| 119 | ret = mobilesync_send(client, array); | ||
| 120 | plist_free(array); | ||
| 121 | array = NULL; | ||
| 122 | |||
| 123 | ret = mobilesync_recv(client, &array); | ||
| 124 | plist_free(array); | ||
| 125 | array = NULL; | ||
| 126 | |||
| 127 | |||
| 128 | return ret; | ||
| 129 | } | ||
| 29 | 130 | ||
| 30 | int main(int argc, char *argv[]) | 131 | int main(int argc, char *argv[]) |
| 31 | { | 132 | { |
| @@ -50,11 +151,11 @@ int main(int argc, char *argv[]) | |||
| 50 | lockdownd_start_service(client, "com.apple.mobilesync", &port); | 151 | lockdownd_start_service(client, "com.apple.mobilesync", &port); |
| 51 | 152 | ||
| 52 | if (port) { | 153 | if (port) { |
| 53 | iphone_msync_client_t msync = NULL; | 154 | mobilesync_client_t msync = NULL; |
| 54 | iphone_msync_new_client(phone, port, &msync); | 155 | mobilesync_new_client(phone, port, &msync); |
| 55 | if (msync) { | 156 | if (msync) { |
| 56 | iphone_msync_get_all_contacts(msync); | 157 | mobilesync_get_all_contacts(msync); |
| 57 | iphone_msync_free_client(msync); | 158 | mobilesync_free_client(msync); |
| 58 | } | 159 | } |
| 59 | } else { | 160 | } else { |
| 60 | printf("Start service failure.\n"); | 161 | printf("Start service failure.\n"); |
diff --git a/include/Makefile.am b/include/Makefile.am index 98792de..df7b823 100644 --- a/include/Makefile.am +++ b/include/Makefile.am | |||
| @@ -1 +1,5 @@ | |||
| 1 | nobase_include_HEADERS = libiphone/libiphone.h libiphone/lockdown.h libiphone/afc.h libiphone/notification_proxy.h | 1 | nobase_include_HEADERS = libiphone/libiphone.h \ |
| 2 | libiphone/lockdown.h \ | ||
| 3 | libiphone/afc.h \ | ||
| 4 | libiphone/notification_proxy.h \ | ||
| 5 | libiphone/mobilesync.h | ||
diff --git a/include/libiphone/libiphone.h b/include/libiphone/libiphone.h index 9e983bb..fa26d14 100644 --- a/include/libiphone/libiphone.h +++ b/include/libiphone/libiphone.h | |||
| @@ -57,9 +57,6 @@ typedef int16_t iphone_error_t; | |||
| 57 | struct iphone_device_int; | 57 | struct iphone_device_int; |
| 58 | typedef struct iphone_device_int *iphone_device_t; | 58 | typedef struct iphone_device_int *iphone_device_t; |
| 59 | 59 | ||
| 60 | struct iphone_msync_client_int; | ||
| 61 | typedef struct iphone_msync_client_int *iphone_msync_client_t; | ||
| 62 | |||
| 63 | //debug related functions | 60 | //debug related functions |
| 64 | #define DBGMASK_ALL 0xFFFF | 61 | #define DBGMASK_ALL 0xFFFF |
| 65 | #define DBGMASK_NONE 0x0000 | 62 | #define DBGMASK_NONE 0x0000 |
| @@ -76,12 +73,6 @@ iphone_error_t iphone_get_device_by_uuid(iphone_device_t *device, const char *uu | |||
| 76 | iphone_error_t iphone_free_device(iphone_device_t device); | 73 | iphone_error_t iphone_free_device(iphone_device_t device); |
| 77 | uint32_t iphone_get_device_handle(iphone_device_t device); | 74 | uint32_t iphone_get_device_handle(iphone_device_t device); |
| 78 | 75 | ||
| 79 | iphone_error_t iphone_msync_new_client(iphone_device_t device, int dst_port, | ||
| 80 | iphone_msync_client_t * client); | ||
| 81 | iphone_error_t iphone_msync_free_client(iphone_msync_client_t client); | ||
| 82 | iphone_error_t iphone_msync_recv(iphone_msync_client_t client, plist_t *plist); | ||
| 83 | iphone_error_t iphone_msync_send(iphone_msync_client_t client, plist_t plist); | ||
| 84 | |||
| 85 | #ifdef __cplusplus | 76 | #ifdef __cplusplus |
| 86 | } | 77 | } |
| 87 | #endif | 78 | #endif |
diff --git a/src/MobileSync.c b/src/MobileSync.c index 7d6e947..b9a1cb0 100644 --- a/src/MobileSync.c +++ b/src/MobileSync.c | |||
| @@ -29,8 +29,8 @@ | |||
| 29 | #define MSYNC_VERSION_INT1 100 | 29 | #define MSYNC_VERSION_INT1 100 |
| 30 | #define MSYNC_VERSION_INT2 100 | 30 | #define MSYNC_VERSION_INT2 100 |
| 31 | 31 | ||
| 32 | iphone_error_t iphone_msync_new_client(iphone_device_t device, int dst_port, | 32 | iphone_error_t mobilesync_new_client(iphone_device_t device, int dst_port, |
| 33 | iphone_msync_client_t * client) | 33 | mobilesync_client_t * client) |
| 34 | { | 34 | { |
| 35 | if (!device || dst_port == 0 || !client || *client) | 35 | if (!device || dst_port == 0 || !client || *client) |
| 36 | return IPHONE_E_INVALID_ARG; | 36 | return IPHONE_E_INVALID_ARG; |
| @@ -43,14 +43,14 @@ iphone_error_t iphone_msync_new_client(iphone_device_t device, int dst_port, | |||
| 43 | return ret; | 43 | return ret; |
| 44 | } | 44 | } |
| 45 | 45 | ||
| 46 | iphone_msync_client_t client_loc = (iphone_msync_client_t) malloc(sizeof(struct iphone_msync_client_int)); | 46 | mobilesync_client_t client_loc = (mobilesync_client_t) malloc(sizeof(struct mobilesync_client_int)); |
| 47 | client_loc->sfd = sfd; | 47 | client_loc->sfd = sfd; |
| 48 | 48 | ||
| 49 | //perform handshake | 49 | //perform handshake |
| 50 | plist_t array = NULL; | 50 | plist_t array = NULL; |
| 51 | 51 | ||
| 52 | //first receive version | 52 | //first receive version |
| 53 | ret = iphone_msync_recv(client_loc, &array); | 53 | ret = mobilesync_recv(client_loc, &array); |
| 54 | 54 | ||
| 55 | plist_t msg_node = plist_find_node_by_string(array, "DLMessageVersionExchange"); | 55 | plist_t msg_node = plist_find_node_by_string(array, "DLMessageVersionExchange"); |
| 56 | plist_t ver_1 = plist_get_next_sibling(msg_node); | 56 | plist_t ver_1 = plist_get_next_sibling(msg_node); |
| @@ -77,12 +77,12 @@ iphone_error_t iphone_msync_new_client(iphone_device_t device, int dst_port, | |||
| 77 | plist_add_sub_string_el(array, "DLMessageVersionExchange"); | 77 | plist_add_sub_string_el(array, "DLMessageVersionExchange"); |
| 78 | plist_add_sub_string_el(array, "DLVersionsOk"); | 78 | plist_add_sub_string_el(array, "DLVersionsOk"); |
| 79 | 79 | ||
| 80 | ret = iphone_msync_send(client_loc, array); | 80 | ret = mobilesync_send(client_loc, array); |
| 81 | 81 | ||
| 82 | plist_free(array); | 82 | plist_free(array); |
| 83 | array = NULL; | 83 | array = NULL; |
| 84 | 84 | ||
| 85 | ret = iphone_msync_recv(client_loc, &array); | 85 | ret = mobilesync_recv(client_loc, &array); |
| 86 | plist_t rep_node = plist_find_node_by_string(array, "DLMessageDeviceReady"); | 86 | plist_t rep_node = plist_find_node_by_string(array, "DLMessageDeviceReady"); |
| 87 | 87 | ||
| 88 | if (rep_node) { | 88 | if (rep_node) { |
| @@ -96,12 +96,12 @@ iphone_error_t iphone_msync_new_client(iphone_device_t device, int dst_port, | |||
| 96 | } | 96 | } |
| 97 | 97 | ||
| 98 | if (IPHONE_E_SUCCESS != ret) | 98 | if (IPHONE_E_SUCCESS != ret) |
| 99 | iphone_msync_free_client(client_loc); | 99 | mobilesync_free_client(client_loc); |
| 100 | 100 | ||
| 101 | return ret; | 101 | return ret; |
| 102 | } | 102 | } |
| 103 | 103 | ||
| 104 | static void iphone_msync_stop_session(iphone_msync_client_t client) | 104 | static void mobilesync_disconnect(mobilesync_client_t client) |
| 105 | { | 105 | { |
| 106 | if (!client) | 106 | if (!client) |
| 107 | return; | 107 | return; |
| @@ -110,17 +110,17 @@ static void iphone_msync_stop_session(iphone_msync_client_t client) | |||
| 110 | plist_add_sub_string_el(array, "DLMessageDisconnect"); | 110 | plist_add_sub_string_el(array, "DLMessageDisconnect"); |
| 111 | plist_add_sub_string_el(array, "All done, thanks for the memories"); | 111 | plist_add_sub_string_el(array, "All done, thanks for the memories"); |
| 112 | 112 | ||
| 113 | iphone_msync_send(client, array); | 113 | mobilesync_send(client, array); |
| 114 | plist_free(array); | 114 | plist_free(array); |
| 115 | array = NULL; | 115 | array = NULL; |
| 116 | } | 116 | } |
| 117 | 117 | ||
| 118 | iphone_error_t iphone_msync_free_client(iphone_msync_client_t client) | 118 | iphone_error_t mobilesync_free_client(mobilesync_client_t client) |
| 119 | { | 119 | { |
| 120 | if (!client) | 120 | if (!client) |
| 121 | return IPHONE_E_INVALID_ARG; | 121 | return IPHONE_E_INVALID_ARG; |
| 122 | 122 | ||
| 123 | iphone_msync_stop_session(client); | 123 | mobilesync_disconnect(client); |
| 124 | return usbmuxd_disconnect(client->sfd); | 124 | return usbmuxd_disconnect(client->sfd); |
| 125 | } | 125 | } |
| 126 | 126 | ||
| @@ -131,7 +131,7 @@ iphone_error_t iphone_msync_free_client(iphone_msync_client_t client) | |||
| 131 | * | 131 | * |
| 132 | * @return an error code | 132 | * @return an error code |
| 133 | */ | 133 | */ |
| 134 | iphone_error_t iphone_msync_recv(iphone_msync_client_t client, plist_t * plist) | 134 | iphone_error_t mobilesync_recv(mobilesync_client_t client, plist_t * plist) |
| 135 | { | 135 | { |
| 136 | if (!client || !plist || (plist && *plist)) | 136 | if (!client || !plist || (plist && *plist)) |
| 137 | return IPHONE_E_INVALID_ARG; | 137 | return IPHONE_E_INVALID_ARG; |
| @@ -177,7 +177,7 @@ iphone_error_t iphone_msync_recv(iphone_msync_client_t client, plist_t * plist) | |||
| 177 | * | 177 | * |
| 178 | * @return an error code | 178 | * @return an error code |
| 179 | */ | 179 | */ |
| 180 | iphone_error_t iphone_msync_send(iphone_msync_client_t client, plist_t plist) | 180 | iphone_error_t mobilesync_send(mobilesync_client_t client, plist_t plist) |
| 181 | { | 181 | { |
| 182 | if (!client || !plist) | 182 | if (!client || !plist) |
| 183 | return IPHONE_E_INVALID_ARG; | 183 | return IPHONE_E_INVALID_ARG; |
| @@ -207,102 +207,3 @@ iphone_error_t iphone_msync_send(iphone_msync_client_t client, plist_t plist) | |||
| 207 | return ret; | 207 | return ret; |
| 208 | } | 208 | } |
| 209 | 209 | ||
| 210 | iphone_error_t iphone_msync_get_all_contacts(iphone_msync_client_t client) | ||
| 211 | { | ||
| 212 | if (!client) | ||
| 213 | return IPHONE_E_INVALID_ARG; | ||
| 214 | |||
| 215 | iphone_error_t ret = IPHONE_E_UNKNOWN_ERROR; | ||
| 216 | plist_t array = NULL; | ||
| 217 | |||
| 218 | array = plist_new_array(); | ||
| 219 | plist_add_sub_string_el(array, "SDMessageSyncDataClassWithDevice"); | ||
| 220 | plist_add_sub_string_el(array, "com.apple.Contacts"); | ||
| 221 | plist_add_sub_string_el(array, "---"); | ||
| 222 | plist_add_sub_string_el(array, "2009-01-09 18:03:58 +0100"); | ||
| 223 | plist_add_sub_uint_el(array, 106); | ||
| 224 | plist_add_sub_string_el(array, "___EmptyParameterString___"); | ||
| 225 | |||
| 226 | ret = iphone_msync_send(client, array); | ||
| 227 | plist_free(array); | ||
| 228 | array = NULL; | ||
| 229 | |||
| 230 | ret = iphone_msync_recv(client, &array); | ||
| 231 | |||
| 232 | plist_t rep_node = plist_find_node_by_string(array, "SDSyncTypeSlow"); | ||
| 233 | |||
| 234 | if (!rep_node) | ||
| 235 | return ret; | ||
| 236 | |||
| 237 | plist_free(array); | ||
| 238 | array = NULL; | ||
| 239 | |||
| 240 | array = plist_new_array(); | ||
| 241 | plist_add_sub_string_el(array, "SDMessageGetAllRecordsFromDevice"); | ||
| 242 | plist_add_sub_string_el(array, "com.apple.Contacts"); | ||
| 243 | |||
| 244 | |||
| 245 | ret = iphone_msync_send(client, array); | ||
| 246 | plist_free(array); | ||
| 247 | array = NULL; | ||
| 248 | |||
| 249 | ret = iphone_msync_recv(client, &array); | ||
| 250 | |||
| 251 | plist_t contact_node; | ||
| 252 | plist_t switch_node; | ||
| 253 | |||
| 254 | contact_node = plist_find_node_by_string(array, "com.apple.Contacts"); | ||
| 255 | switch_node = plist_find_node_by_string(array, "SDMessageDeviceReadyToReceiveChanges"); | ||
| 256 | |||
| 257 | while (NULL == switch_node) { | ||
| 258 | |||
| 259 | plist_free(array); | ||
| 260 | array = NULL; | ||
| 261 | |||
| 262 | array = plist_new_array(); | ||
| 263 | plist_add_sub_string_el(array, "SDMessageAcknowledgeChangesFromDevice"); | ||
| 264 | plist_add_sub_string_el(array, "com.apple.Contacts"); | ||
| 265 | |||
| 266 | ret = iphone_msync_send(client, array); | ||
| 267 | plist_free(array); | ||
| 268 | array = NULL; | ||
| 269 | |||
| 270 | ret = iphone_msync_recv(client, &array); | ||
| 271 | |||
| 272 | contact_node = plist_find_node_by_string(array, "com.apple.Contacts"); | ||
| 273 | switch_node = plist_find_node_by_string(array, "SDMessageDeviceReadyToReceiveChanges"); | ||
| 274 | } | ||
| 275 | |||
| 276 | array = plist_new_array(); | ||
| 277 | plist_add_sub_string_el(array, "DLMessagePing"); | ||
| 278 | plist_add_sub_string_el(array, "Preparing to get changes for device"); | ||
| 279 | |||
| 280 | ret = iphone_msync_send(client, array); | ||
| 281 | plist_free(array); | ||
| 282 | array = NULL; | ||
| 283 | |||
| 284 | array = plist_new_array(); | ||
| 285 | plist_add_sub_string_el(array, "SDMessageProcessChanges"); | ||
| 286 | plist_add_sub_string_el(array, "com.apple.Contacts"); | ||
| 287 | plist_add_sub_node(array, plist_new_dict()); | ||
| 288 | plist_add_sub_bool_el(array, 0); | ||
| 289 | plist_t dict = plist_new_dict(); | ||
| 290 | plist_add_sub_node(array, dict); | ||
| 291 | plist_add_sub_key_el(dict, "SyncDeviceLinkEntityNamesKey"); | ||
| 292 | plist_t array2 = plist_new_array(); | ||
| 293 | plist_add_sub_string_el(array2, "com.apple.contacts.Contact"); | ||
| 294 | plist_add_sub_string_el(array2, "com.apple.contacts.Group"); | ||
| 295 | plist_add_sub_key_el(dict, "SyncDeviceLinkAllRecordsOfPulledEntityTypeSentKey"); | ||
| 296 | plist_add_sub_bool_el(dict, 0); | ||
| 297 | |||
| 298 | ret = iphone_msync_send(client, array); | ||
| 299 | plist_free(array); | ||
| 300 | array = NULL; | ||
| 301 | |||
| 302 | ret = iphone_msync_recv(client, &array); | ||
| 303 | plist_free(array); | ||
| 304 | array = NULL; | ||
| 305 | |||
| 306 | |||
| 307 | return ret; | ||
| 308 | } | ||
diff --git a/src/MobileSync.h b/src/MobileSync.h index 495e702..5279ce0 100644 --- a/src/MobileSync.h +++ b/src/MobileSync.h | |||
| @@ -23,16 +23,12 @@ | |||
| 23 | 23 | ||
| 24 | #include "iphone.h" | 24 | #include "iphone.h" |
| 25 | #include "utils.h" | 25 | #include "utils.h" |
| 26 | #include "libiphone/mobilesync.h" | ||
| 26 | 27 | ||
| 27 | #include <plist/plist.h> | 28 | #include <plist/plist.h> |
| 28 | 29 | ||
| 29 | 30 | struct mobilesync_client_int { | |
| 30 | |||
| 31 | struct iphone_msync_client_int { | ||
| 32 | int sfd; | 31 | int sfd; |
| 33 | }; | 32 | }; |
| 34 | 33 | ||
| 35 | |||
| 36 | iphone_error_t iphone_msync_get_all_contacts(iphone_msync_client_t client); | ||
| 37 | |||
| 38 | #endif | 34 | #endif |
diff --git a/swig/iphone.i b/swig/iphone.i index 25687f5..53fa8da 100644 --- a/swig/iphone.i +++ b/swig/iphone.i | |||
| @@ -5,6 +5,7 @@ | |||
| 5 | /* Includes the header in the wrapper code */ | 5 | /* Includes the header in the wrapper code */ |
| 6 | #include <libiphone/libiphone.h> | 6 | #include <libiphone/libiphone.h> |
| 7 | #include <libiphone/lockdown.h> | 7 | #include <libiphone/lockdown.h> |
| 8 | #include <libiphone/mobilesync.h> | ||
| 8 | #include <plist/plist.h> | 9 | #include <plist/plist.h> |
| 9 | #include "../src/utils.h" | 10 | #include "../src/utils.h" |
| 10 | typedef struct { | 11 | typedef struct { |
| @@ -18,7 +19,7 @@ | |||
| 18 | 19 | ||
| 19 | typedef struct { | 20 | typedef struct { |
| 20 | iPhone* dev; | 21 | iPhone* dev; |
| 21 | iphone_msync_client_t client; | 22 | mobilesync_client_t client; |
| 22 | } MobileSync; | 23 | } MobileSync; |
| 23 | 24 | ||
| 24 | //now declare funtions to handle creation and deletion of objects | 25 | //now declare funtions to handle creation and deletion of objects |
| @@ -50,7 +51,7 @@ typedef struct { | |||
| 50 | 51 | ||
| 51 | typedef struct { | 52 | typedef struct { |
| 52 | iPhone* dev; | 53 | iPhone* dev; |
| 53 | iphone_msync_client_t client; | 54 | mobilesync_client_t client; |
| 54 | } MobileSync; | 55 | } MobileSync; |
| 55 | 56 | ||
| 56 | %inline %{ | 57 | %inline %{ |
| @@ -93,7 +94,7 @@ MobileSync* my_new_MobileSync(Lockdownd* lckd) { | |||
| 93 | client = (MobileSync*) malloc(sizeof(MobileSync)); | 94 | client = (MobileSync*) malloc(sizeof(MobileSync)); |
| 94 | client->dev = lckd->dev; | 95 | client->dev = lckd->dev; |
| 95 | client->client = NULL; | 96 | client->client = NULL; |
| 96 | iphone_msync_new_client ( lckd->dev->dev, port, &(client->client)); | 97 | mobilesync_new_client ( lckd->dev->dev, port, &(client->client)); |
| 97 | } | 98 | } |
| 98 | return client; | 99 | return client; |
| 99 | } | 100 | } |
| @@ -165,7 +166,7 @@ MobileSync* my_new_MobileSync(Lockdownd* lckd) { | |||
| 165 | return node; | 166 | return node; |
| 166 | } | 167 | } |
| 167 | 168 | ||
| 168 | MobileSync* get_mobile_sync_client() { | 169 | MobileSync* get_mobilesync_client() { |
| 169 | return my_new_MobileSync($self); | 170 | return my_new_MobileSync($self); |
| 170 | } | 171 | } |
| 171 | }; | 172 | }; |
| @@ -176,18 +177,18 @@ MobileSync* my_new_MobileSync(Lockdownd* lckd) { | |||
| 176 | } | 177 | } |
| 177 | 178 | ||
| 178 | ~MobileSync() { | 179 | ~MobileSync() { |
| 179 | iphone_msync_free_client ( $self->client ); | 180 | mobilesync_free_client ( $self->client ); |
| 180 | free($self); | 181 | free($self); |
| 181 | } | 182 | } |
| 182 | 183 | ||
| 183 | void send(PListNode* node) { | 184 | void send(PListNode* node) { |
| 184 | iphone_msync_send($self->client, node->node); | 185 | mobilesync_send($self->client, node->node); |
| 185 | } | 186 | } |
| 186 | 187 | ||
| 187 | PListNode* receive() { | 188 | PListNode* receive() { |
| 188 | PListNode* node = (PListNode*)malloc(sizeof(PListNode)); | 189 | PListNode* node = (PListNode*)malloc(sizeof(PListNode)); |
| 189 | node->node = NULL; | 190 | node->node = NULL; |
| 190 | iphone_msync_recv($self->client, &(node->node)); | 191 | mobilesync_recv($self->client, &(node->node)); |
| 191 | return node; | 192 | return node; |
| 192 | } | 193 | } |
| 193 | }; | 194 | }; |
