summaryrefslogtreecommitdiffstats
path: root/dev
diff options
context:
space:
mode:
Diffstat (limited to 'dev')
-rw-r--r--dev/Makefile.am9
-rw-r--r--dev/lckdclient.c1
-rw-r--r--dev/main.c5
-rwxr-xr-xdev/msync.py40
-rw-r--r--dev/msyncclient.c72
5 files changed, 124 insertions, 3 deletions
diff --git a/dev/Makefile.am b/dev/Makefile.am
index 4833728..7ca7e99 100644
--- a/dev/Makefile.am
+++ b/dev/Makefile.am
@@ -3,7 +3,7 @@ INCLUDES = -I$(top_srcdir)/include
3AM_CFLAGS = $(libxml2_CFLAGS) $(libusb_CFLAGS) $(libglib2_CFLAGS) $(libgnutls_CFLAGS) $(libtasn1_CFLAGS) $(libgthread2_CFLAGS) -g 3AM_CFLAGS = $(libxml2_CFLAGS) $(libusb_CFLAGS) $(libglib2_CFLAGS) $(libgnutls_CFLAGS) $(libtasn1_CFLAGS) $(libgthread2_CFLAGS) -g
4AM_LDFLAGS = $(libxml2_LIBS) $(libusb_LIBS) $(libglib2_LIBS) $(libgnutls_LIBS) $(libtasn1_LIBS) $(libgthread2_LIBS) 4AM_LDFLAGS = $(libxml2_LIBS) $(libusb_LIBS) $(libglib2_LIBS) $(libgnutls_LIBS) $(libtasn1_LIBS) $(libgthread2_LIBS)
5 5
6bin_PROGRAMS = iphoneclient lckd-client afccheck 6bin_PROGRAMS = iphoneclient lckd-client afccheck msyncclient
7 7
8iphoneclient_SOURCES = main.c 8iphoneclient_SOURCES = main.c
9iphoneclient_LDADD = ../src/libiphone.la 9iphoneclient_LDADD = ../src/libiphone.la
@@ -16,4 +16,9 @@ lckd_client_LDADD = ../src/libiphone.la
16afccheck_SOURCES = afccheck.c 16afccheck_SOURCES = afccheck.c
17afccheck_CFLAGS = $(AM_CFLAGS) 17afccheck_CFLAGS = $(AM_CFLAGS)
18afccheck_LDFLAGS = $(AM_LDFLAGS) 18afccheck_LDFLAGS = $(AM_LDFLAGS)
19afccheck_LDADD = ../src/libiphone.la \ No newline at end of file 19afccheck_LDADD = ../src/libiphone.la
20
21msyncclient_SOURCES = msyncclient.c
22msyncclient_CFLAGS = $(AM_CFLAGS)
23msyncclient_LDFLAGS = $(AM_LDFLAGS)
24msyncclient_LDADD = ../src/libiphone.la
diff --git a/dev/lckdclient.c b/dev/lckdclient.c
index 96bc27d..c96f052 100644
--- a/dev/lckdclient.c
+++ b/dev/lckdclient.c
@@ -20,6 +20,7 @@
20 */ 20 */
21 21
22#include <stdio.h> 22#include <stdio.h>
23#include <stdlib.h>
23#include <string.h> 24#include <string.h>
24#include <glib.h> 25#include <glib.h>
25#include <readline/readline.h> 26#include <readline/readline.h>
diff --git a/dev/main.c b/dev/main.c
index 2dbfb4a..f865e52 100644
--- a/dev/main.c
+++ b/dev/main.c
@@ -28,6 +28,7 @@
28#include <libxml/tree.h> 28#include <libxml/tree.h>
29 29
30#include <libiphone/libiphone.h> 30#include <libiphone/libiphone.h>
31#include "../src/utils.h"
31 32
32 33
33int main(int argc, char *argv[]) 34int main(int argc, char *argv[])
@@ -38,8 +39,10 @@ int main(int argc, char *argv[])
38 39
39 if (argc > 1 && !strcasecmp(argv[1], "--debug")) { 40 if (argc > 1 && !strcasecmp(argv[1], "--debug")) {
40 iphone_set_debug(1); 41 iphone_set_debug(1);
42 iphone_set_debug_mask(DBGMASK_ALL);
41 } else { 43 } else {
42 iphone_set_debug(0); 44 iphone_set_debug(0);
45 iphone_set_debug_mask(DBGMASK_NONE);
43 } 46 }
44 47
45 if (IPHONE_E_SUCCESS != iphone_get_device(&phone)) { 48 if (IPHONE_E_SUCCESS != iphone_get_device(&phone)) {
@@ -87,7 +90,7 @@ int main(int argc, char *argv[])
87 iphone_afc_get_file_attr(afc, "/iTunesOnTheGoPlaylist.plist", &stbuf); 90 iphone_afc_get_file_attr(afc, "/iTunesOnTheGoPlaylist.plist", &stbuf);
88 if (IPHONE_E_SUCCESS == 91 if (IPHONE_E_SUCCESS ==
89 iphone_afc_open_file(afc, "/iTunesOnTheGoPlaylist.plist", IPHONE_AFC_FILE_READ, &my_file) && my_file) { 92 iphone_afc_open_file(afc, "/iTunesOnTheGoPlaylist.plist", IPHONE_AFC_FILE_READ, &my_file) && my_file) {
90 printf("A file size: %i\n", stbuf.st_size); 93 printf("A file size: %i\n", (int) stbuf.st_size);
91 char *file_data = (char *) malloc(sizeof(char) * stbuf.st_size); 94 char *file_data = (char *) malloc(sizeof(char) * stbuf.st_size);
92 iphone_afc_read_file(afc, my_file, file_data, stbuf.st_size, &bytes); 95 iphone_afc_read_file(afc, my_file, file_data, stbuf.st_size, &bytes);
93 if (bytes >= 0) { 96 if (bytes >= 0) {
diff --git a/dev/msync.py b/dev/msync.py
new file mode 100755
index 0000000..4170f87
--- /dev/null
+++ b/dev/msync.py
@@ -0,0 +1,40 @@
1#! /usr/bin/env python
2
3from libiphone.iPhone import *
4
5# get msync client
6def GetMobileSyncClient() :
7 phone = iPhone()
8 if not phone.InitDevice() :
9 print "Couldn't find device, is it connected ?\n"
10 return None
11 lckd = phone.GetLockdownClient()
12 if not lckd :
13 print "Failed to start lockdown service.\n"
14 return None
15 msync = lckd.GetMobileSyncClient()
16 if not msync :
17 print "Failed to start mobilesync service.\n"
18 return None
19 return msync
20
21
22msync = GetMobileSyncClient()
23
24if not msync :
25 exit(1)
26
27array = PListNode(PLIST_ARRAY)
28array.AddSubString("SDMessageSyncDataClassWithDevice")
29array.AddSubString("com.apple.Contacts");
30array.AddSubString("---");
31array.AddSubString("2009-01-13 22:25:58 +0100");
32array.AddSubUInt(106);
33array.AddSubString("___EmptyParameterString___");
34
35msync.Send(array)
36array = msync.Receive()
37print array.ToXml()
38
39
40
diff --git a/dev/msyncclient.c b/dev/msyncclient.c
new file mode 100644
index 0000000..2762f04
--- /dev/null
+++ b/dev/msyncclient.c
@@ -0,0 +1,72 @@
1/*
2 * msyncclient.c
3 * Rudimentary interface to the MobileSync iPhone
4 *
5 * Copyright (c) 2009 Jonathan Beck All Rights Reserved.
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21
22#include <stdio.h>
23#include <string.h>
24#include <errno.h>
25#include <usb.h>
26
27#include <libxml/parser.h>
28#include <libxml/tree.h>
29
30#include <libiphone/libiphone.h>
31
32
33int main(int argc, char *argv[])
34{
35 int bytes = 0, port = 0, i = 0;
36 iphone_lckd_client_t control = NULL;
37 iphone_device_t phone = NULL;
38
39 if (argc > 1 && !strcasecmp(argv[1], "--debug"))
40 iphone_set_debug_mask(DBGMASK_MOBILESYNC);
41
42
43 if (IPHONE_E_SUCCESS != iphone_get_device(&phone)) {
44 printf("No iPhone found, is it plugged in?\n");
45 return -1;
46 }
47
48 if (IPHONE_E_SUCCESS != iphone_lckd_new_client(phone, &control)) {
49 iphone_free_device(phone);
50 return -1;
51 }
52
53 iphone_lckd_start_service(control, "com.apple.mobilesync", &port);
54
55 if (port) {
56 iphone_msync_client_t msync = NULL;
57 iphone_msync_new_client(phone, 3432, port, &msync);
58 if (msync) {
59 iphone_msync_get_all_contacts(msync);
60 iphone_msync_free_client(msync);
61 }
62 } else {
63 printf("Start service failure.\n");
64 }
65
66 printf("All done.\n");
67
68 iphone_lckd_free_client(control);
69 iphone_free_device(phone);
70
71 return 0;
72}