summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile.am2
-rw-r--r--README11
-rw-r--r--configure.ac6
-rw-r--r--dev/Makefile.am24
-rw-r--r--dev/afccheck.c24
-rw-r--r--dev/filerelaytest.c16
-rw-r--r--dev/ideviceclient.c (renamed from dev/iphoneclient.c)38
-rw-r--r--dev/ideviceenterrecovery.c (renamed from dev/iphoneenterrecovery.c)22
-rw-r--r--dev/lckdclient.c18
-rwxr-xr-xdev/msync.py4
-rw-r--r--dev/msyncclient.c20
-rw-r--r--include/Makefile.am18
-rw-r--r--include/libimobiledevice/afc.h (renamed from include/libiphone/afc.h)6
-rw-r--r--include/libimobiledevice/file_relay.h (renamed from include/libiphone/file_relay.h)8
-rw-r--r--include/libimobiledevice/installation_proxy.h (renamed from include/libiphone/installation_proxy.h)6
-rw-r--r--include/libimobiledevice/libimobiledevice.h102
-rw-r--r--include/libimobiledevice/lockdown.h (renamed from include/libiphone/lockdown.h)8
-rw-r--r--include/libimobiledevice/mobilebackup.h (renamed from include/libiphone/mobilebackup.h)6
-rw-r--r--include/libimobiledevice/mobilesync.h (renamed from include/libiphone/mobilesync.h)6
-rw-r--r--include/libimobiledevice/notification_proxy.h (renamed from include/libiphone/notification_proxy.h)6
-rw-r--r--include/libimobiledevice/sbservices.h (renamed from include/libiphone/sbservices.h)6
-rw-r--r--include/libiphone/libiphone.h102
-rw-r--r--libimobiledevice-1.0.pc.in (renamed from libiphone-1.0.pc.in)6
-rw-r--r--src/Makefile.am4
-rw-r--r--src/afc.c34
-rw-r--r--src/afc.h4
-rw-r--r--src/debug.c4
-rw-r--r--src/device_link_service.c2
-rw-r--r--src/device_link_service.h2
-rw-r--r--src/file_relay.c6
-rw-r--r--src/file_relay.h2
-rw-r--r--src/idevice.c (renamed from src/iphone.c)212
-rw-r--r--src/idevice.h (renamed from src/iphone.h)16
-rw-r--r--src/installation_proxy.c2
-rw-r--r--src/installation_proxy.h2
-rw-r--r--src/lockdown.c28
-rw-r--r--src/lockdown.h2
-rw-r--r--src/mobilebackup.c6
-rw-r--r--src/mobilebackup.h2
-rw-r--r--src/mobilesync.c6
-rw-r--r--src/mobilesync.h2
-rw-r--r--src/notification_proxy.c6
-rw-r--r--src/notification_proxy.h2
-rw-r--r--src/property_list_service.c34
-rw-r--r--src/property_list_service.h6
-rw-r--r--src/sbservices.c2
-rw-r--r--src/sbservices.h2
-rw-r--r--src/userpref.c66
-rw-r--r--swig/Makefile.am32
-rw-r--r--swig/imobiledevice.i (renamed from swig/iphone.i)66
-rw-r--r--tools/Makefile.am34
-rw-r--r--tools/idevice_id.c (renamed from tools/iphone_id.c)20
-rw-r--r--tools/idevicebackup.c (renamed from tools/iphonebackup.c)36
-rw-r--r--tools/ideviceinfo.c (renamed from tools/iphoneinfo.c)28
-rw-r--r--tools/idevicesyslog.c (renamed from tools/iphonesyslog.c)36
55 files changed, 587 insertions, 584 deletions
diff --git a/Makefile.am b/Makefile.am
index 04358f9..586a02e 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -5,7 +5,7 @@ SUBDIRS = src include fdi swig dev tools
5DISTCHECK_CONFIGURE_FLAGS = --enable-dev-tools 5DISTCHECK_CONFIGURE_FLAGS = --enable-dev-tools
6 6
7pkgconfigdir = $(libdir)/pkgconfig 7pkgconfigdir = $(libdir)/pkgconfig
8pkgconfig_DATA = libiphone-1.0.pc 8pkgconfig_DATA = libimobiledevice-1.0.pc
9 9
10EXTRA_DIST= docs 10EXTRA_DIST= docs
11 11
diff --git a/README b/README
index e25c8c1..46932b2 100644
--- a/README
+++ b/README
@@ -42,6 +42,9 @@ On Ubuntu/Debian, you can do:
42Who/What/Where? 42Who/What/Where?
43=============== 43===============
44 44
45Home:
46 http://www.libimobiledevice.org/
47
45Wiki: 48Wiki:
46 http://matt.colyer.name/projects/iphone-linux/ 49 http://matt.colyer.name/projects/iphone-linux/
47 50
@@ -57,10 +60,10 @@ Mailing List:
57Credits 60Credits
58======= 61=======
59 62
60Apple, iPhone, iPod and iPod Touch are trademarks of Apple Inc. 63Apple, iPhone, iPod, and iPod Touch are trademarks of Apple Inc.
61libiphone is an independent software library and has not been authorized, 64libimobiledevice is an independent software library and has not been
62sponsored, or otherwise approved by Apple Inc. 65authorized, sponsored, or otherwise approved by Apple Inc.
63 66
64README Updated on: 67README Updated on:
65 2010-01-22 68 2010-01-28
66 69
diff --git a/configure.ac b/configure.ac
index bb5634c..a4f68f7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2,7 +2,7 @@
2# Process this file with autoconf to produce a configure script. 2# Process this file with autoconf to produce a configure script.
3 3
4AC_PREREQ(2.61) 4AC_PREREQ(2.61)
5AC_INIT(libiphone, 0.9.6, nospam@nowhere.com) 5AC_INIT(libimobiledevice, 0.9.7, nospam@nowhere.com)
6AM_INIT_AUTOMAKE([dist-bzip2 no-dist-gzip]) 6AM_INIT_AUTOMAKE([dist-bzip2 no-dist-gzip])
7m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES]) 7m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES])
8AC_CONFIG_SRCDIR([src/]) 8AC_CONFIG_SRCDIR([src/])
@@ -27,7 +27,7 @@ PKG_CHECK_MODULES(libgnutls, gnutls >= 1.6.3 )
27PKG_CHECK_MODULES(libtasn1, libtasn1 >= 1.1) 27PKG_CHECK_MODULES(libtasn1, libtasn1 >= 1.1)
28PKG_CHECK_MODULES(libplist, libplist >= 0.15) 28PKG_CHECK_MODULES(libplist, libplist >= 0.15)
29PKG_CHECK_MODULES(libplistmm, libplist++ >= 0.15) 29PKG_CHECK_MODULES(libplistmm, libplist++ >= 0.15)
30AC_CHECK_LIB(gcrypt, gcry_control, [AC_SUBST(libgcrypt_LIBS,[-lgcrypt])], ["libgcrypt is required to build libiphone"]) 30AC_CHECK_LIB(gcrypt, gcry_control, [AC_SUBST(libgcrypt_LIBS,[-lgcrypt])], ["libgcrypt is required to build libimobiledevice"])
31 31
32# Checks for header files. 32# Checks for header files.
33AC_HEADER_STDC 33AC_HEADER_STDC
@@ -137,7 +137,7 @@ fdi/Makefile
137dev/Makefile 137dev/Makefile
138tools/Makefile 138tools/Makefile
139swig/Makefile 139swig/Makefile
140libiphone-1.0.pc 140libimobiledevice-1.0.pc
141]) 141])
142 142
143echo " 143echo "
diff --git a/dev/Makefile.am b/dev/Makefile.am
index 1ca15e5..9b3ec6a 100644
--- a/dev/Makefile.am
+++ b/dev/Makefile.am
@@ -4,36 +4,36 @@ AM_CFLAGS = $(GLOBAL_CFLAGS) $(libglib2_CFLAGS) $(libgnutls_CFLAGS) $(libtasn1_C
4AM_LDFLAGS = $(libglib2_LIBS) $(libgnutls_LIBS) $(libtasn1_LIBS) $(libgthread2_LIBS) 4AM_LDFLAGS = $(libglib2_LIBS) $(libgnutls_LIBS) $(libtasn1_LIBS) $(libgthread2_LIBS)
5 5
6if ENABLE_DEVTOOLS 6if ENABLE_DEVTOOLS
7noinst_PROGRAMS = iphoneclient lckd-client afccheck msyncclient iphoneenterrecovery filerelaytest 7noinst_PROGRAMS = ideviceclient lckd-client afccheck msyncclient ideviceenterrecovery filerelaytest
8 8
9iphoneclient_SOURCES = iphoneclient.c 9ideviceclient_SOURCES = ideviceclient.c
10iphoneclient_LDADD = ../src/libiphone.la 10ideviceclient_LDADD = ../src/libimobiledevice.la
11 11
12lckd_client_SOURCES = lckdclient.c 12lckd_client_SOURCES = lckdclient.c
13lckd_client_CFLAGS = $(AM_CFLAGS) 13lckd_client_CFLAGS = $(AM_CFLAGS)
14lckd_client_LDFLAGS = -lreadline $(AM_LDFLAGS) 14lckd_client_LDFLAGS = -lreadline $(AM_LDFLAGS)
15lckd_client_LDADD = ../src/libiphone.la 15lckd_client_LDADD = ../src/libimobiledevice.la
16 16
17afccheck_SOURCES = afccheck.c 17afccheck_SOURCES = afccheck.c
18afccheck_CFLAGS = $(AM_CFLAGS) 18afccheck_CFLAGS = $(AM_CFLAGS)
19afccheck_LDFLAGS = $(AM_LDFLAGS) 19afccheck_LDFLAGS = $(AM_LDFLAGS)
20afccheck_LDADD = ../src/libiphone.la 20afccheck_LDADD = ../src/libimobiledevice.la
21 21
22msyncclient_SOURCES = msyncclient.c 22msyncclient_SOURCES = msyncclient.c
23msyncclient_CFLAGS = $(AM_CFLAGS) 23msyncclient_CFLAGS = $(AM_CFLAGS)
24msyncclient_LDFLAGS = $(AM_LDFLAGS) 24msyncclient_LDFLAGS = $(AM_LDFLAGS)
25msyncclient_LDADD = ../src/libiphone.la 25msyncclient_LDADD = ../src/libimobiledevice.la
26 26
27iphoneenterrecovery_SOURCES = iphoneenterrecovery.c 27ideviceenterrecovery_SOURCES = ideviceenterrecovery.c
28iphoneenterrecovery_CFLAGS = $(AM_CFLAGS) 28ideviceenterrecovery_CFLAGS = $(AM_CFLAGS)
29iphoneenterrecovery_LDFLAGS = $(AM_LDFLAGS) 29ideviceenterrecovery_LDFLAGS = $(AM_LDFLAGS)
30iphoneenterrecovery_LDADD = ../src/libiphone.la 30ideviceenterrecovery_LDADD = ../src/libimobiledevice.la
31 31
32filerelaytest_SOURCES = filerelaytest.c 32filerelaytest_SOURCES = filerelaytest.c
33filerelaytest_CFLAGS = $(AM_CFLAGS) 33filerelaytest_CFLAGS = $(AM_CFLAGS)
34filerelaytest_LDFLAGS = $(AM_LDFLAGS) 34filerelaytest_LDFLAGS = $(AM_LDFLAGS)
35filerelaytest_LDADD = ../src/libiphone.la 35filerelaytest_LDADD = ../src/libimobiledevice.la
36 36
37endif # ENABLE_DEVTOOLS 37endif # ENABLE_DEVTOOLS
38 38
39EXTRA_DIST = iphoneclient.c lckdclient.c afccheck.c msyncclient.c iphoneenterrecovery.c 39EXTRA_DIST = ideviceclient.c lckdclient.c afccheck.c msyncclient.c ideviceenterrecovery.c
diff --git a/dev/afccheck.c b/dev/afccheck.c
index 569acf1..b4d8910 100644
--- a/dev/afccheck.c
+++ b/dev/afccheck.c
@@ -24,9 +24,9 @@
24#include <string.h> 24#include <string.h>
25#include <glib.h> 25#include <glib.h>
26 26
27#include <libiphone/libiphone.h> 27#include <libimobiledevice/libimobiledevice.h>
28#include <libiphone/lockdown.h> 28#include <libimobiledevice/lockdown.h>
29#include <libiphone/afc.h> 29#include <libimobiledevice/afc.h>
30 30
31#define BUFFER_SIZE 20000 31#define BUFFER_SIZE 20000
32#define NB_THREADS 10 32#define NB_THREADS 10
@@ -53,7 +53,7 @@ static void check_afc(gpointer data)
53 buf[i] = ((param *) data)->id * i; 53 buf[i] = ((param *) data)->id * i;
54 } 54 }
55 55
56 //now writes buffer on iphone 56 //now writes buffer on device
57 uint64_t file = 0; 57 uint64_t file = 0;
58 char path[50]; 58 char path[50];
59 sprintf(path, "/Buf%i", ((param *) data)->id); 59 sprintf(path, "/Buf%i", ((param *) data)->id);
@@ -91,30 +91,30 @@ static void check_afc(gpointer data)
91int main(int argc, char *argv[]) 91int main(int argc, char *argv[])
92{ 92{
93 lockdownd_client_t client = NULL; 93 lockdownd_client_t client = NULL;
94 iphone_device_t phone = NULL; 94 idevice_t phone = NULL;
95 GError *err; 95 GError *err;
96 uint16_t port = 0; 96 uint16_t port = 0;
97 afc_client_t afc = NULL; 97 afc_client_t afc = NULL;
98 98
99 if (argc > 1 && !strcasecmp(argv[1], "--debug")) { 99 if (argc > 1 && !strcasecmp(argv[1], "--debug")) {
100 iphone_set_debug_level(1); 100 idevice_set_debug_level(1);
101 } else { 101 } else {
102 iphone_set_debug_level(0); 102 idevice_set_debug_level(0);
103 } 103 }
104 104
105 if (IPHONE_E_SUCCESS != iphone_device_new(&phone, NULL)) { 105 if (IDEVICE_E_SUCCESS != idevice_new(&phone, NULL)) {
106 printf("No iPhone found, is it plugged in?\n"); 106 printf("No device found, is it plugged in?\n");
107 return 1; 107 return 1;
108 } 108 }
109 109
110 if (LOCKDOWN_E_SUCCESS != lockdownd_client_new_with_handshake(phone, &client, "afccheck")) { 110 if (LOCKDOWN_E_SUCCESS != lockdownd_client_new_with_handshake(phone, &client, "afccheck")) {
111 iphone_device_free(phone); 111 idevice_free(phone);
112 return 1; 112 return 1;
113 } 113 }
114 114
115 if (LOCKDOWN_E_SUCCESS == lockdownd_start_service(client, "com.apple.afc", &port) && !port) { 115 if (LOCKDOWN_E_SUCCESS == lockdownd_start_service(client, "com.apple.afc", &port) && !port) {
116 lockdownd_client_free(client); 116 lockdownd_client_free(client);
117 iphone_device_free(phone); 117 idevice_free(phone);
118 fprintf(stderr, "Something went wrong when starting AFC."); 118 fprintf(stderr, "Something went wrong when starting AFC.");
119 return 1; 119 return 1;
120 } 120 }
@@ -140,7 +140,7 @@ int main(int argc, char *argv[])
140 } 140 }
141 141
142 lockdownd_client_free(client); 142 lockdownd_client_free(client);
143 iphone_device_free(phone); 143 idevice_free(phone);
144 144
145 return 0; 145 return 0;
146} 146}
diff --git a/dev/filerelaytest.c b/dev/filerelaytest.c
index f7e0d07..caaa491 100644
--- a/dev/filerelaytest.c
+++ b/dev/filerelaytest.c
@@ -19,17 +19,17 @@
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 */ 20 */
21#include <stdio.h> 21#include <stdio.h>
22#include <libiphone/libiphone.h> 22#include <libimobiledevice/libimobiledevice.h>
23#include <libiphone/lockdown.h> 23#include <libimobiledevice/lockdown.h>
24#include <libiphone/file_relay.h> 24#include <libimobiledevice/file_relay.h>
25 25
26int main(int argc, char **argv) 26int main(int argc, char **argv)
27{ 27{
28 iphone_device_t dev = NULL; 28 idevice_t dev = NULL;
29 lockdownd_client_t client = NULL; 29 lockdownd_client_t client = NULL;
30 file_relay_client_t frc = NULL; 30 file_relay_client_t frc = NULL;
31 31
32 if (iphone_device_new(&dev, NULL) != IPHONE_E_SUCCESS) { 32 if (idevice_new(&dev, NULL) != IDEVICE_E_SUCCESS) {
33 printf("no device connected?!\n"); 33 printf("no device connected?!\n");
34 goto leave_cleanup; 34 goto leave_cleanup;
35 } 35 }
@@ -56,7 +56,7 @@ int main(int argc, char **argv)
56 goto leave_cleanup; 56 goto leave_cleanup;
57 } 57 }
58 58
59 iphone_connection_t dump = NULL; 59 idevice_connection_t dump = NULL;
60 const char *sources[] = {"AppleSupport", "Network", "VPN", "WiFi", "UserDatabases", "CrashReporter", "tmp", "SystemConfiguration", NULL}; 60 const char *sources[] = {"AppleSupport", "Network", "VPN", "WiFi", "UserDatabases", "CrashReporter", "tmp", "SystemConfiguration", NULL};
61 61
62 printf("Requesting"); 62 printf("Requesting");
@@ -83,7 +83,7 @@ int main(int argc, char **argv)
83 FILE *f = fopen("dump.cpio.gz", "w"); 83 FILE *f = fopen("dump.cpio.gz", "w");
84 setbuf(stdout, NULL); 84 setbuf(stdout, NULL);
85 printf("receiving "); 85 printf("receiving ");
86 while (iphone_connection_receive(dump, buf, 4096, &len) == IPHONE_E_SUCCESS) { 86 while (idevice_connection_receive(dump, buf, 4096, &len) == IDEVICE_E_SUCCESS) {
87 fwrite(buf, 1, len, f); 87 fwrite(buf, 1, len, f);
88 cnt += len; 88 cnt += len;
89 printf(".", len); 89 printf(".", len);
@@ -101,7 +101,7 @@ leave_cleanup:
101 lockdownd_client_free(client); 101 lockdownd_client_free(client);
102 } 102 }
103 if (dev) { 103 if (dev) {
104 iphone_device_free(dev); 104 idevice_free(dev);
105 } 105 }
106 106
107 return 0; 107 return 0;
diff --git a/dev/iphoneclient.c b/dev/ideviceclient.c
index eab903c..2ed93d2 100644
--- a/dev/iphoneclient.c
+++ b/dev/ideviceclient.c
@@ -1,6 +1,6 @@
1/* 1/*
2 * main.c 2 * main.c
3 * Rudimentary interface to the iPhone 3 * Test program for testing several services.
4 * 4 *
5 * Copyright (c) 2008 Zach C. All Rights Reserved. 5 * Copyright (c) 2008 Zach C. All Rights Reserved.
6 * 6 *
@@ -25,10 +25,10 @@
25#include <errno.h> 25#include <errno.h>
26#include <glib.h> 26#include <glib.h>
27 27
28#include <libiphone/libiphone.h> 28#include <libimobiledevice/libimobiledevice.h>
29#include <libiphone/lockdown.h> 29#include <libimobiledevice/lockdown.h>
30#include <libiphone/afc.h> 30#include <libimobiledevice/afc.h>
31#include <libiphone/notification_proxy.h> 31#include <libimobiledevice/notification_proxy.h>
32 32
33static void notifier(const char *notification) 33static void notifier(const char *notification)
34{ 34{
@@ -37,7 +37,7 @@ static void notifier(const char *notification)
37 printf("---------------------------------------------------------\n"); 37 printf("---------------------------------------------------------\n");
38} 38}
39 39
40static void perform_notification(iphone_device_t phone, lockdownd_client_t client, const char *notification) 40static void perform_notification(idevice_t phone, lockdownd_client_t client, const char *notification)
41{ 41{
42 uint16_t nport = 0; 42 uint16_t nport = 0;
43 np_client_t np; 43 np_client_t np;
@@ -62,30 +62,30 @@ int main(int argc, char *argv[])
62 uint16_t port = 0, i = 0; 62 uint16_t port = 0, i = 0;
63 uint16_t npp; 63 uint16_t npp;
64 lockdownd_client_t client = NULL; 64 lockdownd_client_t client = NULL;
65 iphone_device_t phone = NULL; 65 idevice_t phone = NULL;
66 uint64_t lockfile = 0; 66 uint64_t lockfile = 0;
67 np_client_t gnp = NULL; 67 np_client_t gnp = NULL;
68 68
69 if (argc > 1 && !strcasecmp(argv[1], "--debug")) { 69 if (argc > 1 && !strcasecmp(argv[1], "--debug")) {
70 iphone_set_debug_level(1); 70 idevice_set_debug_level(1);
71 } else { 71 } else {
72 iphone_set_debug_level(0); 72 idevice_set_debug_level(0);
73 } 73 }
74 74
75 if (IPHONE_E_SUCCESS != iphone_device_new(&phone, NULL)) { 75 if (IDEVICE_E_SUCCESS != idevice_new(&phone, NULL)) {
76 printf("No iPhone found, is it plugged in?\n"); 76 printf("No device found, is it plugged in?\n");
77 return -1; 77 return -1;
78 } 78 }
79 79
80 char *uuid = NULL; 80 char *uuid = NULL;
81 if (IPHONE_E_SUCCESS == iphone_device_get_uuid(phone, &uuid)) { 81 if (IDEVICE_E_SUCCESS == idevice_get_uuid(phone, &uuid)) {
82 printf("DeviceUniqueID : %s\n", uuid); 82 printf("DeviceUniqueID : %s\n", uuid);
83 } 83 }
84 if (uuid) 84 if (uuid)
85 free(uuid); 85 free(uuid);
86 86
87 if (LOCKDOWN_E_SUCCESS != lockdownd_client_new_with_handshake(phone, &client, "iphoneclient")) { 87 if (LOCKDOWN_E_SUCCESS != lockdownd_client_new_with_handshake(phone, &client, "ideviceclient")) {
88 iphone_device_free(phone); 88 idevice_free(phone);
89 printf("Exiting.\n"); 89 printf("Exiting.\n");
90 return -1; 90 return -1;
91 } 91 }
@@ -154,7 +154,7 @@ int main(int argc, char *argv[])
154 uint64_t my_file = 0; 154 uint64_t my_file = 0;
155 char **info = NULL; 155 char **info = NULL;
156 uint64_t fsize = 0; 156 uint64_t fsize = 0;
157 if (AFC_E_SUCCESS == afc_get_file_info(afc, "/readme.libiphone.fx", &info) && info) { 157 if (AFC_E_SUCCESS == afc_get_file_info(afc, "/readme.libimobiledevice.fx", &info) && info) {
158 for (i = 0; info[i]; i += 2) { 158 for (i = 0; info[i]; i += 2) {
159 printf("%s: %s\n", info[i], info[i+1]); 159 printf("%s: %s\n", info[i], info[i+1]);
160 if (!strcmp(info[i], "st_size")) { 160 if (!strcmp(info[i], "st_size")) {
@@ -164,7 +164,7 @@ int main(int argc, char *argv[])
164 } 164 }
165 165
166 if (AFC_E_SUCCESS == 166 if (AFC_E_SUCCESS ==
167 afc_file_open(afc, "/readme.libiphone.fx", AFC_FOPEN_RDONLY, &my_file) && my_file) { 167 afc_file_open(afc, "/readme.libimobiledevice.fx", AFC_FOPEN_RDONLY, &my_file) && my_file) {
168 printf("A file size: %llu\n", (long long)fsize); 168 printf("A file size: %llu\n", (long long)fsize);
169 char *file_data = (char *) malloc(sizeof(char) * fsize); 169 char *file_data = (char *) malloc(sizeof(char) * fsize);
170 afc_file_read(afc, my_file, file_data, fsize, &bytes); 170 afc_file_read(afc, my_file, file_data, fsize, &bytes);
@@ -178,7 +178,7 @@ int main(int argc, char *argv[])
178 } else 178 } else
179 printf("couldn't open a file\n"); 179 printf("couldn't open a file\n");
180 180
181 afc_file_open(afc, "/readme.libiphone.fx", AFC_FOPEN_WR, &my_file); 181 afc_file_open(afc, "/readme.libimobiledevice.fx", AFC_FOPEN_WR, &my_file);
182 if (my_file) { 182 if (my_file) {
183 char *outdatafile = strdup("this is a bitchin text file\n"); 183 char *outdatafile = strdup("this is a bitchin text file\n");
184 afc_file_write(afc, my_file, outdatafile, strlen(outdatafile), &bytes); 184 afc_file_write(afc, my_file, outdatafile, strlen(outdatafile), &bytes);
@@ -204,7 +204,7 @@ int main(int argc, char *argv[])
204 printf("Failure. (expected unless you have a /renme file on your phone)\n"); 204 printf("Failure. (expected unless you have a /renme file on your phone)\n");
205 205
206 printf("Seek & read\n"); 206 printf("Seek & read\n");
207 afc_file_open(afc, "/readme.libiphone.fx", AFC_FOPEN_RDONLY, &my_file); 207 afc_file_open(afc, "/readme.libimobiledevice.fx", AFC_FOPEN_RDONLY, &my_file);
208 if (AFC_E_SUCCESS != afc_file_seek(afc, my_file, 5, SEEK_CUR)) 208 if (AFC_E_SUCCESS != afc_file_seek(afc, my_file, 5, SEEK_CUR))
209 printf("WARN: SEEK DID NOT WORK\n"); 209 printf("WARN: SEEK DID NOT WORK\n");
210 char *threeletterword = (char *) malloc(sizeof(char) * 5); 210 char *threeletterword = (char *) malloc(sizeof(char) * 5);
@@ -246,7 +246,7 @@ int main(int argc, char *argv[])
246 printf("All done.\n"); 246 printf("All done.\n");
247 247
248 lockdownd_client_free(client); 248 lockdownd_client_free(client);
249 iphone_device_free(phone); 249 idevice_free(phone);
250 250
251 return 0; 251 return 0;
252} 252}
diff --git a/dev/iphoneenterrecovery.c b/dev/ideviceenterrecovery.c
index 153df15..82ea786 100644
--- a/dev/iphoneenterrecovery.c
+++ b/dev/ideviceenterrecovery.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * iphoneenterrecovery.c 2 * ideviceenterrecovery.c
3 * Simple utility to make a device in normal mode enter recovery mode. 3 * Simple utility to make a device in normal mode enter recovery mode.
4 * 4 *
5 * Copyright (c) 2009 Martin Szulecki All Rights Reserved. 5 * Copyright (c) 2009 Martin Szulecki All Rights Reserved.
@@ -24,8 +24,8 @@
24#include <errno.h> 24#include <errno.h>
25#include <stdlib.h> 25#include <stdlib.h>
26 26
27#include <libiphone/libiphone.h> 27#include <libimobiledevice/libimobiledevice.h>
28#include <libiphone/lockdown.h> 28#include <libimobiledevice/lockdown.h>
29 29
30static void print_usage(int argc, char **argv) 30static void print_usage(int argc, char **argv)
31{ 31{
@@ -42,8 +42,8 @@ static void print_usage(int argc, char **argv)
42int main(int argc, char *argv[]) 42int main(int argc, char *argv[])
43{ 43{
44 lockdownd_client_t client = NULL; 44 lockdownd_client_t client = NULL;
45 iphone_device_t phone = NULL; 45 idevice_t phone = NULL;
46 iphone_error_t ret = IPHONE_E_UNKNOWN_ERROR; 46 idevice_error_t ret = IDEVICE_E_UNKNOWN_ERROR;
47 int i; 47 int i;
48 char uuid[41]; 48 char uuid[41];
49 uuid[0] = 0; 49 uuid[0] = 0;
@@ -51,7 +51,7 @@ int main(int argc, char *argv[])
51 /* parse cmdline args */ 51 /* parse cmdline args */
52 for (i = 1; i < argc; i++) { 52 for (i = 1; i < argc; i++) {
53 if (!strcmp(argv[i], "-d") || !strcmp(argv[i], "--debug")) { 53 if (!strcmp(argv[i], "-d") || !strcmp(argv[i], "--debug")) {
54 iphone_set_debug_level(1); 54 idevice_set_debug_level(1);
55 continue; 55 continue;
56 } 56 }
57 else if (!strcmp(argv[i], "-h") || !strcmp(argv[i], "--help")) { 57 else if (!strcmp(argv[i], "-h") || !strcmp(argv[i], "--help")) {
@@ -67,14 +67,14 @@ int main(int argc, char *argv[])
67 } 67 }
68 strcpy(uuid, argv[i]); 68 strcpy(uuid, argv[i]);
69 69
70 ret = iphone_device_new(&phone, uuid); 70 ret = idevice_new(&phone, uuid);
71 if (ret != IPHONE_E_SUCCESS) { 71 if (ret != IDEVICE_E_SUCCESS) {
72 printf("No device found with uuid %s, is it plugged in?\n", uuid); 72 printf("No device found with uuid %s, is it plugged in?\n", uuid);
73 return -1; 73 return -1;
74 } 74 }
75 75
76 if (LOCKDOWN_E_SUCCESS != lockdownd_client_new_with_handshake(phone, &client, "iphoneenterrecovery")) { 76 if (LOCKDOWN_E_SUCCESS != lockdownd_client_new_with_handshake(phone, &client, "ideviceenterrecovery")) {
77 iphone_device_free(phone); 77 idevice_free(phone);
78 return -1; 78 return -1;
79 } 79 }
80 80
@@ -87,7 +87,7 @@ int main(int argc, char *argv[])
87 printf("Device is successfully switching to recovery mode.\n"); 87 printf("Device is successfully switching to recovery mode.\n");
88 88
89 lockdownd_client_free(client); 89 lockdownd_client_free(client);
90 iphone_device_free(phone); 90 idevice_free(phone);
91 91
92 return 0; 92 return 0;
93} 93}
diff --git a/dev/lckdclient.c b/dev/lckdclient.c
index 7b7604e..773de9f 100644
--- a/dev/lckdclient.c
+++ b/dev/lckdclient.c
@@ -26,30 +26,30 @@
26#include <readline/readline.h> 26#include <readline/readline.h>
27#include <readline/history.h> 27#include <readline/history.h>
28 28
29#include <libiphone/libiphone.h> 29#include <libimobiledevice/libimobiledevice.h>
30#include <libiphone/lockdown.h> 30#include <libimobiledevice/lockdown.h>
31 31
32int main(int argc, char *argv[]) 32int main(int argc, char *argv[])
33{ 33{
34 lockdownd_client_t client = NULL; 34 lockdownd_client_t client = NULL;
35 iphone_device_t phone = NULL; 35 idevice_t phone = NULL;
36 36
37 iphone_set_debug_level(1); 37 idevice_set_debug_level(1);
38 38
39 if (IPHONE_E_SUCCESS != iphone_device_new(&phone, NULL)) { 39 if (IDEVICE_E_SUCCESS != idevice_new(&phone, NULL)) {
40 printf("No iPhone found, is it plugged in?\n"); 40 printf("No device found, is it plugged in?\n");
41 return -1; 41 return -1;
42 } 42 }
43 43
44 char *uuid = NULL; 44 char *uuid = NULL;
45 if (IPHONE_E_SUCCESS == iphone_device_get_uuid(phone, &uuid)) { 45 if (IDEVICE_E_SUCCESS == idevice_get_uuid(phone, &uuid)) {
46 printf("DeviceUniqueID : %s\n", uuid); 46 printf("DeviceUniqueID : %s\n", uuid);
47 } 47 }
48 if (uuid) 48 if (uuid)
49 free(uuid); 49 free(uuid);
50 50
51 if (LOCKDOWN_E_SUCCESS != lockdownd_client_new_with_handshake(phone, &client, "lckdclient")) { 51 if (LOCKDOWN_E_SUCCESS != lockdownd_client_new_with_handshake(phone, &client, "lckdclient")) {
52 iphone_device_free(phone); 52 idevice_free(phone);
53 return -1; 53 return -1;
54 } 54 }
55 55
@@ -109,7 +109,7 @@ int main(int argc, char *argv[])
109 } 109 }
110 clear_history(); 110 clear_history();
111 lockdownd_client_free(client); 111 lockdownd_client_free(client);
112 iphone_device_free(phone); 112 idevice_free(phone);
113 113
114 return 0; 114 return 0;
115} 115}
diff --git a/dev/msync.py b/dev/msync.py
index 6bb85d7..951355c 100755
--- a/dev/msync.py
+++ b/dev/msync.py
@@ -1,11 +1,11 @@
1#! /usr/bin/env python 1#! /usr/bin/env python
2 2
3from iphone import * 3from imobiledevice import *
4from plist import * 4from plist import *
5 5
6# get msync client 6# get msync client
7def GetMobileSyncClient() : 7def GetMobileSyncClient() :
8 phone = iPhone() 8 phone = idevice()
9 if not phone.init_device() : 9 if not phone.init_device() :
10 print "Couldn't find device, is it connected ?\n" 10 print "Couldn't find device, is it connected ?\n"
11 return None 11 return None
diff --git a/dev/msyncclient.c b/dev/msyncclient.c
index 0107240..b9e39e6 100644
--- a/dev/msyncclient.c
+++ b/dev/msyncclient.c
@@ -1,6 +1,6 @@
1/* 1/*
2 * msyncclient.c 2 * msyncclient.c
3 * Rudimentary interface to the MobileSync iPhone 3 * Rudimentary interface to the MobileSync service.
4 * 4 *
5 * Copyright (c) 2009 Jonathan Beck All Rights Reserved. 5 * Copyright (c) 2009 Jonathan Beck All Rights Reserved.
6 * 6 *
@@ -23,9 +23,9 @@
23#include <string.h> 23#include <string.h>
24#include <errno.h> 24#include <errno.h>
25 25
26#include <libiphone/libiphone.h> 26#include <libimobiledevice/libimobiledevice.h>
27#include <libiphone/lockdown.h> 27#include <libimobiledevice/lockdown.h>
28#include <libiphone/mobilesync.h> 28#include <libimobiledevice/mobilesync.h>
29 29
30static char check_string(plist_t node, char* string) 30static char check_string(plist_t node, char* string)
31{ 31{
@@ -143,18 +143,18 @@ int main(int argc, char *argv[])
143{ 143{
144 uint16_t port = 0; 144 uint16_t port = 0;
145 lockdownd_client_t client = NULL; 145 lockdownd_client_t client = NULL;
146 iphone_device_t phone = NULL; 146 idevice_t phone = NULL;
147 147
148 if (argc > 1 && !strcasecmp(argv[1], "--debug")) 148 if (argc > 1 && !strcasecmp(argv[1], "--debug"))
149 iphone_set_debug_level(1); 149 idevice_set_debug_level(1);
150 150
151 if (IPHONE_E_SUCCESS != iphone_device_new(&phone, NULL)) { 151 if (IDEVICE_E_SUCCESS != idevice_new(&phone, NULL)) {
152 printf("No iPhone found, is it plugged in?\n"); 152 printf("No device found, is it plugged in?\n");
153 return -1; 153 return -1;
154 } 154 }
155 155
156 if (LOCKDOWN_E_SUCCESS != lockdownd_client_new_with_handshake(phone, &client, "msyncclient")) { 156 if (LOCKDOWN_E_SUCCESS != lockdownd_client_new_with_handshake(phone, &client, "msyncclient")) {
157 iphone_device_free(phone); 157 idevice_free(phone);
158 return -1; 158 return -1;
159 } 159 }
160 160
@@ -174,7 +174,7 @@ int main(int argc, char *argv[])
174 printf("All done.\n"); 174 printf("All done.\n");
175 175
176 lockdownd_client_free(client); 176 lockdownd_client_free(client);
177 iphone_device_free(phone); 177 idevice_free(phone);
178 178
179 return 0; 179 return 0;
180} 180}
diff --git a/include/Makefile.am b/include/Makefile.am
index aced258..2e20332 100644
--- a/include/Makefile.am
+++ b/include/Makefile.am
@@ -1,9 +1,9 @@
1nobase_include_HEADERS = libiphone/libiphone.h \ 1nobase_include_HEADERS = libimobiledevice/libimobiledevice.h \
2 libiphone/lockdown.h \ 2 libimobiledevice/lockdown.h \
3 libiphone/afc.h \ 3 libimobiledevice/afc.h \
4 libiphone/file_relay.h \ 4 libimobiledevice/file_relay.h \
5 libiphone/notification_proxy.h \ 5 libimobiledevice/notification_proxy.h \
6 libiphone/installation_proxy.h \ 6 libimobiledevice/installation_proxy.h \
7 libiphone/sbservices.h \ 7 libimobiledevice/sbservices.h \
8 libiphone/mobilesync.h \ 8 libimobiledevice/mobilesync.h \
9 libiphone/mobilebackup.h 9 libimobiledevice/mobilebackup.h
diff --git a/include/libiphone/afc.h b/include/libimobiledevice/afc.h
index 5d09b40..5b61499 100644
--- a/include/libiphone/afc.h
+++ b/include/libimobiledevice/afc.h
@@ -1,5 +1,5 @@
1/** 1/**
2 * @file libiphone/afc.h 2 * @file libimobiledevice/afc.h
3 * @brief AFC Implementation 3 * @brief AFC Implementation
4 * \internal 4 * \internal
5 * 5 *
@@ -27,7 +27,7 @@
27extern "C" { 27extern "C" {
28#endif 28#endif
29 29
30#include <libiphone/libiphone.h> 30#include <libimobiledevice/libimobiledevice.h>
31 31
32/* Error Codes */ 32/* Error Codes */
33#define AFC_E_SUCCESS 0 33#define AFC_E_SUCCESS 0
@@ -87,7 +87,7 @@ struct afc_client_int;
87typedef struct afc_client_int *afc_client_t; 87typedef struct afc_client_int *afc_client_t;
88 88
89/* Interface */ 89/* Interface */
90afc_error_t afc_client_new(iphone_device_t device, uint16_t port, afc_client_t *client); 90afc_error_t afc_client_new(idevice_t device, uint16_t port, afc_client_t *client);
91afc_error_t afc_client_free(afc_client_t client); 91afc_error_t afc_client_free(afc_client_t client);
92afc_error_t afc_get_device_info(afc_client_t client, char ***infos); 92afc_error_t afc_get_device_info(afc_client_t client, char ***infos);
93afc_error_t afc_read_directory(afc_client_t client, const char *dir, char ***list); 93afc_error_t afc_read_directory(afc_client_t client, const char *dir, char ***list);
diff --git a/include/libiphone/file_relay.h b/include/libimobiledevice/file_relay.h
index 672f1bd..268eed8 100644
--- a/include/libiphone/file_relay.h
+++ b/include/libimobiledevice/file_relay.h
@@ -1,5 +1,5 @@
1/** 1/**
2 * @file libiphone/file_relay.h 2 * @file libimobiledevice/file_relay.h
3 * @brief file_relay Implementation 3 * @brief file_relay Implementation
4 * \internal 4 * \internal
5 * 5 *
@@ -27,7 +27,7 @@
27extern "C" { 27extern "C" {
28#endif 28#endif
29 29
30#include <libiphone/libiphone.h> 30#include <libimobiledevice/libimobiledevice.h>
31 31
32/* Error Codes */ 32/* Error Codes */
33#define FILE_RELAY_E_SUCCESS 0 33#define FILE_RELAY_E_SUCCESS 0
@@ -44,10 +44,10 @@ typedef int16_t file_relay_error_t;
44struct file_relay_client_int; 44struct file_relay_client_int;
45typedef struct file_relay_client_int *file_relay_client_t; 45typedef struct file_relay_client_int *file_relay_client_t;
46 46
47file_relay_error_t file_relay_client_new(iphone_device_t device, uint16_t port, file_relay_client_t *client); 47file_relay_error_t file_relay_client_new(idevice_t device, uint16_t port, file_relay_client_t *client);
48file_relay_error_t file_relay_client_free(file_relay_client_t client); 48file_relay_error_t file_relay_client_free(file_relay_client_t client);
49 49
50file_relay_error_t file_relay_request_sources(file_relay_client_t client, const char **sources, iphone_connection_t *connection); 50file_relay_error_t file_relay_request_sources(file_relay_client_t client, const char **sources, idevice_connection_t *connection);
51 51
52#ifdef __cplusplus 52#ifdef __cplusplus
53} 53}
diff --git a/include/libiphone/installation_proxy.h b/include/libimobiledevice/installation_proxy.h
index b7bbb60..22e76b1 100644
--- a/include/libiphone/installation_proxy.h
+++ b/include/libimobiledevice/installation_proxy.h
@@ -1,5 +1,5 @@
1/** 1/**
2 * @file libiphone/installation_proxy.h 2 * @file libimobiledevice/installation_proxy.h
3 * @brief Implementation to talk to the installation proxy on a device 3 * @brief Implementation to talk to the installation proxy on a device
4 * \internal 4 * \internal
5 * 5 *
@@ -27,7 +27,7 @@
27extern "C" { 27extern "C" {
28#endif 28#endif
29 29
30#include <libiphone/libiphone.h> 30#include <libimobiledevice/libimobiledevice.h>
31#include <glib.h> 31#include <glib.h>
32 32
33/* Error Codes */ 33/* Error Codes */
@@ -48,7 +48,7 @@ typedef struct instproxy_client_int *instproxy_client_t;
48typedef void (*instproxy_status_cb_t) (const char *operation, plist_t status); 48typedef void (*instproxy_status_cb_t) (const char *operation, plist_t status);
49 49
50/* Interface */ 50/* Interface */
51instproxy_error_t instproxy_client_new(iphone_device_t device, uint16_t port, instproxy_client_t *client); 51instproxy_error_t instproxy_client_new(idevice_t device, uint16_t port, instproxy_client_t *client);
52instproxy_error_t instproxy_client_free(instproxy_client_t client); 52instproxy_error_t instproxy_client_free(instproxy_client_t client);
53 53
54instproxy_error_t instproxy_browse(instproxy_client_t client, plist_t client_options, plist_t *result); 54instproxy_error_t instproxy_browse(instproxy_client_t client, plist_t client_options, plist_t *result);
diff --git a/include/libimobiledevice/libimobiledevice.h b/include/libimobiledevice/libimobiledevice.h
new file mode 100644
index 0000000..87b078a
--- /dev/null
+++ b/include/libimobiledevice/libimobiledevice.h
@@ -0,0 +1,102 @@
1/**
2 * @file libimobiledevice/libimobiledevice.h
3 * @brief Common code and device handling
4 * \internal
5 *
6 * Copyright (c) 2008 Jonathan Beck All Rights Reserved.
7 *
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
12 *
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 */
22
23#ifndef LIBIMOBILEDEVICE_H
24#define LIBIMOBILEDEVICE_H
25
26#ifdef __cplusplus
27extern "C" {
28#endif
29
30#include <stdint.h>
31#include <sys/types.h>
32#include <sys/stat.h>
33#include <plist/plist.h>
34
35/* Error Codes */
36#define IDEVICE_E_SUCCESS 0
37#define IDEVICE_E_INVALID_ARG -1
38#define IDEVICE_E_UNKNOWN_ERROR -2
39#define IDEVICE_E_NO_DEVICE -3
40#define IDEVICE_E_NOT_ENOUGH_DATA -4
41#define IDEVICE_E_BAD_HEADER -5
42#define IDEVICE_E_SSL_ERROR -6
43
44typedef int16_t idevice_error_t;
45
46struct idevice_int;
47typedef struct idevice_int *idevice_t;
48
49struct idevice_connection_int;
50typedef struct idevice_connection_int *idevice_connection_t;
51
52/* generic */
53void idevice_set_debug_level(int level);
54
55/* discovery (events/asynchronous) */
56// event type
57enum idevice_event_type {
58 IDEVICE_DEVICE_ADD = 1,
59 IDEVICE_DEVICE_REMOVE
60};
61
62// event data structure
63typedef struct {
64 enum idevice_event_type event;
65 const char *uuid;
66 int conn_type;
67} idevice_event_t;
68
69// event callback function prototype
70typedef void (*idevice_event_cb_t) (const idevice_event_t *event, void *user_data);
71
72// functions
73idevice_error_t idevice_event_subscribe(idevice_event_cb_t callback, void *user_data);
74idevice_error_t idevice_event_unsubscribe();
75
76/* discovery (synchronous) */
77idevice_error_t idevice_get_device_list(char ***devices, int *count);
78idevice_error_t idevice_device_list_free(char **devices);
79
80/* device structure creation and destruction */
81idevice_error_t idevice_new(idevice_t *device, const char *uuid);
82idevice_error_t idevice_free(idevice_t device);
83
84/* connection/disconnection */
85idevice_error_t idevice_connect(idevice_t device, uint16_t port, idevice_connection_t *connection);
86idevice_error_t idevice_disconnect(idevice_connection_t connection);
87
88/* communication */
89idevice_error_t idevice_connection_send(idevice_connection_t connection, const char *data, uint32_t len, uint32_t *sent_bytes);
90idevice_error_t idevice_connection_receive_timeout(idevice_connection_t connection, char *data, uint32_t len, uint32_t *recv_bytes, unsigned int timeout);
91idevice_error_t idevice_connection_receive(idevice_connection_t connection, char *data, uint32_t len, uint32_t *recv_bytes);
92
93/* misc */
94idevice_error_t idevice_get_handle(idevice_t device, uint32_t *handle);
95idevice_error_t idevice_get_uuid(idevice_t device, char **uuid);
96
97#ifdef __cplusplus
98}
99#endif
100
101#endif
102
diff --git a/include/libiphone/lockdown.h b/include/libimobiledevice/lockdown.h
index 003a99b..49c708d 100644
--- a/include/libiphone/lockdown.h
+++ b/include/libimobiledevice/lockdown.h
@@ -1,5 +1,5 @@
1/** 1/**
2 * @file libiphone/lockdown.h 2 * @file libimobiledevice/lockdown.h
3 * @brief Communcation with the lockdown device daemon 3 * @brief Communcation with the lockdown device daemon
4 * \internal 4 * \internal
5 * 5 *
@@ -28,7 +28,7 @@
28extern "C" { 28extern "C" {
29#endif 29#endif
30 30
31#include <libiphone/libiphone.h> 31#include <libimobiledevice/libimobiledevice.h>
32 32
33/* Error Codes */ 33/* Error Codes */
34#define LOCKDOWN_E_SUCCESS 0 34#define LOCKDOWN_E_SUCCESS 0
@@ -66,8 +66,8 @@ struct lockdownd_pair_record {
66typedef struct lockdownd_pair_record *lockdownd_pair_record_t; 66typedef struct lockdownd_pair_record *lockdownd_pair_record_t;
67 67
68/* Interface */ 68/* Interface */
69lockdownd_error_t lockdownd_client_new(iphone_device_t device, lockdownd_client_t *client, const char *label); 69lockdownd_error_t lockdownd_client_new(idevice_t device, lockdownd_client_t *client, const char *label);
70lockdownd_error_t lockdownd_client_new_with_handshake(iphone_device_t device, lockdownd_client_t *client, const char *label); 70lockdownd_error_t lockdownd_client_new_with_handshake(idevice_t device, lockdownd_client_t *client, const char *label);
71lockdownd_error_t lockdownd_client_free(lockdownd_client_t client); 71lockdownd_error_t lockdownd_client_free(lockdownd_client_t client);
72 72
73lockdownd_error_t lockdownd_query_type(lockdownd_client_t client, char **type); 73lockdownd_error_t lockdownd_query_type(lockdownd_client_t client, char **type);
diff --git a/include/libiphone/mobilebackup.h b/include/libimobiledevice/mobilebackup.h
index 8db6758..e51d4c1 100644
--- a/include/libiphone/mobilebackup.h
+++ b/include/libimobiledevice/mobilebackup.h
@@ -1,5 +1,5 @@
1/** 1/**
2 * @file libiphone/mobilebackup.h 2 * @file libimobiledevice/mobilebackup.h
3 * @brief MobileBackup Implementation 3 * @brief MobileBackup Implementation
4 * \internal 4 * \internal
5 * 5 *
@@ -27,7 +27,7 @@
27extern "C" { 27extern "C" {
28#endif 28#endif
29 29
30#include <libiphone/libiphone.h> 30#include <libimobiledevice/libimobiledevice.h>
31 31
32/* Error Codes */ 32/* Error Codes */
33#define MOBILEBACKUP_E_SUCCESS 0 33#define MOBILEBACKUP_E_SUCCESS 0
@@ -43,7 +43,7 @@ typedef int16_t mobilebackup_error_t;
43struct mobilebackup_client_int; 43struct mobilebackup_client_int;
44typedef struct mobilebackup_client_int *mobilebackup_client_t; 44typedef struct mobilebackup_client_int *mobilebackup_client_t;
45 45
46mobilebackup_error_t mobilebackup_client_new(iphone_device_t device, uint16_t port, mobilebackup_client_t * client); 46mobilebackup_error_t mobilebackup_client_new(idevice_t device, uint16_t port, mobilebackup_client_t * client);
47mobilebackup_error_t mobilebackup_client_free(mobilebackup_client_t client); 47mobilebackup_error_t mobilebackup_client_free(mobilebackup_client_t client);
48mobilebackup_error_t mobilebackup_receive(mobilebackup_client_t client, plist_t *plist); 48mobilebackup_error_t mobilebackup_receive(mobilebackup_client_t client, plist_t *plist);
49mobilebackup_error_t mobilebackup_send(mobilebackup_client_t client, plist_t plist); 49mobilebackup_error_t mobilebackup_send(mobilebackup_client_t client, plist_t plist);
diff --git a/include/libiphone/mobilesync.h b/include/libimobiledevice/mobilesync.h
index f85113d..349b6a3 100644
--- a/include/libiphone/mobilesync.h
+++ b/include/libimobiledevice/mobilesync.h
@@ -1,5 +1,5 @@
1/** 1/**
2 * @file libiphone/mobilesync.h 2 * @file libimobiledevice/mobilesync.h
3 * @brief MobileSync Implementation 3 * @brief MobileSync Implementation
4 * \internal 4 * \internal
5 * 5 *
@@ -27,7 +27,7 @@
27extern "C" { 27extern "C" {
28#endif 28#endif
29 29
30#include <libiphone/libiphone.h> 30#include <libimobiledevice/libimobiledevice.h>
31 31
32/* Error Codes */ 32/* Error Codes */
33#define MOBILESYNC_E_SUCCESS 0 33#define MOBILESYNC_E_SUCCESS 0
@@ -43,7 +43,7 @@ typedef int16_t mobilesync_error_t;
43struct mobilesync_client_int; 43struct mobilesync_client_int;
44typedef struct mobilesync_client_int *mobilesync_client_t; 44typedef struct mobilesync_client_int *mobilesync_client_t;
45 45
46mobilesync_error_t mobilesync_client_new(iphone_device_t device, uint16_t port, mobilesync_client_t * client); 46mobilesync_error_t mobilesync_client_new(idevice_t device, uint16_t port, mobilesync_client_t * client);
47mobilesync_error_t mobilesync_client_free(mobilesync_client_t client); 47mobilesync_error_t mobilesync_client_free(mobilesync_client_t client);
48mobilesync_error_t mobilesync_receive(mobilesync_client_t client, plist_t *plist); 48mobilesync_error_t mobilesync_receive(mobilesync_client_t client, plist_t *plist);
49mobilesync_error_t mobilesync_send(mobilesync_client_t client, plist_t plist); 49mobilesync_error_t mobilesync_send(mobilesync_client_t client, plist_t plist);
diff --git a/include/libiphone/notification_proxy.h b/include/libimobiledevice/notification_proxy.h
index 962dd9b..adbb4cc 100644
--- a/include/libiphone/notification_proxy.h
+++ b/include/libimobiledevice/notification_proxy.h
@@ -1,5 +1,5 @@
1/** 1/**
2 * @file libiphone/notification_proxy.h 2 * @file libimobiledevice/notification_proxy.h
3 * @brief Implementation to talk to the notification proxy on a device 3 * @brief Implementation to talk to the notification proxy on a device
4 * \internal 4 * \internal
5 * 5 *
@@ -27,7 +27,7 @@
27extern "C" { 27extern "C" {
28#endif 28#endif
29 29
30#include <libiphone/libiphone.h> 30#include <libimobiledevice/libimobiledevice.h>
31 31
32/* Error Codes */ 32/* Error Codes */
33#define NP_E_SUCCESS 0 33#define NP_E_SUCCESS 0
@@ -74,7 +74,7 @@ typedef struct np_client_int *np_client_t;
74typedef void (*np_notify_cb_t) (const char *notification); 74typedef void (*np_notify_cb_t) (const char *notification);
75 75
76/* Interface */ 76/* Interface */
77np_error_t np_client_new(iphone_device_t device, uint16_t port, np_client_t *client); 77np_error_t np_client_new(idevice_t device, uint16_t port, np_client_t *client);
78np_error_t np_client_free(np_client_t client); 78np_error_t np_client_free(np_client_t client);
79np_error_t np_post_notification(np_client_t client, const char *notification); 79np_error_t np_post_notification(np_client_t client, const char *notification);
80np_error_t np_observe_notification(np_client_t client, const char *notification); 80np_error_t np_observe_notification(np_client_t client, const char *notification);
diff --git a/include/libiphone/sbservices.h b/include/libimobiledevice/sbservices.h
index 3e4accb..921d6be 100644
--- a/include/libiphone/sbservices.h
+++ b/include/libimobiledevice/sbservices.h
@@ -1,5 +1,5 @@
1/** 1/**
2 * @file libiphone/sbservices.h 2 * @file libimobiledevice/sbservices.h
3 * @brief Implementation to talk to com.apple.springboardservices on a device 3 * @brief Implementation to talk to com.apple.springboardservices on a device
4 * \internal 4 * \internal
5 * 5 *
@@ -27,7 +27,7 @@
27extern "C" { 27extern "C" {
28#endif 28#endif
29 29
30#include <libiphone/libiphone.h> 30#include <libimobiledevice/libimobiledevice.h>
31 31
32/* Error Codes */ 32/* Error Codes */
33#define SBSERVICES_E_SUCCESS 0 33#define SBSERVICES_E_SUCCESS 0
@@ -43,7 +43,7 @@ struct sbservices_client_int;
43typedef struct sbservices_client_int *sbservices_client_t; 43typedef struct sbservices_client_int *sbservices_client_t;
44 44
45/* Interface */ 45/* Interface */
46sbservices_error_t sbservices_client_new(iphone_device_t device, uint16_t port, sbservices_client_t *client); 46sbservices_error_t sbservices_client_new(idevice_t device, uint16_t port, sbservices_client_t *client);
47sbservices_error_t sbservices_client_free(sbservices_client_t client); 47sbservices_error_t sbservices_client_free(sbservices_client_t client);
48sbservices_error_t sbservices_get_icon_state(sbservices_client_t client, plist_t *state); 48sbservices_error_t sbservices_get_icon_state(sbservices_client_t client, plist_t *state);
49sbservices_error_t sbservices_set_icon_state(sbservices_client_t client, plist_t newstate); 49sbservices_error_t sbservices_set_icon_state(sbservices_client_t client, plist_t newstate);
diff --git a/include/libiphone/libiphone.h b/include/libiphone/libiphone.h
deleted file mode 100644
index efe9a63..0000000
--- a/include/libiphone/libiphone.h
+++ /dev/null
@@ -1,102 +0,0 @@
1/**
2 * @file libiphone/libiphone.h
3 * @brief Common code and device handling
4 * \internal
5 *
6 * Copyright (c) 2008 Jonathan Beck All Rights Reserved.
7 *
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
12 *
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 */
22
23#ifndef LIBIPHONE_H
24#define LIBIPHONE_H
25
26#ifdef __cplusplus
27extern "C" {
28#endif
29
30#include <stdint.h>
31#include <sys/types.h>
32#include <sys/stat.h>
33#include <plist/plist.h>
34
35/* Error Codes */
36#define IPHONE_E_SUCCESS 0
37#define IPHONE_E_INVALID_ARG -1
38#define IPHONE_E_UNKNOWN_ERROR -2
39#define IPHONE_E_NO_DEVICE -3
40#define IPHONE_E_NOT_ENOUGH_DATA -4
41#define IPHONE_E_BAD_HEADER -5
42#define IPHONE_E_SSL_ERROR -6
43
44typedef int16_t iphone_error_t;
45
46struct iphone_device_int;
47typedef struct iphone_device_int *iphone_device_t;
48
49struct iphone_connection_int;
50typedef struct iphone_connection_int *iphone_connection_t;
51
52/* generic */
53void iphone_set_debug_level(int level);
54
55/* discovery (events/asynchronous) */
56// event type
57enum iphone_event_type {
58 IPHONE_DEVICE_ADD = 1,
59 IPHONE_DEVICE_REMOVE
60};
61
62// event data structure
63typedef struct {
64 enum iphone_event_type event;
65 const char *uuid;
66 int conn_type;
67} iphone_event_t;
68
69// event callback function prototype
70typedef void (*iphone_event_cb_t) (const iphone_event_t *event, void *user_data);
71
72// functions
73iphone_error_t iphone_event_subscribe(iphone_event_cb_t callback, void *user_data);
74iphone_error_t iphone_event_unsubscribe();
75
76/* discovery (synchronous) */
77iphone_error_t iphone_get_device_list(char ***devices, int *count);
78iphone_error_t iphone_device_list_free(char **devices);
79
80/* device structure creation and destruction */
81iphone_error_t iphone_device_new(iphone_device_t *device, const char *uuid);
82iphone_error_t iphone_device_free(iphone_device_t device);
83
84/* connection/disconnection */
85iphone_error_t iphone_device_connect(iphone_device_t device, uint16_t port, iphone_connection_t *connection);
86iphone_error_t iphone_device_disconnect(iphone_connection_t connection);
87
88/* communication */
89iphone_error_t iphone_connection_send(iphone_connection_t connection, const char *data, uint32_t len, uint32_t *sent_bytes);
90iphone_error_t iphone_connection_receive_timeout(iphone_connection_t connection, char *data, uint32_t len, uint32_t *recv_bytes, unsigned int timeout);
91iphone_error_t iphone_connection_receive(iphone_connection_t connection, char *data, uint32_t len, uint32_t *recv_bytes);
92
93/* misc */
94iphone_error_t iphone_device_get_handle(iphone_device_t device, uint32_t *handle);
95iphone_error_t iphone_device_get_uuid(iphone_device_t device, char **uuid);
96
97#ifdef __cplusplus
98}
99#endif
100
101#endif
102
diff --git a/libiphone-1.0.pc.in b/libimobiledevice-1.0.pc.in
index 323a73d..526edcf 100644
--- a/libiphone-1.0.pc.in
+++ b/libimobiledevice-1.0.pc.in
@@ -3,10 +3,10 @@ exec_prefix=@exec_prefix@
3libdir=@libdir@ 3libdir=@libdir@
4includedir=@includedir@ 4includedir=@includedir@
5 5
6Name: libiphone 6Name: libimobiledevice
7Description: A library to communicate with the Lockdown server on the iPhone 7Description: A library to communicate with services running on Apple iPhone/iPod Touch devices.
8Version: @VERSION@ 8Version: @VERSION@
9Requires: libplist >= 0.12 libusbmuxd >= 0.1.0 glib-2.0 >= 2.14.1 gthread-2.0 >= 2.14.1 gnutls >= 1.6.3 libtasn1 >= 1.1 9Requires: libplist >= 0.12 libusbmuxd >= 0.1.0 glib-2.0 >= 2.14.1 gthread-2.0 >= 2.14.1 gnutls >= 1.6.3 libtasn1 >= 1.1
10Libs: -L${libdir} -liphone 10Libs: -L${libdir} -limobiledevice
11Cflags: -I${includedir} 11Cflags: -I${includedir}
12 12
diff --git a/src/Makefile.am b/src/Makefile.am
index 93cfbaf..69bbd9b 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -3,8 +3,8 @@ INCLUDES = -I$(top_srcdir)/include
3AM_CFLAGS = $(GLOBAL_CFLAGS) $(libusbmuxd_CFLAGS) $(libglib2_CFLAGS) $(libgnutls_CFLAGS) $(libtasn1_CFLAGS) $(libgthread2_CFLAGS) $(libplist_CFLAGS) $(LFS_CFLAGS) 3AM_CFLAGS = $(GLOBAL_CFLAGS) $(libusbmuxd_CFLAGS) $(libglib2_CFLAGS) $(libgnutls_CFLAGS) $(libtasn1_CFLAGS) $(libgthread2_CFLAGS) $(libplist_CFLAGS) $(LFS_CFLAGS)
4AM_LDFLAGS = $(libglib2_LIBS) $(libgnutls_LIBS) $(libtasn1_LIBS) $(libgthread2_LIBS) $(libplist_LIBS) $(libusbmuxd_LIBS) $(libgcrypt_LIBS) 4AM_LDFLAGS = $(libglib2_LIBS) $(libgnutls_LIBS) $(libtasn1_LIBS) $(libgthread2_LIBS) $(libplist_LIBS) $(libusbmuxd_LIBS) $(libgcrypt_LIBS)
5 5
6lib_LTLIBRARIES = libiphone.la 6lib_LTLIBRARIES = libimobiledevice.la
7libiphone_la_SOURCES = iphone.c iphone.h \ 7libimobiledevice_la_SOURCES = idevice.c idevice.h \
8 debug.c debug.h\ 8 debug.c debug.h\
9 userpref.c userpref.h\ 9 userpref.c userpref.h\
10 property_list_service.c property_list_service.h\ 10 property_list_service.c property_list_service.h\
diff --git a/src/afc.c b/src/afc.c
index 767e460..4367add 100644
--- a/src/afc.c
+++ b/src/afc.c
@@ -24,7 +24,7 @@
24#include <unistd.h> 24#include <unistd.h>
25 25
26#include "afc.h" 26#include "afc.h"
27#include "iphone.h" 27#include "idevice.h"
28#include "debug.h" 28#include "debug.h"
29 29
30// This is the maximum size an AFC data packet can be 30// This is the maximum size an AFC data packet can be
@@ -61,7 +61,7 @@ static void afc_unlock(afc_client_t client)
61 * is invalid, AFC_E_MUX_ERROR when the connection failed, or AFC_E_NO_MEM 61 * is invalid, AFC_E_MUX_ERROR when the connection failed, or AFC_E_NO_MEM
62 * when there's a memory allocation problem. 62 * when there's a memory allocation problem.
63 */ 63 */
64afc_error_t afc_client_new(iphone_device_t device, uint16_t port, afc_client_t * client) 64afc_error_t afc_client_new(idevice_t device, uint16_t port, afc_client_t * client)
65{ 65{
66 /* makes sure thread environment is available */ 66 /* makes sure thread environment is available */
67 if (!g_thread_supported()) 67 if (!g_thread_supported())
@@ -71,8 +71,8 @@ afc_error_t afc_client_new(iphone_device_t device, uint16_t port, afc_client_t *
71 return AFC_E_INVALID_ARGUMENT; 71 return AFC_E_INVALID_ARGUMENT;
72 72
73 /* attempt connection */ 73 /* attempt connection */
74 iphone_connection_t connection = NULL; 74 idevice_connection_t connection = NULL;
75 if (iphone_device_connect(device, port, &connection) != IPHONE_E_SUCCESS) { 75 if (idevice_connect(device, port, &connection) != IDEVICE_E_SUCCESS) {
76 return AFC_E_MUX_ERROR; 76 return AFC_E_MUX_ERROR;
77 } 77 }
78 78
@@ -82,7 +82,7 @@ afc_error_t afc_client_new(iphone_device_t device, uint16_t port, afc_client_t *
82 /* allocate a packet */ 82 /* allocate a packet */
83 client_loc->afc_packet = (AFCPacket *) malloc(sizeof(AFCPacket)); 83 client_loc->afc_packet = (AFCPacket *) malloc(sizeof(AFCPacket));
84 if (!client_loc->afc_packet) { 84 if (!client_loc->afc_packet) {
85 iphone_device_disconnect(client_loc->connection); 85 idevice_disconnect(client_loc->connection);
86 free(client_loc); 86 free(client_loc);
87 return AFC_E_NO_MEM; 87 return AFC_E_NO_MEM;
88 } 88 }
@@ -108,7 +108,7 @@ afc_error_t afc_client_free(afc_client_t client)
108 if (!client || !client->connection || !client->afc_packet) 108 if (!client || !client->connection || !client->afc_packet)
109 return AFC_E_INVALID_ARGUMENT; 109 return AFC_E_INVALID_ARGUMENT;
110 110
111 iphone_device_disconnect(client->connection); 111 idevice_disconnect(client->connection);
112 free(client->afc_packet); 112 free(client->afc_packet);
113 if (client->mutex) { 113 if (client->mutex) {
114 g_mutex_free(client->mutex); 114 g_mutex_free(client->mutex);
@@ -169,7 +169,7 @@ static afc_error_t afc_dispatch_packet(afc_client_t client, const char *data, ui
169 /* send AFC packet header */ 169 /* send AFC packet header */
170 AFCPacket_to_LE(client->afc_packet); 170 AFCPacket_to_LE(client->afc_packet);
171 sent = 0; 171 sent = 0;
172 iphone_connection_send(client->connection, (void*)client->afc_packet, sizeof(AFCPacket), &sent); 172 idevice_connection_send(client->connection, (void*)client->afc_packet, sizeof(AFCPacket), &sent);
173 if (sent == 0) { 173 if (sent == 0) {
174 /* FIXME: should this be handled as success?! */ 174 /* FIXME: should this be handled as success?! */
175 return AFC_E_SUCCESS; 175 return AFC_E_SUCCESS;
@@ -178,7 +178,7 @@ static afc_error_t afc_dispatch_packet(afc_client_t client, const char *data, ui
178 178
179 /* send AFC packet data */ 179 /* send AFC packet data */
180 sent = 0; 180 sent = 0;
181 iphone_connection_send(client->connection, data, offset, &sent); 181 idevice_connection_send(client->connection, data, offset, &sent);
182 if (sent == 0) { 182 if (sent == 0) {
183 return AFC_E_SUCCESS; 183 return AFC_E_SUCCESS;
184 } 184 }
@@ -190,7 +190,7 @@ static afc_error_t afc_dispatch_packet(afc_client_t client, const char *data, ui
190 debug_buffer(data + offset, length - offset); 190 debug_buffer(data + offset, length - offset);
191 191
192 sent = 0; 192 sent = 0;
193 iphone_connection_send(client->connection, data + offset, length - offset, &sent); 193 idevice_connection_send(client->connection, data + offset, length - offset, &sent);
194 194
195 *bytes_sent = sent; 195 *bytes_sent = sent;
196 return AFC_E_SUCCESS; 196 return AFC_E_SUCCESS;
@@ -203,7 +203,7 @@ static afc_error_t afc_dispatch_packet(afc_client_t client, const char *data, ui
203 /* send AFC packet header */ 203 /* send AFC packet header */
204 AFCPacket_to_LE(client->afc_packet); 204 AFCPacket_to_LE(client->afc_packet);
205 sent = 0; 205 sent = 0;
206 iphone_connection_send(client->connection, (void*)client->afc_packet, sizeof(AFCPacket), &sent); 206 idevice_connection_send(client->connection, (void*)client->afc_packet, sizeof(AFCPacket), &sent);
207 if (sent == 0) { 207 if (sent == 0) {
208 return AFC_E_SUCCESS; 208 return AFC_E_SUCCESS;
209 } 209 }
@@ -213,7 +213,7 @@ static afc_error_t afc_dispatch_packet(afc_client_t client, const char *data, ui
213 debug_info("packet data follows"); 213 debug_info("packet data follows");
214 214
215 debug_buffer(data, length); 215 debug_buffer(data, length);
216 iphone_connection_send(client->connection, data, length, &sent); 216 idevice_connection_send(client->connection, data, length, &sent);
217 *bytes_sent += sent; 217 *bytes_sent += sent;
218 } 218 }
219 return AFC_E_SUCCESS; 219 return AFC_E_SUCCESS;
@@ -241,7 +241,7 @@ static afc_error_t afc_receive_data(afc_client_t client, char **dump_here, uint3
241 *bytes_recv = 0; 241 *bytes_recv = 0;
242 242
243 /* first, read the AFC header */ 243 /* first, read the AFC header */
244 iphone_connection_receive(client->connection, (char*)&header, sizeof(AFCPacket), bytes_recv); 244 idevice_connection_receive(client->connection, (char*)&header, sizeof(AFCPacket), bytes_recv);
245 AFCPacket_from_LE(&header); 245 AFCPacket_from_LE(&header);
246 if (*bytes_recv == 0) { 246 if (*bytes_recv == 0) {
247 debug_info("Just didn't get enough."); 247 debug_info("Just didn't get enough.");
@@ -295,7 +295,7 @@ static afc_error_t afc_receive_data(afc_client_t client, char **dump_here, uint3
295 295
296 *dump_here = (char*)malloc(entire_len); 296 *dump_here = (char*)malloc(entire_len);
297 if (this_len > 0) { 297 if (this_len > 0) {
298 iphone_connection_receive(client->connection, *dump_here, this_len, bytes_recv); 298 idevice_connection_receive(client->connection, *dump_here, this_len, bytes_recv);
299 if (*bytes_recv <= 0) { 299 if (*bytes_recv <= 0) {
300 free(*dump_here); 300 free(*dump_here);
301 *dump_here = NULL; 301 *dump_here = NULL;
@@ -313,7 +313,7 @@ static afc_error_t afc_receive_data(afc_client_t client, char **dump_here, uint3
313 313
314 if (entire_len > this_len) { 314 if (entire_len > this_len) {
315 while (current_count < entire_len) { 315 while (current_count < entire_len) {
316 iphone_connection_receive(client->connection, (*dump_here)+current_count, entire_len - current_count, bytes_recv); 316 idevice_connection_receive(client->connection, (*dump_here)+current_count, entire_len - current_count, bytes_recv);
317 if (*bytes_recv <= 0) { 317 if (*bytes_recv <= 0) {
318 debug_info("Error receiving data (recv returned %d)", *bytes_recv); 318 debug_info("Error receiving data (recv returned %d)", *bytes_recv);
319 break; 319 break;
@@ -701,7 +701,7 @@ afc_error_t afc_get_file_info(afc_client_t client, const char *path, char ***inf
701 * 701 *
702 * @return AFC_E_SUCCESS on success or an AFC_E_* error on failure. 702 * @return AFC_E_SUCCESS on success or an AFC_E_* error on failure.
703 */ 703 */
704iphone_error_t 704idevice_error_t
705afc_file_open(afc_client_t client, const char *filename, 705afc_file_open(afc_client_t client, const char *filename,
706 afc_file_mode_t file_mode, uint64_t *handle) 706 afc_file_mode_t file_mode, uint64_t *handle)
707{ 707{
@@ -760,7 +760,7 @@ afc_file_open(afc_client_t client, const char *filename,
760 * 760 *
761 * @return AFC_E_SUCCESS on success or an AFC_E_* error value on error. 761 * @return AFC_E_SUCCESS on success or an AFC_E_* error value on error.
762 */ 762 */
763iphone_error_t 763idevice_error_t
764afc_file_read(afc_client_t client, uint64_t handle, char *data, uint32_t length, uint32_t *bytes_read) 764afc_file_read(afc_client_t client, uint64_t handle, char *data, uint32_t length, uint32_t *bytes_read)
765{ 765{
766 char *input = NULL; 766 char *input = NULL;
@@ -833,7 +833,7 @@ afc_file_read(afc_client_t client, uint64_t handle, char *data, uint32_t length,
833 * 833 *
834 * @return AFC_E_SUCCESS on success, or an AFC_E_* error value on error. 834 * @return AFC_E_SUCCESS on success, or an AFC_E_* error value on error.
835 */ 835 */
836iphone_error_t 836idevice_error_t
837afc_file_write(afc_client_t client, uint64_t handle, const char *data, uint32_t length, uint32_t *bytes_written) 837afc_file_write(afc_client_t client, uint64_t handle, const char *data, uint32_t length, uint32_t *bytes_written)
838{ 838{
839 char *acknowledgement = NULL; 839 char *acknowledgement = NULL;
diff --git a/src/afc.h b/src/afc.h
index f8a5da3..ad518f6 100644
--- a/src/afc.h
+++ b/src/afc.h
@@ -26,7 +26,7 @@
26#include <glib.h> 26#include <glib.h>
27#include <stdint.h> 27#include <stdint.h>
28 28
29#include "libiphone/afc.h" 29#include "libimobiledevice/afc.h"
30 30
31#define AFC_MAGIC "CFA6LPAA" 31#define AFC_MAGIC "CFA6LPAA"
32#define AFC_MAGIC_LEN (8) 32#define AFC_MAGIC_LEN (8)
@@ -58,7 +58,7 @@ typedef struct __AFCToken {
58} AFCToken; 58} AFCToken;
59 59
60struct afc_client_int { 60struct afc_client_int {
61 iphone_connection_t connection; 61 idevice_connection_t connection;
62 AFCPacket *afc_packet; 62 AFCPacket *afc_packet;
63 int file_handle; 63 int file_handle;
64 int lock; 64 int lock;
diff --git a/src/debug.c b/src/debug.c
index b194b0d..a40c249 100644
--- a/src/debug.c
+++ b/src/debug.c
@@ -28,7 +28,7 @@
28#include <stdlib.h> 28#include <stdlib.h>
29 29
30#include "debug.h" 30#include "debug.h"
31#include "libiphone/libiphone.h" 31#include "libimobiledevice/libimobiledevice.h"
32 32
33int debug_level = 0; 33int debug_level = 0;
34 34
@@ -38,7 +38,7 @@ int debug_level = 0;
38 * 38 *
39 * @param level Set to 0 for no debugging or 1 for debugging. 39 * @param level Set to 0 for no debugging or 1 for debugging.
40 */ 40 */
41void iphone_set_debug_level(int level) 41void idevice_set_debug_level(int level)
42{ 42{
43 debug_level = level; 43 debug_level = level;
44} 44}
diff --git a/src/device_link_service.c b/src/device_link_service.c
index 9998fd0..10e9e9c 100644
--- a/src/device_link_service.c
+++ b/src/device_link_service.c
@@ -78,7 +78,7 @@ static char *device_link_service_get_message(plist_t dl_msg)
78 * DEVICE_LINK_SERVICE_E_INVALID_ARG when one of the parameters is invalid, 78 * DEVICE_LINK_SERVICE_E_INVALID_ARG when one of the parameters is invalid,
79 * or DEVICE_LINK_SERVICE_E_MUX_ERROR when the connection failed. 79 * or DEVICE_LINK_SERVICE_E_MUX_ERROR when the connection failed.
80 */ 80 */
81device_link_service_error_t device_link_service_client_new(iphone_device_t device, uint16_t port, device_link_service_client_t *client) 81device_link_service_error_t device_link_service_client_new(idevice_t device, uint16_t port, device_link_service_client_t *client)
82{ 82{
83 if (!device || port == 0 || !client || *client) { 83 if (!device || port == 0 || !client || *client) {
84 return DEVICE_LINK_SERVICE_E_INVALID_ARG; 84 return DEVICE_LINK_SERVICE_E_INVALID_ARG;
diff --git a/src/device_link_service.h b/src/device_link_service.h
index 8345d57..4fc9a9f 100644
--- a/src/device_link_service.h
+++ b/src/device_link_service.h
@@ -41,7 +41,7 @@ typedef struct device_link_service_client_int *device_link_service_client_t;
41 41
42typedef int16_t device_link_service_error_t; 42typedef int16_t device_link_service_error_t;
43 43
44device_link_service_error_t device_link_service_client_new(iphone_device_t device, uint16_t port, device_link_service_client_t *client); 44device_link_service_error_t device_link_service_client_new(idevice_t device, uint16_t port, device_link_service_client_t *client);
45device_link_service_error_t device_link_service_client_free(device_link_service_client_t client); 45device_link_service_error_t device_link_service_client_free(device_link_service_client_t client);
46device_link_service_error_t device_link_service_version_exchange(device_link_service_client_t client, uint64_t version_major, uint64_t version_minor); 46device_link_service_error_t device_link_service_version_exchange(device_link_service_client_t client, uint64_t version_major, uint64_t version_minor);
47device_link_service_error_t device_link_service_process_message(device_link_service_client_t client, plist_t message); 47device_link_service_error_t device_link_service_process_message(device_link_service_client_t client, plist_t message);
diff --git a/src/file_relay.c b/src/file_relay.c
index f0e91f7..dd94e53 100644
--- a/src/file_relay.c
+++ b/src/file_relay.c
@@ -36,7 +36,7 @@
36 * FILE_RELAY_E_INVALID_ARG when one of the parameters is invalid, 36 * FILE_RELAY_E_INVALID_ARG when one of the parameters is invalid,
37 * or FILE_RELAY_E_MUX_ERROR when the connection failed. 37 * or FILE_RELAY_E_MUX_ERROR when the connection failed.
38 */ 38 */
39file_relay_error_t file_relay_client_new(iphone_device_t device, uint16_t port, file_relay_client_t *client) 39file_relay_error_t file_relay_client_new(idevice_t device, uint16_t port, file_relay_client_t *client)
40{ 40{
41 if (!device || port == 0 || !client || *client) { 41 if (!device || port == 0 || !client || *client) {
42 return FILE_RELAY_E_INVALID_ARG; 42 return FILE_RELAY_E_INVALID_ARG;
@@ -92,7 +92,7 @@ file_relay_error_t file_relay_client_free(file_relay_client_t client)
92 * - tmp 92 * - tmp
93 * - SystemConfiguration 93 * - SystemConfiguration
94 * @param connection The connection that has to be used for receiving the 94 * @param connection The connection that has to be used for receiving the
95 * data using iphone_connection_receive(). The connection will be closed 95 * data using idevice_connection_receive(). The connection will be closed
96 * automatically by the device, but use file_relay_client_free() to clean 96 * automatically by the device, but use file_relay_client_free() to clean
97 * up properly. 97 * up properly.
98 * 98 *
@@ -107,7 +107,7 @@ file_relay_error_t file_relay_client_free(file_relay_client_t client)
107 * sources are invalid, FILE_RELAY_E_STAGING_EMPTY if no data is available 107 * sources are invalid, FILE_RELAY_E_STAGING_EMPTY if no data is available
108 * for the given sources, or FILE_RELAY_E_UNKNOWN_ERROR otherwise. 108 * for the given sources, or FILE_RELAY_E_UNKNOWN_ERROR otherwise.
109 */ 109 */
110file_relay_error_t file_relay_request_sources(file_relay_client_t client, const char **sources, iphone_connection_t *connection) 110file_relay_error_t file_relay_request_sources(file_relay_client_t client, const char **sources, idevice_connection_t *connection)
111{ 111{
112 if (!client || !client->parent || !sources || !sources[0]) { 112 if (!client || !client->parent || !sources || !sources[0]) {
113 return FILE_RELAY_E_INVALID_ARG; 113 return FILE_RELAY_E_INVALID_ARG;
diff --git a/src/file_relay.h b/src/file_relay.h
index 9b2488c..7a94c89 100644
--- a/src/file_relay.h
+++ b/src/file_relay.h
@@ -21,7 +21,7 @@
21#ifndef FILE_RELAY_H 21#ifndef FILE_RELAY_H
22#define FILE_RELAY_H 22#define FILE_RELAY_H
23 23
24#include "libiphone/file_relay.h" 24#include "libimobiledevice/file_relay.h"
25#include "property_list_service.h" 25#include "property_list_service.h"
26 26
27/* Error Codes */ 27/* Error Codes */
diff --git a/src/iphone.c b/src/idevice.c
index b471e35..c5050d5 100644
--- a/src/iphone.c
+++ b/src/idevice.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * iphone.c 2 * idevice.c
3 * Device discovery and communication interface. 3 * Device discovery and communication interface.
4 * 4 *
5 * Copyright (c) 2008 Zach C. All Rights Reserved. 5 * Copyright (c) 2008 Zach C. All Rights Reserved.
@@ -27,14 +27,14 @@
27 27
28#include <usbmuxd.h> 28#include <usbmuxd.h>
29#include <gnutls/gnutls.h> 29#include <gnutls/gnutls.h>
30#include "iphone.h" 30#include "idevice.h"
31#include "debug.h" 31#include "debug.h"
32 32
33static iphone_event_cb_t event_cb = NULL; 33static idevice_event_cb_t event_cb = NULL;
34 34
35static void usbmux_event_cb(const usbmuxd_event_t *event, void *user_data) 35static void usbmux_event_cb(const usbmuxd_event_t *event, void *user_data)
36{ 36{
37 iphone_event_t ev; 37 idevice_event_t ev;
38 38
39 ev.event = event->event; 39 ev.event = event->event;
40 ev.uuid = event->device.uuid; 40 ev.uuid = event->device.uuid;
@@ -53,35 +53,35 @@ static void usbmux_event_cb(const usbmuxd_event_t *event, void *user_data)
53 * @param user_data Application-specific data passed as parameter 53 * @param user_data Application-specific data passed as parameter
54 * to the registered callback function. 54 * to the registered callback function.
55 * 55 *
56 * @return IPHONE_E_SUCCESS on success or an error value when an error occured. 56 * @return IDEVICE_E_SUCCESS on success or an error value when an error occured.
57 */ 57 */
58iphone_error_t iphone_event_subscribe(iphone_event_cb_t callback, void *user_data) 58idevice_error_t idevice_event_subscribe(idevice_event_cb_t callback, void *user_data)
59{ 59{
60 event_cb = callback; 60 event_cb = callback;
61 int res = usbmuxd_subscribe(usbmux_event_cb, user_data); 61 int res = usbmuxd_subscribe(usbmux_event_cb, user_data);
62 if (res != 0) { 62 if (res != 0) {
63 event_cb = NULL; 63 event_cb = NULL;
64 debug_info("Error %d when subscribing usbmux event callback!", res); 64 debug_info("Error %d when subscribing usbmux event callback!", res);
65 return IPHONE_E_UNKNOWN_ERROR; 65 return IDEVICE_E_UNKNOWN_ERROR;
66 } 66 }
67 return IPHONE_E_SUCCESS; 67 return IDEVICE_E_SUCCESS;
68} 68}
69 69
70/** 70/**
71 * Release the event callback function that has been registered with 71 * Release the event callback function that has been registered with
72 * iphone_event_subscribe(). 72 * idevice_event_subscribe().
73 * 73 *
74 * @return IPHONE_E_SUCCESS on success or an error value when an error occured. 74 * @return IDEVICE_E_SUCCESS on success or an error value when an error occured.
75 */ 75 */
76iphone_error_t iphone_event_unsubscribe() 76idevice_error_t idevice_event_unsubscribe()
77{ 77{
78 event_cb = NULL; 78 event_cb = NULL;
79 int res = usbmuxd_unsubscribe(); 79 int res = usbmuxd_unsubscribe();
80 if (res != 0) { 80 if (res != 0) {
81 debug_info("Error %d when unsubscribing usbmux event callback!", res); 81 debug_info("Error %d when unsubscribing usbmux event callback!", res);
82 return IPHONE_E_UNKNOWN_ERROR; 82 return IDEVICE_E_UNKNOWN_ERROR;
83 } 83 }
84 return IPHONE_E_SUCCESS; 84 return IDEVICE_E_SUCCESS;
85} 85}
86 86
87/** 87/**
@@ -91,9 +91,9 @@ iphone_error_t iphone_event_unsubscribe()
91 * This list is terminated by a NULL pointer. 91 * This list is terminated by a NULL pointer.
92 * @param count Number of devices found. 92 * @param count Number of devices found.
93 * 93 *
94 * @return IPHONE_E_SUCCESS on success or an error value when an error occured. 94 * @return IDEVICE_E_SUCCESS on success or an error value when an error occured.
95 */ 95 */
96iphone_error_t iphone_get_device_list(char ***devices, int *count) 96idevice_error_t idevice_get_device_list(char ***devices, int *count)
97{ 97{
98 usbmuxd_device_info_t *dev_list; 98 usbmuxd_device_info_t *dev_list;
99 99
@@ -102,7 +102,7 @@ iphone_error_t iphone_get_device_list(char ***devices, int *count)
102 102
103 if (usbmuxd_get_device_list(&dev_list) < 0) { 103 if (usbmuxd_get_device_list(&dev_list) < 0) {
104 debug_info("ERROR: usbmuxd is not running!\n", __func__); 104 debug_info("ERROR: usbmuxd is not running!\n", __func__);
105 return IPHONE_E_NO_DEVICE; 105 return IDEVICE_E_NO_DEVICE;
106 } 106 }
107 107
108 char **newlist = NULL; 108 char **newlist = NULL;
@@ -120,7 +120,7 @@ iphone_error_t iphone_get_device_list(char ***devices, int *count)
120 newlist[newcount] = NULL; 120 newlist[newcount] = NULL;
121 *devices = newlist; 121 *devices = newlist;
122 122
123 return IPHONE_E_SUCCESS; 123 return IDEVICE_E_SUCCESS;
124} 124}
125 125
126/** 126/**
@@ -128,9 +128,9 @@ iphone_error_t iphone_get_device_list(char ***devices, int *count)
128 * 128 *
129 * @param devices List of uuids to free. 129 * @param devices List of uuids to free.
130 * 130 *
131 * @return Always returnes IPHONE_E_SUCCESS. 131 * @return Always returnes IDEVICE_E_SUCCESS.
132 */ 132 */
133iphone_error_t iphone_device_list_free(char **devices) 133idevice_error_t idevice_device_list_free(char **devices)
134{ 134{
135 if (devices) { 135 if (devices) {
136 int i = 0; 136 int i = 0;
@@ -139,52 +139,52 @@ iphone_error_t iphone_device_list_free(char **devices)
139 } 139 }
140 free(devices); 140 free(devices);
141 } 141 }
142 return IPHONE_E_SUCCESS; 142 return IDEVICE_E_SUCCESS;
143} 143}
144 144
145/** 145/**
146 * Creates an iphone_device_t structure for the device specified by uuid, 146 * Creates an idevice_t structure for the device specified by uuid,
147 * if the device is available. 147 * if the device is available.
148 * 148 *
149 * @note The resulting iphone_device_t structure has to be freed with 149 * @note The resulting idevice_t structure has to be freed with
150 * iphone_device_free() if it is no longer used. 150 * idevice_free() if it is no longer used.
151 * 151 *
152 * @param device Upon calling this function, a pointer to a location of type 152 * @param device Upon calling this function, a pointer to a location of type
153 * iphone_device_t. On successful return, this location will be populated. 153 * idevice_t. On successful return, this location will be populated.
154 * @param uuid The UUID to match. 154 * @param uuid The UUID to match.
155 * 155 *
156 * @return IPHONE_E_SUCCESS if ok, otherwise an error code. 156 * @return IDEVICE_E_SUCCESS if ok, otherwise an error code.
157 */ 157 */
158iphone_error_t iphone_device_new(iphone_device_t * device, const char *uuid) 158idevice_error_t idevice_new(idevice_t * device, const char *uuid)
159{ 159{
160 usbmuxd_device_info_t muxdev; 160 usbmuxd_device_info_t muxdev;
161 int res = usbmuxd_get_device_by_uuid(uuid, &muxdev); 161 int res = usbmuxd_get_device_by_uuid(uuid, &muxdev);
162 if (res > 0) { 162 if (res > 0) {
163 iphone_device_t phone = (iphone_device_t) malloc(sizeof(struct iphone_device_int)); 163 idevice_t phone = (idevice_t) malloc(sizeof(struct idevice_int));
164 phone->uuid = strdup(muxdev.uuid); 164 phone->uuid = strdup(muxdev.uuid);
165 phone->conn_type = CONNECTION_USBMUXD; 165 phone->conn_type = CONNECTION_USBMUXD;
166 phone->conn_data = (void*)muxdev.handle; 166 phone->conn_data = (void*)muxdev.handle;
167 *device = phone; 167 *device = phone;
168 return IPHONE_E_SUCCESS; 168 return IDEVICE_E_SUCCESS;
169 } 169 }
170 /* other connection types could follow here */ 170 /* other connection types could follow here */
171 171
172 return IPHONE_E_NO_DEVICE; 172 return IDEVICE_E_NO_DEVICE;
173} 173}
174 174
175/** Cleans up an iPhone structure, then frees the structure itself. 175/** Cleans up an idevice structure, then frees the structure itself.
176 * This is a library-level function; deals directly with the iPhone to tear 176 * This is a library-level function; deals directly with the device to tear
177 * down relations, but otherwise is mostly internal. 177 * down relations, but otherwise is mostly internal.
178 * 178 *
179 * @param device A pointer to an iPhone structure. 179 * @param device idevice_t to free.
180 */ 180 */
181iphone_error_t iphone_device_free(iphone_device_t device) 181idevice_error_t idevice_free(idevice_t device)
182{ 182{
183 if (!device) 183 if (!device)
184 return IPHONE_E_INVALID_ARG; 184 return IDEVICE_E_INVALID_ARG;
185 iphone_error_t ret = IPHONE_E_UNKNOWN_ERROR; 185 idevice_error_t ret = IDEVICE_E_UNKNOWN_ERROR;
186 186
187 ret = IPHONE_E_SUCCESS; 187 ret = IDEVICE_E_SUCCESS;
188 188
189 free(device->uuid); 189 free(device->uuid);
190 190
@@ -203,34 +203,34 @@ iphone_error_t iphone_device_free(iphone_device_t device)
203 * 203 *
204 * @param device The device to connect to. 204 * @param device The device to connect to.
205 * @param port The destination port to connect to. 205 * @param port The destination port to connect to.
206 * @param connection Pointer to an iphone_connection_t that will be filled 206 * @param connection Pointer to an idevice_connection_t that will be filled
207 * with the necessary data of the connection. 207 * with the necessary data of the connection.
208 * 208 *
209 * @return IPHONE_E_SUCCESS if ok, otherwise an error code. 209 * @return IDEVICE_E_SUCCESS if ok, otherwise an error code.
210 */ 210 */
211iphone_error_t iphone_device_connect(iphone_device_t device, uint16_t port, iphone_connection_t *connection) 211idevice_error_t idevice_connect(idevice_t device, uint16_t port, idevice_connection_t *connection)
212{ 212{
213 if (!device) { 213 if (!device) {
214 return IPHONE_E_INVALID_ARG; 214 return IDEVICE_E_INVALID_ARG;
215 } 215 }
216 216
217 if (device->conn_type == CONNECTION_USBMUXD) { 217 if (device->conn_type == CONNECTION_USBMUXD) {
218 int sfd = usbmuxd_connect((uint32_t)(device->conn_data), port); 218 int sfd = usbmuxd_connect((uint32_t)(device->conn_data), port);
219 if (sfd < 0) { 219 if (sfd < 0) {
220 debug_info("ERROR: Connecting to usbmuxd failed: %d (%s)", sfd, strerror(-sfd)); 220 debug_info("ERROR: Connecting to usbmuxd failed: %d (%s)", sfd, strerror(-sfd));
221 return IPHONE_E_UNKNOWN_ERROR; 221 return IDEVICE_E_UNKNOWN_ERROR;
222 } 222 }
223 iphone_connection_t new_connection = (iphone_connection_t)malloc(sizeof(struct iphone_connection_int)); 223 idevice_connection_t new_connection = (idevice_connection_t)malloc(sizeof(struct idevice_connection_int));
224 new_connection->type = CONNECTION_USBMUXD; 224 new_connection->type = CONNECTION_USBMUXD;
225 new_connection->data = (void*)sfd; 225 new_connection->data = (void*)sfd;
226 new_connection->ssl_data = NULL; 226 new_connection->ssl_data = NULL;
227 *connection = new_connection; 227 *connection = new_connection;
228 return IPHONE_E_SUCCESS; 228 return IDEVICE_E_SUCCESS;
229 } else { 229 } else {
230 debug_info("Unknown connection type %d", device->conn_type); 230 debug_info("Unknown connection type %d", device->conn_type);
231 } 231 }
232 232
233 return IPHONE_E_UNKNOWN_ERROR; 233 return IDEVICE_E_UNKNOWN_ERROR;
234} 234}
235 235
236/** 236/**
@@ -238,21 +238,21 @@ iphone_error_t iphone_device_connect(iphone_device_t device, uint16_t port, ipho
238 * 238 *
239 * @param connection The connection to close. 239 * @param connection The connection to close.
240 * 240 *
241 * @return IPHONE_E_SUCCESS if ok, otherwise an error code. 241 * @return IDEVICE_E_SUCCESS if ok, otherwise an error code.
242 */ 242 */
243iphone_error_t iphone_device_disconnect(iphone_connection_t connection) 243idevice_error_t idevice_disconnect(idevice_connection_t connection)
244{ 244{
245 if (!connection) { 245 if (!connection) {
246 return IPHONE_E_INVALID_ARG; 246 return IDEVICE_E_INVALID_ARG;
247 } 247 }
248 /* shut down ssl if enabled */ 248 /* shut down ssl if enabled */
249 if (connection->ssl_data) { 249 if (connection->ssl_data) {
250 iphone_connection_disable_ssl(connection); 250 idevice_connection_disable_ssl(connection);
251 } 251 }
252 iphone_error_t result = IPHONE_E_UNKNOWN_ERROR; 252 idevice_error_t result = IDEVICE_E_UNKNOWN_ERROR;
253 if (connection->type == CONNECTION_USBMUXD) { 253 if (connection->type == CONNECTION_USBMUXD) {
254 usbmuxd_disconnect((int)(connection->data)); 254 usbmuxd_disconnect((int)(connection->data));
255 result = IPHONE_E_SUCCESS; 255 result = IDEVICE_E_SUCCESS;
256 } else { 256 } else {
257 debug_info("Unknown connection type %d", connection->type); 257 debug_info("Unknown connection type %d", connection->type);
258 } 258 }
@@ -263,23 +263,23 @@ iphone_error_t iphone_device_disconnect(iphone_connection_t connection)
263/** 263/**
264 * Internally used function to send raw data over the given connection. 264 * Internally used function to send raw data over the given connection.
265 */ 265 */
266static iphone_error_t internal_connection_send(iphone_connection_t connection, const char *data, uint32_t len, uint32_t *sent_bytes) 266static idevice_error_t internal_connection_send(idevice_connection_t connection, const char *data, uint32_t len, uint32_t *sent_bytes)
267{ 267{
268 if (!connection || !data) { 268 if (!connection || !data) {
269 return IPHONE_E_INVALID_ARG; 269 return IDEVICE_E_INVALID_ARG;
270 } 270 }
271 271
272 if (connection->type == CONNECTION_USBMUXD) { 272 if (connection->type == CONNECTION_USBMUXD) {
273 int res = usbmuxd_send((int)(connection->data), data, len, sent_bytes); 273 int res = usbmuxd_send((int)(connection->data), data, len, sent_bytes);
274 if (res < 0) { 274 if (res < 0) {
275 debug_info("ERROR: usbmuxd_send returned %d (%s)", res, strerror(-res)); 275 debug_info("ERROR: usbmuxd_send returned %d (%s)", res, strerror(-res));
276 return IPHONE_E_UNKNOWN_ERROR; 276 return IDEVICE_E_UNKNOWN_ERROR;
277 } 277 }
278 return IPHONE_E_SUCCESS; 278 return IDEVICE_E_SUCCESS;
279 } else { 279 } else {
280 debug_info("Unknown connection type %d", connection->type); 280 debug_info("Unknown connection type %d", connection->type);
281 } 281 }
282 return IPHONE_E_UNKNOWN_ERROR; 282 return IDEVICE_E_UNKNOWN_ERROR;
283 283
284} 284}
285 285
@@ -292,22 +292,22 @@ static iphone_error_t internal_connection_send(iphone_connection_t connection, c
292 * @param sent_bytes Pointer to an uint32_t that will be filled 292 * @param sent_bytes Pointer to an uint32_t that will be filled
293 * with the number of bytes actually sent. 293 * with the number of bytes actually sent.
294 * 294 *
295 * @return IPHONE_E_SUCCESS if ok, otherwise an error code. 295 * @return IDEVICE_E_SUCCESS if ok, otherwise an error code.
296 */ 296 */
297iphone_error_t iphone_connection_send(iphone_connection_t connection, const char *data, uint32_t len, uint32_t *sent_bytes) 297idevice_error_t idevice_connection_send(idevice_connection_t connection, const char *data, uint32_t len, uint32_t *sent_bytes)
298{ 298{
299 if (!connection || !data || (connection->ssl_data && !connection->ssl_data->session)) { 299 if (!connection || !data || (connection->ssl_data && !connection->ssl_data->session)) {
300 return IPHONE_E_INVALID_ARG; 300 return IDEVICE_E_INVALID_ARG;
301 } 301 }
302 302
303 if (connection->ssl_data) { 303 if (connection->ssl_data) {
304 ssize_t sent = gnutls_record_send(connection->ssl_data->session, (void*)data, (size_t)len); 304 ssize_t sent = gnutls_record_send(connection->ssl_data->session, (void*)data, (size_t)len);
305 if ((uint32_t)sent == (uint32_t)len) { 305 if ((uint32_t)sent == (uint32_t)len) {
306 *sent_bytes = sent; 306 *sent_bytes = sent;
307 return IPHONE_E_SUCCESS; 307 return IDEVICE_E_SUCCESS;
308 } 308 }
309 *sent_bytes = 0; 309 *sent_bytes = 0;
310 return IPHONE_E_SSL_ERROR; 310 return IDEVICE_E_SSL_ERROR;
311 } 311 }
312 return internal_connection_send(connection, data, len, sent_bytes); 312 return internal_connection_send(connection, data, len, sent_bytes);
313} 313}
@@ -316,23 +316,23 @@ iphone_error_t iphone_connection_send(iphone_connection_t connection, const char
316 * Internally used function for receiving raw data over the given connection 316 * Internally used function for receiving raw data over the given connection
317 * using a timeout. 317 * using a timeout.
318 */ 318 */
319static iphone_error_t internal_connection_receive_timeout(iphone_connection_t connection, char *data, uint32_t len, uint32_t *recv_bytes, unsigned int timeout) 319static idevice_error_t internal_connection_receive_timeout(idevice_connection_t connection, char *data, uint32_t len, uint32_t *recv_bytes, unsigned int timeout)
320{ 320{
321 if (!connection) { 321 if (!connection) {
322 return IPHONE_E_INVALID_ARG; 322 return IDEVICE_E_INVALID_ARG;
323 } 323 }
324 324
325 if (connection->type == CONNECTION_USBMUXD) { 325 if (connection->type == CONNECTION_USBMUXD) {
326 int res = usbmuxd_recv_timeout((int)(connection->data), data, len, recv_bytes, timeout); 326 int res = usbmuxd_recv_timeout((int)(connection->data), data, len, recv_bytes, timeout);
327 if (res < 0) { 327 if (res < 0) {
328 debug_info("ERROR: usbmuxd_recv_timeout returned %d (%s)", res, strerror(-res)); 328 debug_info("ERROR: usbmuxd_recv_timeout returned %d (%s)", res, strerror(-res));
329 return IPHONE_E_UNKNOWN_ERROR; 329 return IDEVICE_E_UNKNOWN_ERROR;
330 } 330 }
331 return IPHONE_E_SUCCESS; 331 return IDEVICE_E_SUCCESS;
332 } else { 332 } else {
333 debug_info("Unknown connection type %d", connection->type); 333 debug_info("Unknown connection type %d", connection->type);
334 } 334 }
335 return IPHONE_E_UNKNOWN_ERROR; 335 return IDEVICE_E_UNKNOWN_ERROR;
336} 336}
337 337
338/** 338/**
@@ -348,22 +348,22 @@ static iphone_error_t internal_connection_receive_timeout(iphone_connection_t co
348 * @param timeout Timeout in milliseconds after which this function should 348 * @param timeout Timeout in milliseconds after which this function should
349 * return even if no data has been received. 349 * return even if no data has been received.
350 * 350 *
351 * @return IPHONE_E_SUCCESS if ok, otherwise an error code. 351 * @return IDEVICE_E_SUCCESS if ok, otherwise an error code.
352 */ 352 */
353iphone_error_t iphone_connection_receive_timeout(iphone_connection_t connection, char *data, uint32_t len, uint32_t *recv_bytes, unsigned int timeout) 353idevice_error_t idevice_connection_receive_timeout(idevice_connection_t connection, char *data, uint32_t len, uint32_t *recv_bytes, unsigned int timeout)
354{ 354{
355 if (!connection || (connection->ssl_data && !connection->ssl_data->session)) { 355 if (!connection || (connection->ssl_data && !connection->ssl_data->session)) {
356 return IPHONE_E_INVALID_ARG; 356 return IDEVICE_E_INVALID_ARG;
357 } 357 }
358 358
359 if (connection->ssl_data) { 359 if (connection->ssl_data) {
360 ssize_t received = gnutls_record_recv(connection->ssl_data->session, (void*)data, (size_t)len); 360 ssize_t received = gnutls_record_recv(connection->ssl_data->session, (void*)data, (size_t)len);
361 if (received > 0) { 361 if (received > 0) {
362 *recv_bytes = received; 362 *recv_bytes = received;
363 return IPHONE_E_SUCCESS; 363 return IDEVICE_E_SUCCESS;
364 } 364 }
365 *recv_bytes = 0; 365 *recv_bytes = 0;
366 return IPHONE_E_SSL_ERROR; 366 return IDEVICE_E_SSL_ERROR;
367 } 367 }
368 return internal_connection_receive_timeout(connection, data, len, recv_bytes, timeout); 368 return internal_connection_receive_timeout(connection, data, len, recv_bytes, timeout);
369} 369}
@@ -371,30 +371,30 @@ iphone_error_t iphone_connection_receive_timeout(iphone_connection_t connection,
371/** 371/**
372 * Internally used function for receiving raw data over the given connection. 372 * Internally used function for receiving raw data over the given connection.
373 */ 373 */
374static iphone_error_t internal_connection_receive(iphone_connection_t connection, char *data, uint32_t len, uint32_t *recv_bytes) 374static idevice_error_t internal_connection_receive(idevice_connection_t connection, char *data, uint32_t len, uint32_t *recv_bytes)
375{ 375{
376 if (!connection) { 376 if (!connection) {
377 return IPHONE_E_INVALID_ARG; 377 return IDEVICE_E_INVALID_ARG;
378 } 378 }
379 379
380 if (connection->type == CONNECTION_USBMUXD) { 380 if (connection->type == CONNECTION_USBMUXD) {
381 int res = usbmuxd_recv((int)(connection->data), data, len, recv_bytes); 381 int res = usbmuxd_recv((int)(connection->data), data, len, recv_bytes);
382 if (res < 0) { 382 if (res < 0) {
383 debug_info("ERROR: usbmuxd_recv returned %d (%s)", res, strerror(-res)); 383 debug_info("ERROR: usbmuxd_recv returned %d (%s)", res, strerror(-res));
384 return IPHONE_E_UNKNOWN_ERROR; 384 return IDEVICE_E_UNKNOWN_ERROR;
385 } 385 }
386 386
387 return IPHONE_E_SUCCESS; 387 return IDEVICE_E_SUCCESS;
388 } else { 388 } else {
389 debug_info("Unknown connection type %d", connection->type); 389 debug_info("Unknown connection type %d", connection->type);
390 } 390 }
391 return IPHONE_E_UNKNOWN_ERROR; 391 return IDEVICE_E_UNKNOWN_ERROR;
392} 392}
393 393
394/** 394/**
395 * Receive data from a device via the given connection. 395 * Receive data from a device via the given connection.
396 * This function is like iphone_connection_receive_timeout, but with a predefined 396 * This function is like idevice_connection_receive_timeout, but with a
397 * reasonable timeout. 397 * predefined reasonable timeout.
398 * 398 *
399 * @param connection The connection to receive data from. 399 * @param connection The connection to receive data from.
400 * @param data Buffer that will be filled with the received data. 400 * @param data Buffer that will be filled with the received data.
@@ -402,47 +402,47 @@ static iphone_error_t internal_connection_receive(iphone_connection_t connection
402 * @param len Buffer size or number of bytes to receive. 402 * @param len Buffer size or number of bytes to receive.
403 * @param recv_bytes Number of bytes actually received. 403 * @param recv_bytes Number of bytes actually received.
404 * 404 *
405 * @return IPHONE_E_SUCCESS if ok, otherwise an error code. 405 * @return IDEVICE_E_SUCCESS if ok, otherwise an error code.
406 */ 406 */
407iphone_error_t iphone_connection_receive(iphone_connection_t connection, char *data, uint32_t len, uint32_t *recv_bytes) 407idevice_error_t idevice_connection_receive(idevice_connection_t connection, char *data, uint32_t len, uint32_t *recv_bytes)
408{ 408{
409 if (!connection || (connection->ssl_data && !connection->ssl_data->session)) { 409 if (!connection || (connection->ssl_data && !connection->ssl_data->session)) {
410 return IPHONE_E_INVALID_ARG; 410 return IDEVICE_E_INVALID_ARG;
411 } 411 }
412 412
413 if (connection->ssl_data) { 413 if (connection->ssl_data) {
414 ssize_t received = gnutls_record_recv(connection->ssl_data->session, (void*)data, (size_t)len); 414 ssize_t received = gnutls_record_recv(connection->ssl_data->session, (void*)data, (size_t)len);
415 if (received > 0) { 415 if (received > 0) {
416 *recv_bytes = received; 416 *recv_bytes = received;
417 return IPHONE_E_SUCCESS; 417 return IDEVICE_E_SUCCESS;
418 } 418 }
419 *recv_bytes = 0; 419 *recv_bytes = 0;
420 return IPHONE_E_SSL_ERROR; 420 return IDEVICE_E_SSL_ERROR;
421 } 421 }
422 return internal_connection_receive(connection, data, len, recv_bytes); 422 return internal_connection_receive(connection, data, len, recv_bytes);
423} 423}
424 424
425iphone_error_t iphone_device_get_handle(iphone_device_t device, uint32_t *handle) 425idevice_error_t idevice_get_handle(idevice_t device, uint32_t *handle)
426{ 426{
427 if (!device) 427 if (!device)
428 return IPHONE_E_INVALID_ARG; 428 return IDEVICE_E_INVALID_ARG;
429 429
430 if (device->conn_type == CONNECTION_USBMUXD) { 430 if (device->conn_type == CONNECTION_USBMUXD) {
431 *handle = (uint32_t)device->conn_data; 431 *handle = (uint32_t)device->conn_data;
432 return IPHONE_E_SUCCESS; 432 return IDEVICE_E_SUCCESS;
433 } else { 433 } else {
434 debug_info("Unknown connection type %d", device->conn_type); 434 debug_info("Unknown connection type %d", device->conn_type);
435 } 435 }
436 return IPHONE_E_UNKNOWN_ERROR; 436 return IDEVICE_E_UNKNOWN_ERROR;
437} 437}
438 438
439iphone_error_t iphone_device_get_uuid(iphone_device_t device, char **uuid) 439idevice_error_t idevice_get_uuid(idevice_t device, char **uuid)
440{ 440{
441 if (!device) 441 if (!device)
442 return IPHONE_E_INVALID_ARG; 442 return IDEVICE_E_INVALID_ARG;
443 443
444 *uuid = strdup(device->uuid); 444 *uuid = strdup(device->uuid);
445 return IPHONE_E_SUCCESS; 445 return IDEVICE_E_SUCCESS;
446} 446}
447 447
448/** 448/**
@@ -453,8 +453,8 @@ static ssize_t internal_ssl_read(gnutls_transport_ptr_t transport, char *buffer,
453 int bytes = 0, pos_start_fill = 0; 453 int bytes = 0, pos_start_fill = 0;
454 size_t tbytes = 0; 454 size_t tbytes = 0;
455 int this_len = length; 455 int this_len = length;
456 iphone_error_t res; 456 idevice_error_t res;
457 iphone_connection_t connection = (iphone_connection_t)transport; 457 idevice_connection_t connection = (idevice_connection_t)transport;
458 char *recv_buffer; 458 char *recv_buffer;
459 459
460 debug_info("pre-read client wants %zi bytes", length); 460 debug_info("pre-read client wants %zi bytes", length);
@@ -463,8 +463,8 @@ static ssize_t internal_ssl_read(gnutls_transport_ptr_t transport, char *buffer,
463 463
464 /* repeat until we have the full data or an error occurs */ 464 /* repeat until we have the full data or an error occurs */
465 do { 465 do {
466 if ((res = internal_connection_receive(connection, recv_buffer, this_len, (uint32_t*)&bytes)) != IPHONE_E_SUCCESS) { 466 if ((res = internal_connection_receive(connection, recv_buffer, this_len, (uint32_t*)&bytes)) != IDEVICE_E_SUCCESS) {
467 debug_info("ERROR: iphone_connection_receive returned %d", res); 467 debug_info("ERROR: idevice_connection_receive returned %d", res);
468 return res; 468 return res;
469 } 469 }
470 debug_info("post-read we got %i bytes", bytes); 470 debug_info("post-read we got %i bytes", bytes);
@@ -496,7 +496,7 @@ static ssize_t internal_ssl_read(gnutls_transport_ptr_t transport, char *buffer,
496static ssize_t internal_ssl_write(gnutls_transport_ptr_t transport, char *buffer, size_t length) 496static ssize_t internal_ssl_write(gnutls_transport_ptr_t transport, char *buffer, size_t length)
497{ 497{
498 uint32_t bytes = 0; 498 uint32_t bytes = 0;
499 iphone_connection_t connection = (iphone_connection_t)transport; 499 idevice_connection_t connection = (idevice_connection_t)transport;
500 debug_info("pre-send length = %zi", length); 500 debug_info("pre-send length = %zi", length);
501 internal_connection_send(connection, buffer, length, &bytes); 501 internal_connection_send(connection, buffer, length, &bytes);
502 debug_info("post-send sent %i bytes", bytes); 502 debug_info("post-send sent %i bytes", bytes);
@@ -524,16 +524,16 @@ static void internal_ssl_cleanup(ssl_data_t ssl_data)
524 * 524 *
525 * @param connection The connection to enable SSL for. 525 * @param connection The connection to enable SSL for.
526 * 526 *
527 * @return IPHONE_E_SUCCESS on success, IPHONE_E_INVALID_ARG when connection 527 * @return IDEVICE_E_SUCCESS on success, IDEVICE_E_INVALID_ARG when connection
528 * is NULL or connection->ssl_data is non-NULL, or IPHONE_E_SSL_ERROR when 528 * is NULL or connection->ssl_data is non-NULL, or IDEVICE_E_SSL_ERROR when
529 * SSL initialization, setup, or handshake fails. 529 * SSL initialization, setup, or handshake fails.
530 */ 530 */
531iphone_error_t iphone_connection_enable_ssl(iphone_connection_t connection) 531idevice_error_t idevice_connection_enable_ssl(idevice_connection_t connection)
532{ 532{
533 if (!connection || connection->ssl_data) 533 if (!connection || connection->ssl_data)
534 return IPHONE_E_INVALID_ARG; 534 return IDEVICE_E_INVALID_ARG;
535 535
536 iphone_error_t ret = IPHONE_E_SSL_ERROR; 536 idevice_error_t ret = IDEVICE_E_SSL_ERROR;
537 uint32_t return_me = 0; 537 uint32_t return_me = 0;
538 538
539 ssl_data_t ssl_data_loc = (ssl_data_t)malloc(sizeof(struct ssl_data_int)); 539 ssl_data_t ssl_data_loc = (ssl_data_t)malloc(sizeof(struct ssl_data_int));
@@ -580,7 +580,7 @@ iphone_error_t iphone_connection_enable_ssl(iphone_connection_t connection)
580 debug_info("oh.. errno says %s", strerror(errno)); 580 debug_info("oh.. errno says %s", strerror(errno));
581 } else { 581 } else {
582 connection->ssl_data = ssl_data_loc; 582 connection->ssl_data = ssl_data_loc;
583 ret = IPHONE_E_SUCCESS; 583 ret = IDEVICE_E_SUCCESS;
584 debug_info("SSL mode enabled"); 584 debug_info("SSL mode enabled");
585 } 585 }
586 return ret; 586 return ret;
@@ -591,17 +591,17 @@ iphone_error_t iphone_connection_enable_ssl(iphone_connection_t connection)
591 * 591 *
592 * @param connection The connection to disable SSL for. 592 * @param connection The connection to disable SSL for.
593 * 593 *
594 * @return IPHONE_E_SUCCESS on success, IPHONE_E_INVALID_ARG when connection 594 * @return IDEVICE_E_SUCCESS on success, IDEVICE_E_INVALID_ARG when connection
595 * is NULL. This function also returns IPHONE_E_SUCCESS when SSL is not 595 * is NULL. This function also returns IDEVICE_E_SUCCESS when SSL is not
596 * enabled and does no further error checking on cleanup. 596 * enabled and does no further error checking on cleanup.
597 */ 597 */
598iphone_error_t iphone_connection_disable_ssl(iphone_connection_t connection) 598idevice_error_t idevice_connection_disable_ssl(idevice_connection_t connection)
599{ 599{
600 if (!connection) 600 if (!connection)
601 return IPHONE_E_INVALID_ARG; 601 return IDEVICE_E_INVALID_ARG;
602 if (!connection->ssl_data) { 602 if (!connection->ssl_data) {
603 /* ignore if ssl is not enabled */ 603 /* ignore if ssl is not enabled */
604 return IPHONE_E_SUCCESS; 604 return IDEVICE_E_SUCCESS;
605 } 605 }
606 606
607 if (connection->ssl_data->session) { 607 if (connection->ssl_data->session) {
@@ -613,6 +613,6 @@ iphone_error_t iphone_connection_disable_ssl(iphone_connection_t connection)
613 613
614 debug_info("SSL mode disabled"); 614 debug_info("SSL mode disabled");
615 615
616 return IPHONE_E_SUCCESS; 616 return IDEVICE_E_SUCCESS;
617} 617}
618 618
diff --git a/src/iphone.h b/src/idevice.h
index 2755349..4aab440 100644
--- a/src/iphone.h
+++ b/src/idevice.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * iphone.h 2 * idevice.h
3 * Device discovery and communication interface -- header file. 3 * Device discovery and communication interface -- header file.
4 * 4 *
5 * Copyright (c) 2008 Zach C. All Rights Reserved. 5 * Copyright (c) 2008 Zach C. All Rights Reserved.
@@ -18,13 +18,13 @@
18 * License along with this library; if not, write to the Free Software 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 19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 */ 20 */
21#ifndef IPHONE_H 21#ifndef IDEVICE_H
22#define IPHONE_H 22#define IDEVICE_H
23 23
24#include <plist/plist.h> 24#include <plist/plist.h>
25#include <gnutls/gnutls.h> 25#include <gnutls/gnutls.h>
26 26
27#include "libiphone/libiphone.h" 27#include "libimobiledevice/libimobiledevice.h"
28 28
29enum connection_type { 29enum connection_type {
30 CONNECTION_USBMUXD = 1 30 CONNECTION_USBMUXD = 1
@@ -36,19 +36,19 @@ struct ssl_data_int {
36}; 36};
37typedef struct ssl_data_int *ssl_data_t; 37typedef struct ssl_data_int *ssl_data_t;
38 38
39struct iphone_connection_int { 39struct idevice_connection_int {
40 enum connection_type type; 40 enum connection_type type;
41 void *data; 41 void *data;
42 ssl_data_t ssl_data; 42 ssl_data_t ssl_data;
43}; 43};
44 44
45struct iphone_device_int { 45struct idevice_int {
46 char *uuid; 46 char *uuid;
47 enum connection_type conn_type; 47 enum connection_type conn_type;
48 void *conn_data; 48 void *conn_data;
49}; 49};
50 50
51iphone_error_t iphone_connection_enable_ssl(iphone_connection_t connection); 51idevice_error_t idevice_connection_enable_ssl(idevice_connection_t connection);
52iphone_error_t iphone_connection_disable_ssl(iphone_connection_t connection); 52idevice_error_t idevice_connection_disable_ssl(idevice_connection_t connection);
53 53
54#endif 54#endif
diff --git a/src/installation_proxy.c b/src/installation_proxy.c
index e0bccd3..3a6d22a 100644
--- a/src/installation_proxy.c
+++ b/src/installation_proxy.c
@@ -92,7 +92,7 @@ static instproxy_error_t instproxy_error(property_list_service_error_t err)
92 * @return INSTPROXY_E_SUCCESS on success, or an INSTPROXY_E_* error value 92 * @return INSTPROXY_E_SUCCESS on success, or an INSTPROXY_E_* error value
93 * when an error occured. 93 * when an error occured.
94 */ 94 */
95instproxy_error_t instproxy_client_new(iphone_device_t device, uint16_t port, instproxy_client_t *client) 95instproxy_error_t instproxy_client_new(idevice_t device, uint16_t port, instproxy_client_t *client)
96{ 96{
97 /* makes sure thread environment is available */ 97 /* makes sure thread environment is available */
98 if (!g_thread_supported()) 98 if (!g_thread_supported())
diff --git a/src/installation_proxy.h b/src/installation_proxy.h
index 0204533..78128b2 100644
--- a/src/installation_proxy.h
+++ b/src/installation_proxy.h
@@ -23,7 +23,7 @@
23 23
24#include <glib.h> 24#include <glib.h>
25 25
26#include "libiphone/installation_proxy.h" 26#include "libimobiledevice/installation_proxy.h"
27#include "property_list_service.h" 27#include "property_list_service.h"
28 28
29struct instproxy_client_int { 29struct instproxy_client_int {
diff --git a/src/lockdown.c b/src/lockdown.c
index 108b558..13f3d48 100644
--- a/src/lockdown.c
+++ b/src/lockdown.c
@@ -1,6 +1,6 @@
1/* 1/*
2 * lockdown.c 2 * lockdown.c
3 * libiphone built-in lockdownd client 3 * libimobiledevice built-in lockdownd client
4 * 4 *
5 * Copyright (c) 2008 Zach C. All Rights Reserved. 5 * Copyright (c) 2008 Zach C. All Rights Reserved.
6 * 6 *
@@ -30,7 +30,7 @@
30 30
31#include "property_list_service.h" 31#include "property_list_service.h"
32#include "lockdown.h" 32#include "lockdown.h"
33#include "iphone.h" 33#include "idevice.h"
34#include "debug.h" 34#include "debug.h"
35#include "userpref.h" 35#include "userpref.h"
36 36
@@ -229,7 +229,7 @@ void lockdownd_client_set_label(lockdownd_client_t client, const char *label)
229 } 229 }
230} 230}
231 231
232/** Polls the iPhone for lockdownd data. 232/** Polls the device for lockdownd data.
233 * 233 *
234 * @param control The lockdownd client 234 * @param control The lockdownd client
235 * @param plist The plist to store the received data 235 * @param plist The plist to store the received data
@@ -254,7 +254,7 @@ lockdownd_error_t lockdownd_receive(lockdownd_client_t client, plist_t *plist)
254 return ret; 254 return ret;
255} 255}
256 256
257/** Sends lockdownd data to the iPhone 257/** Sends lockdownd data to the device
258 * 258 *
259 * @note This function is low-level and should only be used if you need to send 259 * @note This function is low-level and should only be used if you need to send
260 * a new type of message. 260 * a new type of message.
@@ -270,7 +270,7 @@ lockdownd_error_t lockdownd_send(lockdownd_client_t client, plist_t plist)
270 return LOCKDOWN_E_INVALID_ARG; 270 return LOCKDOWN_E_INVALID_ARG;
271 271
272 lockdownd_error_t ret = LOCKDOWN_E_SUCCESS; 272 lockdownd_error_t ret = LOCKDOWN_E_SUCCESS;
273 iphone_error_t err; 273 idevice_error_t err;
274 274
275 err = property_list_service_send_xml_plist(client->parent, plist); 275 err = property_list_service_send_xml_plist(client->parent, plist);
276 if (err != PROPERTY_LIST_SERVICE_E_SUCCESS) { 276 if (err != PROPERTY_LIST_SERVICE_E_SUCCESS) {
@@ -578,7 +578,7 @@ lockdownd_error_t lockdownd_get_device_name(lockdownd_client_t client, char **de
578 * 578 *
579 * @return an error code (LOCKDOWN_E_SUCCESS on success) 579 * @return an error code (LOCKDOWN_E_SUCCESS on success)
580 */ 580 */
581lockdownd_error_t lockdownd_client_new(iphone_device_t device, lockdownd_client_t *client, const char *label) 581lockdownd_error_t lockdownd_client_new(idevice_t device, lockdownd_client_t *client, const char *label)
582{ 582{
583 if (!client) 583 if (!client)
584 return LOCKDOWN_E_INVALID_ARG; 584 return LOCKDOWN_E_INVALID_ARG;
@@ -619,7 +619,7 @@ lockdownd_error_t lockdownd_client_new(iphone_device_t device, lockdownd_client_
619 * 619 *
620 * @return an error code (LOCKDOWN_E_SUCCESS on success) 620 * @return an error code (LOCKDOWN_E_SUCCESS on success)
621 */ 621 */
622lockdownd_error_t lockdownd_client_new_with_handshake(iphone_device_t device, lockdownd_client_t *client, const char *label) 622lockdownd_error_t lockdownd_client_new_with_handshake(idevice_t device, lockdownd_client_t *client, const char *label)
623{ 623{
624 if (!client) 624 if (!client)
625 return LOCKDOWN_E_INVALID_ARG; 625 return LOCKDOWN_E_INVALID_ARG;
@@ -644,7 +644,7 @@ lockdownd_error_t lockdownd_client_new_with_handshake(iphone_device_t device, lo
644 free(type); 644 free(type);
645 } 645 }
646 646
647 ret = iphone_device_get_uuid(device, &client_loc->uuid); 647 ret = idevice_get_uuid(device, &client_loc->uuid);
648 if (LOCKDOWN_E_SUCCESS != ret) { 648 if (LOCKDOWN_E_SUCCESS != ret) {
649 debug_info("failed to get device uuid."); 649 debug_info("failed to get device uuid.");
650 } 650 }
@@ -759,7 +759,7 @@ static lockdownd_error_t lockdownd_do_pair(lockdownd_client_t client, lockdownd_
759 plist_t dict = NULL; 759 plist_t dict = NULL;
760 plist_t dict_record = NULL; 760 plist_t dict_record = NULL;
761 gnutls_datum_t public_key = { NULL, 0 }; 761 gnutls_datum_t public_key = { NULL, 0 };
762 int pairing_mode = 0; /* 0 = libiphone, 1 = external */ 762 int pairing_mode = 0; /* 0 = libimobiledevice, 1 = external */
763 763
764 if (pair_record && pair_record->host_id) { 764 if (pair_record && pair_record->host_id) {
765 /* valid pair_record passed? */ 765 /* valid pair_record passed? */
@@ -780,7 +780,7 @@ static lockdownd_error_t lockdownd_do_pair(lockdownd_client_t client, lockdownd_
780 return ret; 780 return ret;
781 } 781 }
782 debug_info("device public key follows:\n%s", public_key.data); 782 debug_info("device public key follows:\n%s", public_key.data);
783 /* get libiphone pair_record */ 783 /* get libimobiledevice pair_record */
784 ret = generate_pair_record_plist(public_key, NULL, &dict_record); 784 ret = generate_pair_record_plist(public_key, NULL, &dict_record);
785 if (ret != LOCKDOWN_E_SUCCESS) { 785 if (ret != LOCKDOWN_E_SUCCESS) {
786 if (dict_record) 786 if (dict_record)
@@ -795,7 +795,7 @@ static lockdownd_error_t lockdownd_do_pair(lockdownd_client_t client, lockdownd_
795 plist_dict_insert_item(dict,"PairRecord", dict_record); 795 plist_dict_insert_item(dict,"PairRecord", dict_record);
796 plist_dict_insert_item(dict, "Request", plist_new_string(verb)); 796 plist_dict_insert_item(dict, "Request", plist_new_string(verb));
797 797
798 /* send to iPhone */ 798 /* send to device */
799 ret = lockdownd_send(client, dict); 799 ret = lockdownd_send(client, dict);
800 plist_free(dict); 800 plist_free(dict);
801 dict = NULL; 801 dict = NULL;
@@ -803,7 +803,7 @@ static lockdownd_error_t lockdownd_do_pair(lockdownd_client_t client, lockdownd_
803 if (ret != LOCKDOWN_E_SUCCESS) 803 if (ret != LOCKDOWN_E_SUCCESS)
804 return ret; 804 return ret;
805 805
806 /* Now get iPhone's answer */ 806 /* Now get device's answer */
807 ret = lockdownd_receive(client, &dict); 807 ret = lockdownd_receive(client, &dict);
808 808
809 if (ret != LOCKDOWN_E_SUCCESS) 809 if (ret != LOCKDOWN_E_SUCCESS)
@@ -1116,7 +1116,7 @@ lockdownd_error_t lockdownd_gen_pair_cert(gnutls_datum_t public_key, gnutls_datu
1116 return ret; 1116 return ret;
1117} 1117}
1118 1118
1119/** Starts communication with lockdownd after the iPhone has been paired, 1119/** Starts communication with lockdownd after the device has been paired,
1120 * and if the device requires it, switches to SSL mode. 1120 * and if the device requires it, switches to SSL mode.
1121 * 1121 *
1122 * @param client The lockdownd client 1122 * @param client The lockdownd client
@@ -1244,7 +1244,7 @@ lockdownd_error_t lockdownd_start_service(lockdownd_client_t client, const char
1244 plist_dict_insert_item(dict,"Request", plist_new_string("StartService")); 1244 plist_dict_insert_item(dict,"Request", plist_new_string("StartService"));
1245 plist_dict_insert_item(dict,"Service", plist_new_string(service)); 1245 plist_dict_insert_item(dict,"Service", plist_new_string(service));
1246 1246
1247 /* send to iPhone */ 1247 /* send to device */
1248 ret = lockdownd_send(client, dict); 1248 ret = lockdownd_send(client, dict);
1249 plist_free(dict); 1249 plist_free(dict);
1250 dict = NULL; 1250 dict = NULL;
diff --git a/src/lockdown.h b/src/lockdown.h
index 82ea01f..f515f7f 100644
--- a/src/lockdown.h
+++ b/src/lockdown.h
@@ -25,7 +25,7 @@
25#include <gnutls/gnutls.h> 25#include <gnutls/gnutls.h>
26#include <string.h> 26#include <string.h>
27 27
28#include "libiphone/lockdown.h" 28#include "libimobiledevice/lockdown.h"
29#include "property_list_service.h" 29#include "property_list_service.h"
30 30
31struct lockdownd_client_int { 31struct lockdownd_client_int {
diff --git a/src/mobilebackup.c b/src/mobilebackup.c
index 5b81c7f..91b9e73 100644
--- a/src/mobilebackup.c
+++ b/src/mobilebackup.c
@@ -59,7 +59,7 @@ static mobilebackup_error_t mobilebackup_error(device_link_service_error_t err)
59 return MOBILEBACKUP_E_UNKNOWN_ERROR; 59 return MOBILEBACKUP_E_UNKNOWN_ERROR;
60} 60}
61 61
62mobilebackup_error_t mobilebackup_client_new(iphone_device_t device, uint16_t port, 62mobilebackup_error_t mobilebackup_client_new(idevice_t device, uint16_t port,
63 mobilebackup_client_t * client) 63 mobilebackup_client_t * client)
64{ 64{
65 if (!device || port == 0 || !client || *client) 65 if (!device || port == 0 || !client || *client)
@@ -97,7 +97,7 @@ mobilebackup_error_t mobilebackup_client_free(mobilebackup_client_t client)
97 return err; 97 return err;
98} 98}
99 99
100/** Polls the iPhone for MobileBackup data. 100/** Polls the device for MobileBackup data.
101 * 101 *
102 * @param client The MobileBackup client 102 * @param client The MobileBackup client
103 * @param plist A pointer to the location where the plist should be stored 103 * @param plist A pointer to the location where the plist should be stored
@@ -112,7 +112,7 @@ mobilebackup_error_t mobilebackup_receive(mobilebackup_client_t client, plist_t
112 return ret; 112 return ret;
113} 113}
114 114
115/** Sends MobileBackup data to the iPhone 115/** Sends MobileBackup data to the device
116 * 116 *
117 * @note This function is low-level and should only be used if you need to send 117 * @note This function is low-level and should only be used if you need to send
118 * a new type of message. 118 * a new type of message.
diff --git a/src/mobilebackup.h b/src/mobilebackup.h
index 04ebc45..8f58236 100644
--- a/src/mobilebackup.h
+++ b/src/mobilebackup.h
@@ -21,7 +21,7 @@
21#ifndef MOBILEBACKUP_H 21#ifndef MOBILEBACKUP_H
22#define MOBILEBACKUP_H 22#define MOBILEBACKUP_H
23 23
24#include "libiphone/mobilebackup.h" 24#include "libimobiledevice/mobilebackup.h"
25#include "device_link_service.h" 25#include "device_link_service.h"
26 26
27struct mobilebackup_client_int { 27struct mobilebackup_client_int {
diff --git a/src/mobilesync.c b/src/mobilesync.c
index 15614b5..fec97bc 100644
--- a/src/mobilesync.c
+++ b/src/mobilesync.c
@@ -59,7 +59,7 @@ static mobilesync_error_t mobilesync_error(device_link_service_error_t err)
59 return MOBILESYNC_E_UNKNOWN_ERROR; 59 return MOBILESYNC_E_UNKNOWN_ERROR;
60} 60}
61 61
62mobilesync_error_t mobilesync_client_new(iphone_device_t device, uint16_t port, 62mobilesync_error_t mobilesync_client_new(idevice_t device, uint16_t port,
63 mobilesync_client_t * client) 63 mobilesync_client_t * client)
64{ 64{
65 if (!device || port == 0 || !client || *client) 65 if (!device || port == 0 || !client || *client)
@@ -97,7 +97,7 @@ mobilesync_error_t mobilesync_client_free(mobilesync_client_t client)
97 return err; 97 return err;
98} 98}
99 99
100/** Polls the iPhone for MobileSync data. 100/** Polls the device for MobileSync data.
101 * 101 *
102 * @param client The MobileSync client 102 * @param client The MobileSync client
103 * @param plist A pointer to the location where the plist should be stored 103 * @param plist A pointer to the location where the plist should be stored
@@ -112,7 +112,7 @@ mobilesync_error_t mobilesync_receive(mobilesync_client_t client, plist_t * plis
112 return ret; 112 return ret;
113} 113}
114 114
115/** Sends MobileSync data to the iPhone 115/** Sends MobileSync data to the device
116 * 116 *
117 * @note This function is low-level and should only be used if you need to send 117 * @note This function is low-level and should only be used if you need to send
118 * a new type of message. 118 * a new type of message.
diff --git a/src/mobilesync.h b/src/mobilesync.h
index e69cb25..defb3f4 100644
--- a/src/mobilesync.h
+++ b/src/mobilesync.h
@@ -21,7 +21,7 @@
21#ifndef MOBILESYNC_H 21#ifndef MOBILESYNC_H
22#define MOBILESYNC_H 22#define MOBILESYNC_H
23 23
24#include "libiphone/mobilesync.h" 24#include "libimobiledevice/mobilesync.h"
25#include "device_link_service.h" 25#include "device_link_service.h"
26 26
27struct mobilesync_client_int { 27struct mobilesync_client_int {
diff --git a/src/notification_proxy.c b/src/notification_proxy.c
index 0969985..eb5e6b2 100644
--- a/src/notification_proxy.c
+++ b/src/notification_proxy.c
@@ -92,7 +92,7 @@ static np_error_t np_error(property_list_service_error_t err)
92 * or NP_E_CONN_FAILED when the connection to the device could not be 92 * or NP_E_CONN_FAILED when the connection to the device could not be
93 * established. 93 * established.
94 */ 94 */
95np_error_t np_client_new(iphone_device_t device, uint16_t port, np_client_t *client) 95np_error_t np_client_new(idevice_t device, uint16_t port, np_client_t *client)
96{ 96{
97 /* makes sure thread environment is available */ 97 /* makes sure thread environment is available */
98 if (!g_thread_supported()) 98 if (!g_thread_supported())
@@ -177,7 +177,7 @@ np_error_t np_post_notification(np_client_t client, const char *notification)
177 return res; 177 return res;
178} 178}
179 179
180/** Notifies the iphone to send a notification on the specified event. 180/** Notifies the device to send a notification on the specified event.
181 * 181 *
182 * @param client The client to send to 182 * @param client The client to send to
183 * @param notification The notifications that should be observed. 183 * @param notification The notifications that should be observed.
@@ -206,7 +206,7 @@ np_error_t np_observe_notification( np_client_t client, const char *notification
206 return res; 206 return res;
207} 207}
208 208
209/** Notifies the iphone to send a notification on specified events. 209/** Notifies the device to send a notification on specified events.
210 * 210 *
211 * @param client The client to send to 211 * @param client The client to send to
212 * @param notification_spec Specification of the notifications that should be 212 * @param notification_spec Specification of the notifications that should be
diff --git a/src/notification_proxy.h b/src/notification_proxy.h
index 6ff2cde..6f2dc99 100644
--- a/src/notification_proxy.h
+++ b/src/notification_proxy.h
@@ -23,7 +23,7 @@
23 23
24#include <glib.h> 24#include <glib.h>
25 25
26#include "libiphone/notification_proxy.h" 26#include "libimobiledevice/notification_proxy.h"
27#include "property_list_service.h" 27#include "property_list_service.h"
28 28
29struct np_client_int { 29struct np_client_int {
diff --git a/src/property_list_service.c b/src/property_list_service.c
index dbf02d6..68aa455 100644
--- a/src/property_list_service.c
+++ b/src/property_list_service.c
@@ -24,26 +24,26 @@
24#include <arpa/inet.h> 24#include <arpa/inet.h>
25 25
26#include "property_list_service.h" 26#include "property_list_service.h"
27#include "iphone.h" 27#include "idevice.h"
28#include "debug.h" 28#include "debug.h"
29 29
30/** 30/**
31 * Convert an iphone_error_t value to an property_list_service_error_t value. 31 * Convert an idevice_error_t value to an property_list_service_error_t value.
32 * Used internally to get correct error codes. 32 * Used internally to get correct error codes.
33 * 33 *
34 * @param err An iphone_error_t error code 34 * @param err An idevice_error_t error code
35 * 35 *
36 * @return A matching property_list_service_error_t error code, 36 * @return A matching property_list_service_error_t error code,
37 * PROPERTY_LIST_SERVICE_E_UNKNOWN_ERROR otherwise. 37 * PROPERTY_LIST_SERVICE_E_UNKNOWN_ERROR otherwise.
38 */ 38 */
39static property_list_service_error_t iphone_to_property_list_service_error(iphone_error_t err) 39static property_list_service_error_t idevice_to_property_list_service_error(idevice_error_t err)
40{ 40{
41 switch (err) { 41 switch (err) {
42 case IPHONE_E_SUCCESS: 42 case IDEVICE_E_SUCCESS:
43 return PROPERTY_LIST_SERVICE_E_SUCCESS; 43 return PROPERTY_LIST_SERVICE_E_SUCCESS;
44 case IPHONE_E_INVALID_ARG: 44 case IDEVICE_E_INVALID_ARG:
45 return PROPERTY_LIST_SERVICE_E_INVALID_ARG; 45 return PROPERTY_LIST_SERVICE_E_INVALID_ARG;
46 case IPHONE_E_SSL_ERROR: 46 case IDEVICE_E_SSL_ERROR:
47 return PROPERTY_LIST_SERVICE_E_SSL_ERROR; 47 return PROPERTY_LIST_SERVICE_E_SSL_ERROR;
48 default: 48 default:
49 break; 49 break;
@@ -64,14 +64,14 @@ static property_list_service_error_t iphone_to_property_list_service_error(iphon
64 * PROPERTY_LIST_SERVICE_E_INVALID_ARG when one of the arguments is invalid, 64 * PROPERTY_LIST_SERVICE_E_INVALID_ARG when one of the arguments is invalid,
65 * or PROPERTY_LIST_SERVICE_E_MUX_ERROR when connecting to the device failed. 65 * or PROPERTY_LIST_SERVICE_E_MUX_ERROR when connecting to the device failed.
66 */ 66 */
67property_list_service_error_t property_list_service_client_new(iphone_device_t device, uint16_t port, property_list_service_client_t *client) 67property_list_service_error_t property_list_service_client_new(idevice_t device, uint16_t port, property_list_service_client_t *client)
68{ 68{
69 if (!device || port == 0 || !client || *client) 69 if (!device || port == 0 || !client || *client)
70 return PROPERTY_LIST_SERVICE_E_INVALID_ARG; 70 return PROPERTY_LIST_SERVICE_E_INVALID_ARG;
71 71
72 /* Attempt connection */ 72 /* Attempt connection */
73 iphone_connection_t connection = NULL; 73 idevice_connection_t connection = NULL;
74 if (iphone_device_connect(device, port, &connection) != IPHONE_E_SUCCESS) { 74 if (idevice_connect(device, port, &connection) != IDEVICE_E_SUCCESS) {
75 return PROPERTY_LIST_SERVICE_E_MUX_ERROR; 75 return PROPERTY_LIST_SERVICE_E_MUX_ERROR;
76 } 76 }
77 77
@@ -98,7 +98,7 @@ property_list_service_error_t property_list_service_client_free(property_list_se
98 if (!client) 98 if (!client)
99 return PROPERTY_LIST_SERVICE_E_INVALID_ARG; 99 return PROPERTY_LIST_SERVICE_E_INVALID_ARG;
100 100
101 property_list_service_error_t err = iphone_to_property_list_service_error(iphone_device_disconnect(client->connection)); 101 property_list_service_error_t err = idevice_to_property_list_service_error(idevice_disconnect(client->connection));
102 free(client); 102 free(client);
103 return err; 103 return err;
104} 104}
@@ -141,9 +141,9 @@ static property_list_service_error_t internal_plist_send(property_list_service_c
141 141
142 nlen = htonl(length); 142 nlen = htonl(length);
143 debug_info("sending %d bytes", length); 143 debug_info("sending %d bytes", length);
144 iphone_connection_send(client->connection, (const char*)&nlen, sizeof(nlen), (uint32_t*)&bytes); 144 idevice_connection_send(client->connection, (const char*)&nlen, sizeof(nlen), (uint32_t*)&bytes);
145 if (bytes == sizeof(nlen)) { 145 if (bytes == sizeof(nlen)) {
146 iphone_connection_send(client->connection, content, length, (uint32_t*)&bytes); 146 idevice_connection_send(client->connection, content, length, (uint32_t*)&bytes);
147 if (bytes > 0) { 147 if (bytes > 0) {
148 debug_info("sent %d bytes", bytes); 148 debug_info("sent %d bytes", bytes);
149 debug_plist(plist); 149 debug_plist(plist);
@@ -221,7 +221,7 @@ static property_list_service_error_t internal_plist_receive_timeout(property_lis
221 return PROPERTY_LIST_SERVICE_E_INVALID_ARG; 221 return PROPERTY_LIST_SERVICE_E_INVALID_ARG;
222 } 222 }
223 223
224 iphone_connection_receive_timeout(client->connection, (char*)&pktlen, sizeof(pktlen), &bytes, timeout); 224 idevice_connection_receive_timeout(client->connection, (char*)&pktlen, sizeof(pktlen), &bytes, timeout);
225 debug_info("initial read=%i", bytes); 225 debug_info("initial read=%i", bytes);
226 if (bytes < 4) { 226 if (bytes < 4) {
227 debug_info("initial read failed!"); 227 debug_info("initial read failed!");
@@ -235,7 +235,7 @@ static property_list_service_error_t internal_plist_receive_timeout(property_lis
235 content = (char*)malloc(pktlen); 235 content = (char*)malloc(pktlen);
236 236
237 while (curlen < pktlen) { 237 while (curlen < pktlen) {
238 iphone_connection_receive(client->connection, content+curlen, pktlen-curlen, &bytes); 238 idevice_connection_receive(client->connection, content+curlen, pktlen-curlen, &bytes);
239 if (bytes <= 0) { 239 if (bytes <= 0) {
240 res = PROPERTY_LIST_SERVICE_E_MUX_ERROR; 240 res = PROPERTY_LIST_SERVICE_E_MUX_ERROR;
241 break; 241 break;
@@ -324,7 +324,7 @@ property_list_service_error_t property_list_service_enable_ssl(property_list_ser
324{ 324{
325 if (!client || !client->connection) 325 if (!client || !client->connection)
326 return PROPERTY_LIST_SERVICE_E_INVALID_ARG; 326 return PROPERTY_LIST_SERVICE_E_INVALID_ARG;
327 return iphone_to_property_list_service_error(iphone_connection_enable_ssl(client->connection)); 327 return idevice_to_property_list_service_error(idevice_connection_enable_ssl(client->connection));
328} 328}
329 329
330/** 330/**
@@ -341,6 +341,6 @@ property_list_service_error_t property_list_service_disable_ssl(property_list_se
341{ 341{
342 if (!client || !client->connection) 342 if (!client || !client->connection)
343 return PROPERTY_LIST_SERVICE_E_INVALID_ARG; 343 return PROPERTY_LIST_SERVICE_E_INVALID_ARG;
344 return iphone_to_property_list_service_error(iphone_connection_disable_ssl(client->connection)); 344 return idevice_to_property_list_service_error(idevice_connection_disable_ssl(client->connection));
345} 345}
346 346
diff --git a/src/property_list_service.h b/src/property_list_service.h
index bc3122b..70d8793 100644
--- a/src/property_list_service.h
+++ b/src/property_list_service.h
@@ -21,7 +21,7 @@
21#ifndef PROPERTY_LIST_SERVICE_H 21#ifndef PROPERTY_LIST_SERVICE_H
22#define PROPERTY_LIST_SERVICE_H 22#define PROPERTY_LIST_SERVICE_H
23 23
24#include "iphone.h" 24#include "idevice.h"
25 25
26/* Error Codes */ 26/* Error Codes */
27#define PROPERTY_LIST_SERVICE_E_SUCCESS 0 27#define PROPERTY_LIST_SERVICE_E_SUCCESS 0
@@ -33,7 +33,7 @@
33#define PROPERTY_LIST_SERVICE_E_UNKNOWN_ERROR -256 33#define PROPERTY_LIST_SERVICE_E_UNKNOWN_ERROR -256
34 34
35struct property_list_service_client_int { 35struct property_list_service_client_int {
36 iphone_connection_t connection; 36 idevice_connection_t connection;
37}; 37};
38 38
39typedef struct property_list_service_client_int *property_list_service_client_t; 39typedef struct property_list_service_client_int *property_list_service_client_t;
@@ -41,7 +41,7 @@ typedef struct property_list_service_client_int *property_list_service_client_t;
41typedef int16_t property_list_service_error_t; 41typedef int16_t property_list_service_error_t;
42 42
43/* creation and destruction */ 43/* creation and destruction */
44property_list_service_error_t property_list_service_client_new(iphone_device_t device, uint16_t port, property_list_service_client_t *client); 44property_list_service_error_t property_list_service_client_new(idevice_t device, uint16_t port, property_list_service_client_t *client);
45property_list_service_error_t property_list_service_client_free(property_list_service_client_t client); 45property_list_service_error_t property_list_service_client_free(property_list_service_client_t client);
46 46
47/* sending */ 47/* sending */
diff --git a/src/sbservices.c b/src/sbservices.c
index 2254c64..8cf8b26 100644
--- a/src/sbservices.c
+++ b/src/sbservices.c
@@ -86,7 +86,7 @@ static sbservices_error_t sbservices_error(property_list_service_error_t err)
86 * @return SBSERVICES_E_SUCCESS on success, SBSERVICES_E_INVALID_ARG when 86 * @return SBSERVICES_E_SUCCESS on success, SBSERVICES_E_INVALID_ARG when
87 * client is NULL, or an SBSERVICES_E_* error code otherwise. 87 * client is NULL, or an SBSERVICES_E_* error code otherwise.
88 */ 88 */
89sbservices_error_t sbservices_client_new(iphone_device_t device, uint16_t port, sbservices_client_t *client) 89sbservices_error_t sbservices_client_new(idevice_t device, uint16_t port, sbservices_client_t *client)
90{ 90{
91 /* makes sure thread environment is available */ 91 /* makes sure thread environment is available */
92 if (!g_thread_supported()) 92 if (!g_thread_supported())
diff --git a/src/sbservices.h b/src/sbservices.h
index 5c95eaf..4ade579 100644
--- a/src/sbservices.h
+++ b/src/sbservices.h
@@ -23,7 +23,7 @@
23 23
24#include <glib.h> 24#include <glib.h>
25 25
26#include "libiphone/sbservices.h" 26#include "libimobiledevice/sbservices.h"
27#include "property_list_service.h" 27#include "property_list_service.h"
28 28
29struct sbservices_client_int { 29struct sbservices_client_int {
diff --git a/src/userpref.c b/src/userpref.c
index 6eff534..3a8a9d6 100644
--- a/src/userpref.c
+++ b/src/userpref.c
@@ -33,20 +33,20 @@
33#include "userpref.h" 33#include "userpref.h"
34#include "debug.h" 34#include "debug.h"
35 35
36#define LIBIPHONE_CONF_DIR "libiphone" 36#define LIBIMOBILEDEVICE_CONF_DIR "libimobiledevice"
37#define LIBIPHONE_CONF_FILE "libiphonerc" 37#define LIBIMOBILEDEVICE_CONF_FILE "libimobiledevicerc"
38 38
39#define LIBIPHONE_ROOT_PRIVKEY "RootPrivateKey.pem" 39#define LIBIMOBILEDEVICE_ROOT_PRIVKEY "RootPrivateKey.pem"
40#define LIBIPHONE_HOST_PRIVKEY "HostPrivateKey.pem" 40#define LIBIMOBILEDEVICE_HOST_PRIVKEY "HostPrivateKey.pem"
41#define LIBIPHONE_ROOT_CERTIF "RootCertificate.pem" 41#define LIBIMOBILEDEVICE_ROOT_CERTIF "RootCertificate.pem"
42#define LIBIPHONE_HOST_CERTIF "HostCertificate.pem" 42#define LIBIMOBILEDEVICE_HOST_CERTIF "HostCertificate.pem"
43 43
44 44
45/** Creates a freedesktop compatible configuration directory for libiphone. 45/** Creates a freedesktop compatible configuration directory.
46 */ 46 */
47static void userpref_create_config_dir(void) 47static void userpref_create_config_dir(void)
48{ 48{
49 gchar *config_dir = g_build_path(G_DIR_SEPARATOR_S, g_get_user_config_dir(), LIBIPHONE_CONF_DIR, NULL); 49 gchar *config_dir = g_build_path(G_DIR_SEPARATOR_S, g_get_user_config_dir(), LIBIMOBILEDEVICE_CONF_DIR, NULL);
50 50
51 if (!g_file_test(config_dir, (G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR))) 51 if (!g_file_test(config_dir, (G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR)))
52 g_mkdir_with_parents(config_dir, 0755); 52 g_mkdir_with_parents(config_dir, 0755);
@@ -112,7 +112,7 @@ static int userpref_set_host_id(const char *host_id)
112 /* Write config file on disk */ 112 /* Write config file on disk */
113 buf = g_key_file_to_data(key_file, &length, NULL); 113 buf = g_key_file_to_data(key_file, &length, NULL);
114 config_file = 114 config_file =
115 g_build_path(G_DIR_SEPARATOR_S, g_get_user_config_dir(), LIBIPHONE_CONF_DIR, LIBIPHONE_CONF_FILE, NULL); 115 g_build_path(G_DIR_SEPARATOR_S, g_get_user_config_dir(), LIBIMOBILEDEVICE_CONF_DIR, LIBIMOBILEDEVICE_CONF_FILE, NULL);
116 file = g_io_channel_new_file(config_file, "w", NULL); 116 file = g_io_channel_new_file(config_file, "w", NULL);
117 g_free(config_file); 117 g_free(config_file);
118 g_io_channel_write_chars(file, buf, length, NULL, NULL); 118 g_io_channel_write_chars(file, buf, length, NULL, NULL);
@@ -136,7 +136,7 @@ void userpref_get_host_id(char **host_id)
136 gchar *loc_host_id; 136 gchar *loc_host_id;
137 137
138 config_file = 138 config_file =
139 g_build_path(G_DIR_SEPARATOR_S, g_get_user_config_dir(), LIBIPHONE_CONF_DIR, LIBIPHONE_CONF_FILE, NULL); 139 g_build_path(G_DIR_SEPARATOR_S, g_get_user_config_dir(), LIBIMOBILEDEVICE_CONF_DIR, LIBIMOBILEDEVICE_CONF_FILE, NULL);
140 140
141 /* now parse file to get the HostID */ 141 /* now parse file to get the HostID */
142 key_file = g_key_file_new(); 142 key_file = g_key_file_new();
@@ -158,11 +158,11 @@ void userpref_get_host_id(char **host_id)
158 debug_info("Using %s as HostID", *host_id); 158 debug_info("Using %s as HostID", *host_id);
159} 159}
160 160
161/** Determines whether this iPhone has been connected to this system before. 161/** Determines whether this device has been connected to this system before.
162 * 162 *
163 * @param uid The device uid as given by the iPhone. 163 * @param uid The device uid as given by the device.
164 * 164 *
165 * @return 1 if the iPhone has been connected previously to this configuration 165 * @return 1 if the device has been connected previously to this configuration
166 * or 0 otherwise. 166 * or 0 otherwise.
167 */ 167 */
168int userpref_has_device_public_key(const char *uuid) 168int userpref_has_device_public_key(const char *uuid)
@@ -172,7 +172,7 @@ int userpref_has_device_public_key(const char *uuid)
172 172
173 /* first get config file */ 173 /* first get config file */
174 gchar *device_file = g_strconcat(uuid, ".pem", NULL); 174 gchar *device_file = g_strconcat(uuid, ".pem", NULL);
175 config_file = g_build_path(G_DIR_SEPARATOR_S, g_get_user_config_dir(), LIBIPHONE_CONF_DIR, device_file, NULL); 175 config_file = g_build_path(G_DIR_SEPARATOR_S, g_get_user_config_dir(), LIBIMOBILEDEVICE_CONF_DIR, device_file, NULL);
176 if (g_file_test(config_file, (G_FILE_TEST_EXISTS | G_FILE_TEST_IS_REGULAR))) 176 if (g_file_test(config_file, (G_FILE_TEST_EXISTS | G_FILE_TEST_IS_REGULAR)))
177 ret = 1; 177 ret = 1;
178 g_free(config_file); 178 g_free(config_file);
@@ -180,10 +180,10 @@ int userpref_has_device_public_key(const char *uuid)
180 return ret; 180 return ret;
181} 181}
182 182
183/** Mark the iPhone (as represented by the key) as having connected to this 183/** Mark the device (as represented by the key) as having connected to this
184 * configuration. 184 * configuration.
185 * 185 *
186 * @param public_key The public key given by the iPhone 186 * @param public_key The public key given by the device
187 * 187 *
188 * @return 1 on success and 0 if no public key is given or if it has already 188 * @return 1 on success and 0 if no public key is given or if it has already
189 * been marked as connected previously. 189 * been marked as connected previously.
@@ -201,7 +201,7 @@ userpref_error_t userpref_set_device_public_key(const char *uuid, gnutls_datum_t
201 201
202 /* build file path */ 202 /* build file path */
203 gchar *device_file = g_strconcat(uuid, ".pem", NULL); 203 gchar *device_file = g_strconcat(uuid, ".pem", NULL);
204 gchar *pem = g_build_path(G_DIR_SEPARATOR_S, g_get_user_config_dir(), LIBIPHONE_CONF_DIR, device_file, NULL); 204 gchar *pem = g_build_path(G_DIR_SEPARATOR_S, g_get_user_config_dir(), LIBIMOBILEDEVICE_CONF_DIR, device_file, NULL);
205 205
206 /* store file */ 206 /* store file */
207 FILE *pFile = fopen(pem, "wb"); 207 FILE *pFile = fopen(pem, "wb");
@@ -226,7 +226,7 @@ userpref_error_t userpref_remove_device_public_key(const char *uuid)
226 226
227 /* build file path */ 227 /* build file path */
228 gchar *device_file = g_strconcat(uuid, ".pem", NULL); 228 gchar *device_file = g_strconcat(uuid, ".pem", NULL);
229 gchar *pem = g_build_path(G_DIR_SEPARATOR_S, g_get_user_config_dir(), LIBIPHONE_CONF_DIR, device_file, NULL); 229 gchar *pem = g_build_path(G_DIR_SEPARATOR_S, g_get_user_config_dir(), LIBIMOBILEDEVICE_CONF_DIR, device_file, NULL);
230 230
231 /* remove file */ 231 /* remove file */
232 g_remove(pem); 232 g_remove(pem);
@@ -255,7 +255,7 @@ static int userpref_get_file_contents(const char *file, gnutls_datum_t * data)
255 return 0; 255 return 0;
256 256
257 /* Read file */ 257 /* Read file */
258 filepath = g_build_path(G_DIR_SEPARATOR_S, g_get_user_config_dir(), LIBIPHONE_CONF_DIR, file, NULL); 258 filepath = g_build_path(G_DIR_SEPARATOR_S, g_get_user_config_dir(), LIBIMOBILEDEVICE_CONF_DIR, file, NULL);
259 success = g_file_get_contents(filepath, &content, &size, NULL); 259 success = g_file_get_contents(filepath, &content, &size, NULL);
260 g_free(filepath); 260 g_free(filepath);
261 261
@@ -392,7 +392,7 @@ static userpref_error_t userpref_import_key(const char* key_name, gnutls_x509_pr
392 * @param crt_name The filename of the certificate to import. 392 * @param crt_name The filename of the certificate to import.
393 * @param cert the gnutls certificate structure. 393 * @param cert the gnutls certificate structure.
394 * 394 *
395 * @return IPHONE_E_SUCCESS if the certificate was successfully imported. 395 * @return IDEVICE_E_SUCCESS if the certificate was successfully imported.
396 */ 396 */
397static userpref_error_t userpref_import_crt(const char* crt_name, gnutls_x509_crt_t cert) 397static userpref_error_t userpref_import_crt(const char* crt_name, gnutls_x509_crt_t cert)
398{ 398{
@@ -426,16 +426,16 @@ userpref_error_t userpref_get_keys_and_certs(gnutls_x509_privkey_t root_privkey,
426 userpref_error_t ret = USERPREF_E_SUCCESS; 426 userpref_error_t ret = USERPREF_E_SUCCESS;
427 427
428 if (ret == USERPREF_E_SUCCESS) 428 if (ret == USERPREF_E_SUCCESS)
429 ret = userpref_import_key(LIBIPHONE_ROOT_PRIVKEY, root_privkey); 429 ret = userpref_import_key(LIBIMOBILEDEVICE_ROOT_PRIVKEY, root_privkey);
430 430
431 if (ret == USERPREF_E_SUCCESS) 431 if (ret == USERPREF_E_SUCCESS)
432 ret = userpref_import_key(LIBIPHONE_HOST_PRIVKEY, host_privkey); 432 ret = userpref_import_key(LIBIMOBILEDEVICE_HOST_PRIVKEY, host_privkey);
433 433
434 if (ret == USERPREF_E_SUCCESS) 434 if (ret == USERPREF_E_SUCCESS)
435 ret = userpref_import_crt(LIBIPHONE_ROOT_CERTIF, root_crt); 435 ret = userpref_import_crt(LIBIMOBILEDEVICE_ROOT_CERTIF, root_crt);
436 436
437 if (ret == USERPREF_E_SUCCESS) 437 if (ret == USERPREF_E_SUCCESS)
438 ret = userpref_import_crt(LIBIPHONE_HOST_CERTIF, host_crt); 438 ret = userpref_import_crt(LIBIMOBILEDEVICE_HOST_CERTIF, host_crt);
439 439
440 440
441 if (USERPREF_E_SUCCESS != ret) { 441 if (USERPREF_E_SUCCESS != ret) {
@@ -444,16 +444,16 @@ userpref_error_t userpref_get_keys_and_certs(gnutls_x509_privkey_t root_privkey,
444 ret = userpref_gen_keys_and_cert(); 444 ret = userpref_gen_keys_and_cert();
445 445
446 if (ret == USERPREF_E_SUCCESS) 446 if (ret == USERPREF_E_SUCCESS)
447 ret = userpref_import_key(LIBIPHONE_ROOT_PRIVKEY, root_privkey); 447 ret = userpref_import_key(LIBIMOBILEDEVICE_ROOT_PRIVKEY, root_privkey);
448 448
449 if (ret == USERPREF_E_SUCCESS) 449 if (ret == USERPREF_E_SUCCESS)
450 ret = userpref_import_key(LIBIPHONE_HOST_PRIVKEY, host_privkey); 450 ret = userpref_import_key(LIBIMOBILEDEVICE_HOST_PRIVKEY, host_privkey);
451 451
452 if (ret == USERPREF_E_SUCCESS) 452 if (ret == USERPREF_E_SUCCESS)
453 ret = userpref_import_crt(LIBIPHONE_ROOT_CERTIF, root_crt); 453 ret = userpref_import_crt(LIBIMOBILEDEVICE_ROOT_CERTIF, root_crt);
454 454
455 if (ret == USERPREF_E_SUCCESS) 455 if (ret == USERPREF_E_SUCCESS)
456 ret = userpref_import_crt(LIBIPHONE_HOST_CERTIF, host_crt); 456 ret = userpref_import_crt(LIBIMOBILEDEVICE_HOST_CERTIF, host_crt);
457 } 457 }
458 458
459 return ret; 459 return ret;
@@ -471,7 +471,7 @@ userpref_error_t userpref_get_certs_as_pem(gnutls_datum_t *pem_root_cert, gnutls
471 if (!pem_root_cert || !pem_host_cert) 471 if (!pem_root_cert || !pem_host_cert)
472 return USERPREF_E_INVALID_ARG; 472 return USERPREF_E_INVALID_ARG;
473 473
474 if (userpref_get_file_contents(LIBIPHONE_ROOT_CERTIF, pem_root_cert) && userpref_get_file_contents(LIBIPHONE_HOST_CERTIF, pem_host_cert)) 474 if (userpref_get_file_contents(LIBIMOBILEDEVICE_ROOT_CERTIF, pem_root_cert) && userpref_get_file_contents(LIBIMOBILEDEVICE_HOST_CERTIF, pem_host_cert))
475 return USERPREF_E_SUCCESS; 475 return USERPREF_E_SUCCESS;
476 else { 476 else {
477 g_free(pem_root_cert->data); 477 g_free(pem_root_cert->data);
@@ -503,25 +503,25 @@ userpref_error_t userpref_set_keys_and_certs(gnutls_datum_t * root_key, gnutls_d
503 userpref_create_config_dir(); 503 userpref_create_config_dir();
504 504
505 /* Now write keys and certificates to disk */ 505 /* Now write keys and certificates to disk */
506 pem = g_build_path(G_DIR_SEPARATOR_S, g_get_user_config_dir(), LIBIPHONE_CONF_DIR, LIBIPHONE_ROOT_PRIVKEY, NULL); 506 pem = g_build_path(G_DIR_SEPARATOR_S, g_get_user_config_dir(), LIBIMOBILEDEVICE_CONF_DIR, LIBIMOBILEDEVICE_ROOT_PRIVKEY, NULL);
507 pFile = fopen(pem, "wb"); 507 pFile = fopen(pem, "wb");
508 fwrite(root_key->data, 1, root_key->size, pFile); 508 fwrite(root_key->data, 1, root_key->size, pFile);
509 fclose(pFile); 509 fclose(pFile);
510 g_free(pem); 510 g_free(pem);
511 511
512 pem = g_build_path(G_DIR_SEPARATOR_S, g_get_user_config_dir(), LIBIPHONE_CONF_DIR, LIBIPHONE_HOST_PRIVKEY, NULL); 512 pem = g_build_path(G_DIR_SEPARATOR_S, g_get_user_config_dir(), LIBIMOBILEDEVICE_CONF_DIR, LIBIMOBILEDEVICE_HOST_PRIVKEY, NULL);
513 pFile = fopen(pem, "wb"); 513 pFile = fopen(pem, "wb");
514 fwrite(host_key->data, 1, host_key->size, pFile); 514 fwrite(host_key->data, 1, host_key->size, pFile);
515 fclose(pFile); 515 fclose(pFile);
516 g_free(pem); 516 g_free(pem);
517 517
518 pem = g_build_path(G_DIR_SEPARATOR_S, g_get_user_config_dir(), LIBIPHONE_CONF_DIR, LIBIPHONE_ROOT_CERTIF, NULL); 518 pem = g_build_path(G_DIR_SEPARATOR_S, g_get_user_config_dir(), LIBIMOBILEDEVICE_CONF_DIR, LIBIMOBILEDEVICE_ROOT_CERTIF, NULL);
519 pFile = fopen(pem, "wb"); 519 pFile = fopen(pem, "wb");
520 fwrite(root_cert->data, 1, root_cert->size, pFile); 520 fwrite(root_cert->data, 1, root_cert->size, pFile);
521 fclose(pFile); 521 fclose(pFile);
522 g_free(pem); 522 g_free(pem);
523 523
524 pem = g_build_path(G_DIR_SEPARATOR_S, g_get_user_config_dir(), LIBIPHONE_CONF_DIR, LIBIPHONE_HOST_CERTIF, NULL); 524 pem = g_build_path(G_DIR_SEPARATOR_S, g_get_user_config_dir(), LIBIMOBILEDEVICE_CONF_DIR, LIBIMOBILEDEVICE_HOST_CERTIF, NULL);
525 pFile = fopen(pem, "wb"); 525 pFile = fopen(pem, "wb");
526 fwrite(host_cert->data, 1, host_cert->size, pFile); 526 fwrite(host_cert->data, 1, host_cert->size, pFile);
527 fclose(pFile); 527 fclose(pFile);
diff --git a/swig/Makefile.am b/swig/Makefile.am
index ef87733..6852aad 100644
--- a/swig/Makefile.am
+++ b/swig/Makefile.am
@@ -1,33 +1,33 @@
1INCLUDES = -I$(top_srcdir)/include $(libplist_CFLAGS) $(SWIG_PYTHON_CPPFLAGS) -I$(oldincludedir) 1INCLUDES = -I$(top_srcdir)/include $(libplist_CFLAGS) $(SWIG_PYTHON_CPPFLAGS) -I$(oldincludedir)
2 2
3if HAVE_SWIG 3if HAVE_SWIG
4BUILT_SOURCES = iphone_wrap.cxx 4BUILT_SOURCES = imobiledevice_wrap.cxx
5SWIG_SOURCES = iphone.i 5SWIG_SOURCES = imobiledevice.i
6 6
7CLEANFILES = \ 7CLEANFILES = \
8 *.pyc \ 8 *.pyc \
9 *.pyo \ 9 *.pyo \
10 _iphone.so \ 10 _imobiledevice.so \
11 iphone.py \ 11 imobiledevice.py \
12 iphone_wrap.cxx 12 imobiledevice_wrap.cxx
13 13
14EXTRA_DIST = \ 14EXTRA_DIST = \
15 __init__.py \ 15 __init__.py \
16 iphone.i 16 imobiledevice.i
17 17
18swigincludedir =$(includedir)/libiphone/swig 18swigincludedir =$(includedir)/libimobiledevice/swig
19swiginclude_HEADERS = $(SWIG_SOURCES) 19swiginclude_HEADERS = $(SWIG_SOURCES)
20 20
21iphonedir = $(pyexecdir)/iphone 21imobiledevicedir = $(pyexecdir)/imobiledevice
22iphone_PYTHON = __init__.py 22imobiledevice_PYTHON = __init__.py
23nodist_iphone_PYTHON = iphone.py 23nodist_imobiledevice_PYTHON = imobiledevice.py
24iphone_LTLIBRARIES = _iphone.la 24imobiledevice_LTLIBRARIES = _imobiledevice.la
25nodist__iphone_la_SOURCES = iphone_wrap.cxx $(SWIG_SOURCES) 25nodist__imobiledevice_la_SOURCES = imobiledevice_wrap.cxx $(SWIG_SOURCES)
26_iphone_la_CFLAGS = $(PYTHON_CPPFLAGS) -I$(top_srcdir)/src 26_imobiledevice_la_CFLAGS = $(PYTHON_CPPFLAGS) -I$(top_srcdir)/src
27_iphone_la_LDFLAGS = -module -avoid-version $(PYTHON_LDFLAGS) 27_imobiledevice_la_LDFLAGS = -module -avoid-version $(PYTHON_LDFLAGS)
28_iphone_la_LIBADD = $(top_builddir)/src/libiphone.la $(libplistmm_LIBS) 28_imobiledevice_la_LIBADD = $(top_builddir)/src/libimobiledevice.la $(libplistmm_LIBS)
29 29
30iphone_wrap.cxx : $(SWIG_SOURCES) 30imobiledevice_wrap.cxx : $(SWIG_SOURCES)
31 $(SWIG) $(SWIG_PYTHON_OPT) $(INCLUDES) -I$(top_srcdir)/src -o $@ $< 31 $(SWIG) $(SWIG_PYTHON_OPT) $(INCLUDES) -I$(top_srcdir)/src -o $@ $<
32 32
33endif # HAVE_SWIG 33endif # HAVE_SWIG
diff --git a/swig/iphone.i b/swig/imobiledevice.i
index 81ef488..f978c8e 100644
--- a/swig/iphone.i
+++ b/swig/imobiledevice.i
@@ -1,31 +1,31 @@
1 /* swig.i */ 1 /* swig.i */
2 %module iphone 2 %module imobiledevice
3 %feature("autodoc", "1"); 3 %feature("autodoc", "1");
4 %{ 4 %{
5 /* Includes the header in the wrapper code */ 5 /* Includes the header in the wrapper code */
6 #include <libiphone/libiphone.h> 6 #include <libimobiledevice/libimobiledevice.h>
7 #include <libiphone/lockdown.h> 7 #include <libimobiledevice/lockdown.h>
8 #include <libiphone/mobilesync.h> 8 #include <libimobiledevice/mobilesync.h>
9 #include <plist/plist.h> 9 #include <plist/plist.h>
10 #include <plist/plist++.h> 10 #include <plist/plist++.h>
11 #include "../src/debug.h" 11 #include "../src/debug.h"
12 typedef struct { 12 typedef struct {
13 iphone_device_t dev; 13 idevice_t dev;
14 } iPhone; 14 } idevice;
15 15
16 typedef struct { 16 typedef struct {
17 iPhone* dev; 17 idevice* dev;
18 lockdownd_client_t client; 18 lockdownd_client_t client;
19 } Lockdownd; 19 } Lockdownd;
20 20
21 typedef struct { 21 typedef struct {
22 iPhone* dev; 22 idevice* dev;
23 mobilesync_client_t client; 23 mobilesync_client_t client;
24 } MobileSync; 24 } MobileSync;
25 25
26//now declare funtions to handle creation and deletion of objects 26//now declare funtions to handle creation and deletion of objects
27void my_delete_iPhone(iPhone* dev); 27void my_delete_idevice(idevice* dev);
28Lockdownd* my_new_Lockdownd(iPhone* phone); 28Lockdownd* my_new_Lockdownd(idevice* device);
29void my_delete_Lockdownd(Lockdownd* lckd); 29void my_delete_Lockdownd(Lockdownd* lckd);
30MobileSync* my_new_MobileSync(Lockdownd* lckd); 30MobileSync* my_new_MobileSync(Lockdownd* lckd);
31PList::Node* new_node_from_plist(plist_t node); 31PList::Node* new_node_from_plist(plist_t node);
@@ -37,16 +37,16 @@ PList::Node* new_node_from_plist(plist_t node);
37%include "plist/swig/plist.i" 37%include "plist/swig/plist.i"
38 38
39typedef struct { 39typedef struct {
40 iphone_device_t dev; 40 idevice_t dev;
41} iPhone; 41} idevice;
42 42
43typedef struct { 43typedef struct {
44 iPhone* dev; 44 idevice* dev;
45 lockdownd_client_t client; 45 lockdownd_client_t client;
46} Lockdownd; 46} Lockdownd;
47 47
48typedef struct { 48typedef struct {
49 iPhone* dev; 49 idevice* dev;
50 mobilesync_client_t client; 50 mobilesync_client_t client;
51} MobileSync; 51} MobileSync;
52 52
@@ -54,19 +54,19 @@ typedef struct {
54//now define funtions to handle creation and deletion of objects 54//now define funtions to handle creation and deletion of objects
55 55
56 56
57void my_delete_iPhone(iPhone* dev) { 57void my_delete_idevice(idevice* dev) {
58 if (dev) { 58 if (dev) {
59 iphone_device_free(dev->dev); 59 idevice_free(dev->dev);
60 free(dev); 60 free(dev);
61 } 61 }
62} 62}
63 63
64Lockdownd* my_new_Lockdownd(iPhone* phone) { 64Lockdownd* my_new_Lockdownd(idevice* device) {
65 if (!phone) return NULL; 65 if (!device) return NULL;
66 Lockdownd* client = (Lockdownd*) malloc(sizeof(Lockdownd)); 66 Lockdownd* client = (Lockdownd*) malloc(sizeof(Lockdownd));
67 client->dev = phone; 67 client->dev = device;
68 client->client = NULL; 68 client->client = NULL;
69 if (LOCKDOWN_E_SUCCESS == lockdownd_client_new_with_handshake(phone->dev , &(client->client), NULL)) { 69 if (LOCKDOWN_E_SUCCESS == lockdownd_client_new_with_handshake(device->dev , &(client->client), NULL)) {
70 return client; 70 return client;
71 } 71 }
72 else { 72 else {
@@ -133,29 +133,29 @@ PList::Node* new_node_from_plist(plist_t node)
133%} 133%}
134 134
135 135
136%extend iPhone { // Attach these functions to struct iPhone 136%extend idevice { // Attach these functions to struct idevice
137 iPhone() { 137 idevice() {
138 iPhone* phone = (iPhone*) malloc(sizeof(iPhone)); 138 idevice* device = (idevice*) malloc(sizeof(idevice));
139 phone->dev = NULL; 139 device->dev = NULL;
140 return phone; 140 return device;
141 } 141 }
142 142
143 ~iPhone() { 143 ~idevice() {
144 my_delete_iPhone($self); 144 my_delete_idevice($self);
145 } 145 }
146 146
147 void set_debug_level(int level) { 147 void set_debug_level(int level) {
148 iphone_set_debug_level(level); 148 idevice_set_debug_level(level);
149 } 149 }
150 150
151 int init_device_by_uuid(char* uuid) { 151 int init_device_by_uuid(char* uuid) {
152 if (IPHONE_E_SUCCESS == iphone_device_new(&($self->dev), uuid)) 152 if (IDEVICE_E_SUCCESS == idevice_new(&($self->dev), uuid))
153 return 1; 153 return 1;
154 return 0; 154 return 0;
155 } 155 }
156 156
157 int init_device() { 157 int init_device() {
158 if (IPHONE_E_SUCCESS == iphone_device_new(&($self->dev), NULL)) 158 if (IDEVICE_E_SUCCESS == idevice_new(&($self->dev), NULL))
159 return 1; 159 return 1;
160 return 0; 160 return 0;
161 } 161 }
@@ -163,7 +163,7 @@ PList::Node* new_node_from_plist(plist_t node)
163 %newobject get_uuid; 163 %newobject get_uuid;
164 char* get_uuid(){ 164 char* get_uuid(){
165 char* uuid = NULL; 165 char* uuid = NULL;
166 iphone_device_get_uuid($self->dev, &uuid); 166 idevice_get_uuid($self->dev, &uuid);
167 return uuid; 167 return uuid;
168 } 168 }
169 169
@@ -174,8 +174,8 @@ PList::Node* new_node_from_plist(plist_t node)
174 174
175 175
176%extend Lockdownd { // Attach these functions to struct Lockdownd 176%extend Lockdownd { // Attach these functions to struct Lockdownd
177 Lockdownd(iPhone* phone) { 177 Lockdownd(idevice* device) {
178 return my_new_Lockdownd(phone); 178 return my_new_Lockdownd(device);
179 } 179 }
180 180
181 ~Lockdownd() { 181 ~Lockdownd() {
diff --git a/tools/Makefile.am b/tools/Makefile.am
index d19ef0c..9b6a6e8 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -3,25 +3,25 @@ INCLUDES = -I$(top_srcdir)/include
3AM_CFLAGS = $(GLOBAL_CFLAGS) $(libglib2_CFLAGS) $(libgnutls_CFLAGS) $(libtasn1_CFLAGS) $(libgthread2_CFLAGS) $(LFS_CFLAGS) 3AM_CFLAGS = $(GLOBAL_CFLAGS) $(libglib2_CFLAGS) $(libgnutls_CFLAGS) $(libtasn1_CFLAGS) $(libgthread2_CFLAGS) $(LFS_CFLAGS)
4AM_LDFLAGS = $(libglib2_LIBS) $(libgnutls_LIBS) $(libtasn1_LIBS) $(libgthread2_LIBS) 4AM_LDFLAGS = $(libglib2_LIBS) $(libgnutls_LIBS) $(libtasn1_LIBS) $(libgthread2_LIBS)
5 5
6bin_PROGRAMS = iphone_id iphoneinfo iphonesyslog iphonebackup 6bin_PROGRAMS = idevice_id ideviceinfo idevicesyslog idevicebackup
7 7
8iphoneinfo_SOURCES = iphoneinfo.c 8ideviceinfo_SOURCES = ideviceinfo.c
9iphoneinfo_CFLAGS = $(AM_CFLAGS) 9ideviceinfo_CFLAGS = $(AM_CFLAGS)
10iphoneinfo_LDFLAGS = $(AM_LDFLAGS) 10ideviceinfo_LDFLAGS = $(AM_LDFLAGS)
11iphoneinfo_LDADD = ../src/libiphone.la 11ideviceinfo_LDADD = ../src/libimobiledevice.la
12 12
13iphonesyslog_SOURCES = iphonesyslog.c 13idevicesyslog_SOURCES = idevicesyslog.c
14iphonesyslog_CFLAGS = $(AM_CFLAGS) 14idevicesyslog_CFLAGS = $(AM_CFLAGS)
15iphonesyslog_LDFLAGS = $(AM_LDFLAGS) 15idevicesyslog_LDFLAGS = $(AM_LDFLAGS)
16iphonesyslog_LDADD = ../src/libiphone.la 16idevicesyslog_LDADD = ../src/libimobiledevice.la
17 17
18iphone_id_SOURCES = iphone_id.c 18idevice_id_SOURCES = idevice_id.c
19iphone_id_CFLAGS = $(AM_CFLAGS) 19idevice_id_CFLAGS = $(AM_CFLAGS)
20iphone_id_LDFLAGS = $(AM_LDFLAGS) 20idevice_id_LDFLAGS = $(AM_LDFLAGS)
21iphone_id_LDADD = ../src/libiphone.la 21idevice_id_LDADD = ../src/libimobiledevice.la
22 22
23iphonebackup_SOURCES = iphonebackup.c 23idevicebackup_SOURCES = idevicebackup.c
24iphonebackup_CFLAGS = $(AM_CFLAGS) 24idevicebackup_CFLAGS = $(AM_CFLAGS)
25iphonebackup_LDFLAGS = $(AM_LDFLAGS) 25idevicebackup_LDFLAGS = $(AM_LDFLAGS)
26iphonebackup_LDADD = ../src/libiphone.la 26idevicebackup_LDADD = ../src/libimobiledevice.la
27 27
diff --git a/tools/iphone_id.c b/tools/idevice_id.c
index 4a2c3af..1facb60 100644
--- a/tools/iphone_id.c
+++ b/tools/idevice_id.c
@@ -1,8 +1,8 @@
1#include <stdio.h> 1#include <stdio.h>
2#include <string.h> 2#include <string.h>
3#include <stdlib.h> 3#include <stdlib.h>
4#include <libiphone/libiphone.h> 4#include <libimobiledevice/libimobiledevice.h>
5#include <libiphone/lockdown.h> 5#include <libimobiledevice/lockdown.h>
6 6
7#define MODE_NONE 0 7#define MODE_NONE 0
8#define MODE_SHOW_ID 1 8#define MODE_SHOW_ID 1
@@ -25,7 +25,7 @@ static void print_usage(int argc, char **argv)
25 25
26int main(int argc, char **argv) 26int main(int argc, char **argv)
27{ 27{
28 iphone_device_t phone = NULL; 28 idevice_t phone = NULL;
29 lockdownd_client_t client = NULL; 29 lockdownd_client_t client = NULL;
30 char **dev_list = NULL; 30 char **dev_list = NULL;
31 char *devname = NULL; 31 char *devname = NULL;
@@ -38,7 +38,7 @@ int main(int argc, char **argv)
38 /* parse cmdline args */ 38 /* parse cmdline args */
39 for (i = 1; i < argc; i++) { 39 for (i = 1; i < argc; i++) {
40 if (!strcmp(argv[i], "-d") || !strcmp(argv[i], "--debug")) { 40 if (!strcmp(argv[i], "-d") || !strcmp(argv[i], "--debug")) {
41 iphone_set_debug_level(1); 41 idevice_set_debug_level(1);
42 continue; 42 continue;
43 } 43 }
44 else if (!strcmp(argv[i], "-l") || !strcmp(argv[i], "--list")) { 44 else if (!strcmp(argv[i], "-l") || !strcmp(argv[i], "--list")) {
@@ -63,14 +63,14 @@ int main(int argc, char **argv)
63 63
64 switch (mode) { 64 switch (mode) {
65 case MODE_SHOW_ID: 65 case MODE_SHOW_ID:
66 iphone_device_new(&phone, uuid); 66 idevice_new(&phone, uuid);
67 if (!phone) { 67 if (!phone) {
68 fprintf(stderr, "ERROR: No device with UUID=%s attached.\n", uuid); 68 fprintf(stderr, "ERROR: No device with UUID=%s attached.\n", uuid);
69 return -2; 69 return -2;
70 } 70 }
71 71
72 if (LOCKDOWN_E_SUCCESS != lockdownd_client_new(phone, &client, "iphone_id")) { 72 if (LOCKDOWN_E_SUCCESS != lockdownd_client_new(phone, &client, "idevice_id")) {
73 iphone_device_free(phone); 73 idevice_free(phone);
74 fprintf(stderr, "ERROR: Connecting to device failed!\n"); 74 fprintf(stderr, "ERROR: Connecting to device failed!\n");
75 return -2; 75 return -2;
76 } 76 }
@@ -81,7 +81,7 @@ int main(int argc, char **argv)
81 } 81 }
82 82
83 lockdownd_client_free(client); 83 lockdownd_client_free(client);
84 iphone_device_free(phone); 84 idevice_free(phone);
85 85
86 if (ret == 0) { 86 if (ret == 0) {
87 printf("%s\n", devname); 87 printf("%s\n", devname);
@@ -94,14 +94,14 @@ int main(int argc, char **argv)
94 return ret; 94 return ret;
95 case MODE_LIST_DEVICES: 95 case MODE_LIST_DEVICES:
96 default: 96 default:
97 if (iphone_get_device_list(&dev_list, &i) < 0) { 97 if (idevice_get_device_list(&dev_list, &i) < 0) {
98 fprintf(stderr, "ERROR: Unable to retrieve device list!\n"); 98 fprintf(stderr, "ERROR: Unable to retrieve device list!\n");
99 return -1; 99 return -1;
100 } 100 }
101 for (i = 0; dev_list[i] != NULL; i++) { 101 for (i = 0; dev_list[i] != NULL; i++) {
102 printf("%s\n", dev_list[i]); 102 printf("%s\n", dev_list[i]);
103 } 103 }
104 iphone_device_list_free(dev_list); 104 idevice_device_list_free(dev_list);
105 return 0; 105 return 0;
106 } 106 }
107} 107}
diff --git a/tools/iphonebackup.c b/tools/idevicebackup.c
index bc61347..d3b3ccc 100644
--- a/tools/iphonebackup.c
+++ b/tools/idevicebackup.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * iphonebackup.c 2 * idevicebackup.c
3 * Command line interface to use the device's backup and restore service 3 * Command line interface to use the device's backup and restore service
4 * 4 *
5 * Copyright (c) 2009-2010 Martin Szulecki All Rights Reserved. 5 * Copyright (c) 2009-2010 Martin Szulecki All Rights Reserved.
@@ -27,18 +27,18 @@
27#include <signal.h> 27#include <signal.h>
28#include <glib.h> 28#include <glib.h>
29 29
30#include <libiphone/libiphone.h> 30#include <libimobiledevice/libimobiledevice.h>
31#include <libiphone/lockdown.h> 31#include <libimobiledevice/lockdown.h>
32#include <libiphone/mobilebackup.h> 32#include <libimobiledevice/mobilebackup.h>
33#include <libiphone/notification_proxy.h> 33#include <libimobiledevice/notification_proxy.h>
34#include <libiphone/afc.h> 34#include <libimobiledevice/afc.h>
35 35
36#define MOBILEBACKUP_SERVICE_NAME "com.apple.mobilebackup" 36#define MOBILEBACKUP_SERVICE_NAME "com.apple.mobilebackup"
37#define NP_SERVICE_NAME "com.apple.mobile.notification_proxy" 37#define NP_SERVICE_NAME "com.apple.mobile.notification_proxy"
38 38
39static mobilebackup_client_t mobilebackup = NULL; 39static mobilebackup_client_t mobilebackup = NULL;
40static lockdownd_client_t client = NULL; 40static lockdownd_client_t client = NULL;
41static iphone_device_t phone = NULL; 41static idevice_t phone = NULL;
42 42
43static int quit_flag = 0; 43static int quit_flag = 0;
44 44
@@ -111,7 +111,7 @@ static plist_t mobilebackup_factory_info_plist_new()
111 plist_dict_insert_item(ret, "Serial Number", plist_copy(value_node)); 111 plist_dict_insert_item(ret, "Serial Number", plist_copy(value_node));
112 112
113 value_node = plist_dict_get_item(root_node, "UniqueDeviceID"); 113 value_node = plist_dict_get_item(root_node, "UniqueDeviceID");
114 iphone_device_get_uuid(phone, &uuid); 114 idevice_get_uuid(phone, &uuid);
115 plist_dict_insert_item(ret, "Target Identifier", plist_new_string(uuid)); 115 plist_dict_insert_item(ret, "Target Identifier", plist_new_string(uuid));
116 116
117 /* uppercase */ 117 /* uppercase */
@@ -383,7 +383,7 @@ static void do_post_notification(const char *notification)
383 np_client_t np; 383 np_client_t np;
384 384
385 if (!client) { 385 if (!client) {
386 if (lockdownd_client_new_with_handshake(phone, &client, "iphonebackup") != LOCKDOWN_E_SUCCESS) { 386 if (lockdownd_client_new_with_handshake(phone, &client, "idevicebackup") != LOCKDOWN_E_SUCCESS) {
387 return; 387 return;
388 } 388 }
389 } 389 }
@@ -427,7 +427,7 @@ static void print_usage(int argc, char **argv)
427 427
428int main(int argc, char *argv[]) 428int main(int argc, char *argv[])
429{ 429{
430 iphone_error_t ret = IPHONE_E_UNKNOWN_ERROR; 430 idevice_error_t ret = IDEVICE_E_UNKNOWN_ERROR;
431 int i; 431 int i;
432 char uuid[41]; 432 char uuid[41];
433 uint16_t port = 0; 433 uint16_t port = 0;
@@ -455,7 +455,7 @@ int main(int argc, char *argv[])
455 /* parse cmdline args */ 455 /* parse cmdline args */
456 for (i = 1; i < argc; i++) { 456 for (i = 1; i < argc; i++) {
457 if (!strcmp(argv[i], "-d") || !strcmp(argv[i], "--debug")) { 457 if (!strcmp(argv[i], "-d") || !strcmp(argv[i], "--debug")) {
458 iphone_set_debug_level(1); 458 idevice_set_debug_level(1);
459 continue; 459 continue;
460 } 460 }
461 else if (!strcmp(argv[i], "-u") || !strcmp(argv[i], "--uuid")) { 461 else if (!strcmp(argv[i], "-u") || !strcmp(argv[i], "--uuid")) {
@@ -518,23 +518,23 @@ int main(int argc, char *argv[])
518 printf("Backup directory is \"%s\"\n", backup_directory); 518 printf("Backup directory is \"%s\"\n", backup_directory);
519 519
520 if (uuid[0] != 0) { 520 if (uuid[0] != 0) {
521 ret = iphone_device_new(&phone, uuid); 521 ret = idevice_new(&phone, uuid);
522 if (ret != IPHONE_E_SUCCESS) { 522 if (ret != IDEVICE_E_SUCCESS) {
523 printf("No device found with uuid %s, is it plugged in?\n", uuid); 523 printf("No device found with uuid %s, is it plugged in?\n", uuid);
524 return -1; 524 return -1;
525 } 525 }
526 } 526 }
527 else 527 else
528 { 528 {
529 ret = iphone_device_new(&phone, NULL); 529 ret = idevice_new(&phone, NULL);
530 if (ret != IPHONE_E_SUCCESS) { 530 if (ret != IDEVICE_E_SUCCESS) {
531 printf("No device found, is it plugged in?\n"); 531 printf("No device found, is it plugged in?\n");
532 return -1; 532 return -1;
533 } 533 }
534 } 534 }
535 535
536 if (LOCKDOWN_E_SUCCESS != lockdownd_client_new_with_handshake(phone, &client, "iphonebackup")) { 536 if (LOCKDOWN_E_SUCCESS != lockdownd_client_new_with_handshake(phone, &client, "idevicebackup")) {
537 iphone_device_free(phone); 537 idevice_free(phone);
538 return -1; 538 return -1;
539 } 539 }
540 540
@@ -946,7 +946,7 @@ int main(int argc, char *argv[])
946 if (mobilebackup) 946 if (mobilebackup)
947 mobilebackup_client_free(mobilebackup); 947 mobilebackup_client_free(mobilebackup);
948 948
949 iphone_device_free(phone); 949 idevice_free(phone);
950 950
951 return 0; 951 return 0;
952} 952}
diff --git a/tools/iphoneinfo.c b/tools/ideviceinfo.c
index 5ee92f5..9183d92 100644
--- a/tools/iphoneinfo.c
+++ b/tools/ideviceinfo.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * iphoneinfo.c 2 * ideviceinfo.c
3 * Simple utility to show information about an attached device 3 * Simple utility to show information about an attached device
4 * 4 *
5 * Copyright (c) 2009 Martin Szulecki All Rights Reserved. 5 * Copyright (c) 2009 Martin Szulecki All Rights Reserved.
@@ -25,8 +25,8 @@
25#include <stdlib.h> 25#include <stdlib.h>
26#include <glib.h> 26#include <glib.h>
27 27
28#include <libiphone/libiphone.h> 28#include <libimobiledevice/libimobiledevice.h>
29#include <libiphone/lockdown.h> 29#include <libimobiledevice/lockdown.h>
30 30
31#define FORMAT_KEY_VALUE 1 31#define FORMAT_KEY_VALUE 1
32#define FORMAT_XML 2 32#define FORMAT_XML 2
@@ -197,7 +197,7 @@ static void print_usage(int argc, char **argv)
197 197
198 name = strrchr(argv[0], '/'); 198 name = strrchr(argv[0], '/');
199 printf("Usage: %s [OPTIONS]\n", (name ? name + 1: argv[0])); 199 printf("Usage: %s [OPTIONS]\n", (name ? name + 1: argv[0]));
200 printf("Show information about the first connected iPhone/iPod Touch.\n\n"); 200 printf("Show information about a connected iPhone/iPod Touch.\n\n");
201 printf(" -d, --debug\t\tenable communication debugging\n"); 201 printf(" -d, --debug\t\tenable communication debugging\n");
202 printf(" -u, --uuid UUID\ttarget specific device by its 40-digit device UUID\n"); 202 printf(" -u, --uuid UUID\ttarget specific device by its 40-digit device UUID\n");
203 printf(" -q, --domain NAME\tset domain of query to NAME. Default: None\n"); 203 printf(" -q, --domain NAME\tset domain of query to NAME. Default: None\n");
@@ -215,8 +215,8 @@ static void print_usage(int argc, char **argv)
215int main(int argc, char *argv[]) 215int main(int argc, char *argv[])
216{ 216{
217 lockdownd_client_t client = NULL; 217 lockdownd_client_t client = NULL;
218 iphone_device_t phone = NULL; 218 idevice_t phone = NULL;
219 iphone_error_t ret = IPHONE_E_UNKNOWN_ERROR; 219 idevice_error_t ret = IDEVICE_E_UNKNOWN_ERROR;
220 int i; 220 int i;
221 int format = FORMAT_KEY_VALUE; 221 int format = FORMAT_KEY_VALUE;
222 char uuid[41]; 222 char uuid[41];
@@ -231,7 +231,7 @@ int main(int argc, char *argv[])
231 /* parse cmdline args */ 231 /* parse cmdline args */
232 for (i = 1; i < argc; i++) { 232 for (i = 1; i < argc; i++) {
233 if (!strcmp(argv[i], "-d") || !strcmp(argv[i], "--debug")) { 233 if (!strcmp(argv[i], "-d") || !strcmp(argv[i], "--debug")) {
234 iphone_set_debug_level(1); 234 idevice_set_debug_level(1);
235 continue; 235 continue;
236 } 236 }
237 else if (!strcmp(argv[i], "-u") || !strcmp(argv[i], "--uuid")) { 237 else if (!strcmp(argv[i], "-u") || !strcmp(argv[i], "--uuid")) {
@@ -279,23 +279,23 @@ int main(int argc, char *argv[])
279 } 279 }
280 280
281 if (uuid[0] != 0) { 281 if (uuid[0] != 0) {
282 ret = iphone_device_new(&phone, uuid); 282 ret = idevice_new(&phone, uuid);
283 if (ret != IPHONE_E_SUCCESS) { 283 if (ret != IDEVICE_E_SUCCESS) {
284 printf("No device found with uuid %s, is it plugged in?\n", uuid); 284 printf("No device found with uuid %s, is it plugged in?\n", uuid);
285 return -1; 285 return -1;
286 } 286 }
287 } 287 }
288 else 288 else
289 { 289 {
290 ret = iphone_device_new(&phone, NULL); 290 ret = idevice_new(&phone, NULL);
291 if (ret != IPHONE_E_SUCCESS) { 291 if (ret != IDEVICE_E_SUCCESS) {
292 printf("No device found, is it plugged in?\n"); 292 printf("No device found, is it plugged in?\n");
293 return -1; 293 return -1;
294 } 294 }
295 } 295 }
296 296
297 if (LOCKDOWN_E_SUCCESS != lockdownd_client_new_with_handshake(phone, &client, "iphoneinfo")) { 297 if (LOCKDOWN_E_SUCCESS != lockdownd_client_new_with_handshake(phone, &client, "ideviceinfo")) {
298 iphone_device_free(phone); 298 idevice_free(phone);
299 return -1; 299 return -1;
300 } 300 }
301 301
@@ -329,7 +329,7 @@ int main(int argc, char *argv[])
329 if (domain != NULL) 329 if (domain != NULL)
330 free(domain); 330 free(domain);
331 lockdownd_client_free(client); 331 lockdownd_client_free(client);
332 iphone_device_free(phone); 332 idevice_free(phone);
333 333
334 return 0; 334 return 0;
335} 335}
diff --git a/tools/iphonesyslog.c b/tools/idevicesyslog.c
index 41e490f..32b9711 100644
--- a/tools/iphonesyslog.c
+++ b/tools/idevicesyslog.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * syslog_relay.c 2 * idevicesyslog.c
3 * Relay the syslog of a device to stdout 3 * Relay the syslog of a device to stdout
4 * 4 *
5 * Copyright (c) 2009 Martin Szulecki All Rights Reserved. 5 * Copyright (c) 2009 Martin Szulecki All Rights Reserved.
@@ -26,8 +26,8 @@
26#include <signal.h> 26#include <signal.h>
27#include <stdlib.h> 27#include <stdlib.h>
28 28
29#include <libiphone/libiphone.h> 29#include <libimobiledevice/libimobiledevice.h>
30#include <libiphone/lockdown.h> 30#include <libimobiledevice/lockdown.h>
31 31
32static int quit_flag = 0; 32static int quit_flag = 0;
33 33
@@ -45,8 +45,8 @@ static void clean_exit(int sig)
45int main(int argc, char *argv[]) 45int main(int argc, char *argv[])
46{ 46{
47 lockdownd_client_t client = NULL; 47 lockdownd_client_t client = NULL;
48 iphone_device_t phone = NULL; 48 idevice_t phone = NULL;
49 iphone_error_t ret = IPHONE_E_UNKNOWN_ERROR; 49 idevice_error_t ret = IDEVICE_E_UNKNOWN_ERROR;
50 int i; 50 int i;
51 char uuid[41]; 51 char uuid[41];
52 uint16_t port = 0; 52 uint16_t port = 0;
@@ -60,7 +60,7 @@ int main(int argc, char *argv[])
60 /* parse cmdline args */ 60 /* parse cmdline args */
61 for (i = 1; i < argc; i++) { 61 for (i = 1; i < argc; i++) {
62 if (!strcmp(argv[i], "-d") || !strcmp(argv[i], "--debug")) { 62 if (!strcmp(argv[i], "-d") || !strcmp(argv[i], "--debug")) {
63 iphone_set_debug_level(1); 63 idevice_set_debug_level(1);
64 continue; 64 continue;
65 } 65 }
66 else if (!strcmp(argv[i], "-u") || !strcmp(argv[i], "--uuid")) { 66 else if (!strcmp(argv[i], "-u") || !strcmp(argv[i], "--uuid")) {
@@ -83,23 +83,23 @@ int main(int argc, char *argv[])
83 } 83 }
84 84
85 if (uuid[0] != 0) { 85 if (uuid[0] != 0) {
86 ret = iphone_device_new(&phone, uuid); 86 ret = idevice_new(&phone, uuid);
87 if (ret != IPHONE_E_SUCCESS) { 87 if (ret != IDEVICE_E_SUCCESS) {
88 printf("No device found with uuid %s, is it plugged in?\n", uuid); 88 printf("No device found with uuid %s, is it plugged in?\n", uuid);
89 return -1; 89 return -1;
90 } 90 }
91 } 91 }
92 else 92 else
93 { 93 {
94 ret = iphone_device_new(&phone, NULL); 94 ret = idevice_new(&phone, NULL);
95 if (ret != IPHONE_E_SUCCESS) { 95 if (ret != IDEVICE_E_SUCCESS) {
96 printf("No device found, is it plugged in?\n"); 96 printf("No device found, is it plugged in?\n");
97 return -1; 97 return -1;
98 } 98 }
99 } 99 }
100 100
101 if (LOCKDOWN_E_SUCCESS != lockdownd_client_new_with_handshake(phone, &client, "iphonesyslog")) { 101 if (LOCKDOWN_E_SUCCESS != lockdownd_client_new_with_handshake(phone, &client, "idevicesyslog")) {
102 iphone_device_free(phone); 102 idevice_free(phone);
103 return -1; 103 return -1;
104 } 104 }
105 105
@@ -109,15 +109,15 @@ int main(int argc, char *argv[])
109 lockdownd_client_free(client); 109 lockdownd_client_free(client);
110 110
111 /* connect to socket relay messages */ 111 /* connect to socket relay messages */
112 iphone_connection_t conn = NULL; 112 idevice_connection_t conn = NULL;
113 if ((iphone_device_connect(phone, port, &conn) != IPHONE_E_SUCCESS) || !conn) { 113 if ((idevice_connect(phone, port, &conn) != IDEVICE_E_SUCCESS) || !conn) {
114 printf("ERROR: Could not open usbmux connection.\n"); 114 printf("ERROR: Could not open usbmux connection.\n");
115 } else { 115 } else {
116 while (!quit_flag) { 116 while (!quit_flag) {
117 char *receive = NULL; 117 char *receive = NULL;
118 uint32_t datalen = 0, bytes = 0, recv_bytes = 0; 118 uint32_t datalen = 0, bytes = 0, recv_bytes = 0;
119 119
120 ret = iphone_connection_receive(conn, (char *) &datalen, sizeof(datalen), &bytes); 120 ret = idevice_connection_receive(conn, (char *) &datalen, sizeof(datalen), &bytes);
121 datalen = ntohl(datalen); 121 datalen = ntohl(datalen);
122 122
123 if (datalen == 0) 123 if (datalen == 0)
@@ -127,7 +127,7 @@ int main(int argc, char *argv[])
127 receive = (char *) malloc(sizeof(char) * datalen); 127 receive = (char *) malloc(sizeof(char) * datalen);
128 128
129 while (!quit_flag && (recv_bytes <= datalen)) { 129 while (!quit_flag && (recv_bytes <= datalen)) {
130 ret = iphone_connection_receive(conn, receive, datalen, &bytes); 130 ret = idevice_connection_receive(conn, receive, datalen, &bytes);
131 131
132 if (bytes == 0) 132 if (bytes == 0)
133 break; 133 break;
@@ -140,12 +140,12 @@ int main(int argc, char *argv[])
140 free(receive); 140 free(receive);
141 } 141 }
142 } 142 }
143 iphone_device_disconnect(conn); 143 idevice_disconnect(conn);
144 } else { 144 } else {
145 printf("ERROR: Could not start service com.apple.syslog_relay.\n"); 145 printf("ERROR: Could not start service com.apple.syslog_relay.\n");
146 } 146 }
147 147
148 iphone_device_free(phone); 148 idevice_free(phone);
149 149
150 return 0; 150 return 0;
151} 151}