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
DISTCHECK_CONFIGURE_FLAGS = --enable-dev-tools
pkgconfigdir = $(libdir)/pkgconfig
-pkgconfig_DATA = libiphone-1.0.pc
+pkgconfig_DATA = libimobiledevice-1.0.pc
EXTRA_DIST= docs
diff --git a/README b/README
index e25c8c1..46932b2 100644
--- a/README
+++ b/README
@@ -42,6 +42,9 @@ On Ubuntu/Debian, you can do:
Who/What/Where?
===============
+Home:
+ http://www.libimobiledevice.org/
+
Wiki:
http://matt.colyer.name/projects/iphone-linux/
@@ -57,10 +60,10 @@ Mailing List:
Credits
=======
-Apple, iPhone, iPod and iPod Touch are trademarks of Apple Inc.
-libiphone is an independent software library and has not been authorized,
-sponsored, or otherwise approved by Apple Inc.
+Apple, iPhone, iPod, and iPod Touch are trademarks of Apple Inc.
+libimobiledevice is an independent software library and has not been
+authorized, sponsored, or otherwise approved by Apple Inc.
README Updated on:
- 2010-01-22
+ 2010-01-28
diff --git a/configure.ac b/configure.ac
index bb5634c..a4f68f7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2,7 +2,7 @@
# Process this file with autoconf to produce a configure script.
AC_PREREQ(2.61)
-AC_INIT(libiphone, 0.9.6, nospam@nowhere.com)
+AC_INIT(libimobiledevice, 0.9.7, nospam@nowhere.com)
AM_INIT_AUTOMAKE([dist-bzip2 no-dist-gzip])
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES])
AC_CONFIG_SRCDIR([src/])
@@ -27,7 +27,7 @@ PKG_CHECK_MODULES(libgnutls, gnutls >= 1.6.3 )
PKG_CHECK_MODULES(libtasn1, libtasn1 >= 1.1)
PKG_CHECK_MODULES(libplist, libplist >= 0.15)
PKG_CHECK_MODULES(libplistmm, libplist++ >= 0.15)
-AC_CHECK_LIB(gcrypt, gcry_control, [AC_SUBST(libgcrypt_LIBS,[-lgcrypt])], ["libgcrypt is required to build libiphone"])
+AC_CHECK_LIB(gcrypt, gcry_control, [AC_SUBST(libgcrypt_LIBS,[-lgcrypt])], ["libgcrypt is required to build libimobiledevice"])
# Checks for header files.
AC_HEADER_STDC
@@ -137,7 +137,7 @@ fdi/Makefile
dev/Makefile
tools/Makefile
swig/Makefile
-libiphone-1.0.pc
+libimobiledevice-1.0.pc
])
echo "
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
AM_LDFLAGS = $(libglib2_LIBS) $(libgnutls_LIBS) $(libtasn1_LIBS) $(libgthread2_LIBS)
if ENABLE_DEVTOOLS
-noinst_PROGRAMS = iphoneclient lckd-client afccheck msyncclient iphoneenterrecovery filerelaytest
+noinst_PROGRAMS = ideviceclient lckd-client afccheck msyncclient ideviceenterrecovery filerelaytest
-iphoneclient_SOURCES = iphoneclient.c
-iphoneclient_LDADD = ../src/libiphone.la
+ideviceclient_SOURCES = ideviceclient.c
+ideviceclient_LDADD = ../src/libimobiledevice.la
lckd_client_SOURCES = lckdclient.c
lckd_client_CFLAGS = $(AM_CFLAGS)
lckd_client_LDFLAGS = -lreadline $(AM_LDFLAGS)
-lckd_client_LDADD = ../src/libiphone.la
+lckd_client_LDADD = ../src/libimobiledevice.la
afccheck_SOURCES = afccheck.c
afccheck_CFLAGS = $(AM_CFLAGS)
afccheck_LDFLAGS = $(AM_LDFLAGS)
-afccheck_LDADD = ../src/libiphone.la
+afccheck_LDADD = ../src/libimobiledevice.la
msyncclient_SOURCES = msyncclient.c
msyncclient_CFLAGS = $(AM_CFLAGS)
msyncclient_LDFLAGS = $(AM_LDFLAGS)
-msyncclient_LDADD = ../src/libiphone.la
+msyncclient_LDADD = ../src/libimobiledevice.la
-iphoneenterrecovery_SOURCES = iphoneenterrecovery.c
-iphoneenterrecovery_CFLAGS = $(AM_CFLAGS)
-iphoneenterrecovery_LDFLAGS = $(AM_LDFLAGS)
-iphoneenterrecovery_LDADD = ../src/libiphone.la
+ideviceenterrecovery_SOURCES = ideviceenterrecovery.c
+ideviceenterrecovery_CFLAGS = $(AM_CFLAGS)
+ideviceenterrecovery_LDFLAGS = $(AM_LDFLAGS)
+ideviceenterrecovery_LDADD = ../src/libimobiledevice.la
filerelaytest_SOURCES = filerelaytest.c
filerelaytest_CFLAGS = $(AM_CFLAGS)
filerelaytest_LDFLAGS = $(AM_LDFLAGS)
-filerelaytest_LDADD = ../src/libiphone.la
+filerelaytest_LDADD = ../src/libimobiledevice.la
endif # ENABLE_DEVTOOLS
-EXTRA_DIST = iphoneclient.c lckdclient.c afccheck.c msyncclient.c iphoneenterrecovery.c
+EXTRA_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 @@
#include <string.h>
#include <glib.h>
-#include <libiphone/libiphone.h>
-#include <libiphone/lockdown.h>
-#include <libiphone/afc.h>
+#include <libimobiledevice/libimobiledevice.h>
+#include <libimobiledevice/lockdown.h>
+#include <libimobiledevice/afc.h>
#define BUFFER_SIZE 20000
#define NB_THREADS 10
@@ -53,7 +53,7 @@ static void check_afc(gpointer data)
buf[i] = ((param *) data)->id * i;
}
- //now writes buffer on iphone
+ //now writes buffer on device
uint64_t file = 0;
char path[50];
sprintf(path, "/Buf%i", ((param *) data)->id);
@@ -91,30 +91,30 @@ static void check_afc(gpointer data)
int main(int argc, char *argv[])
{
lockdownd_client_t client = NULL;
- iphone_device_t phone = NULL;
+ idevice_t phone = NULL;
GError *err;
uint16_t port = 0;
afc_client_t afc = NULL;
if (argc > 1 && !strcasecmp(argv[1], "--debug")) {
- iphone_set_debug_level(1);
+ idevice_set_debug_level(1);
} else {
- iphone_set_debug_level(0);
+ idevice_set_debug_level(0);
}
- if (IPHONE_E_SUCCESS != iphone_device_new(&phone, NULL)) {
- printf("No iPhone found, is it plugged in?\n");
+ if (IDEVICE_E_SUCCESS != idevice_new(&phone, NULL)) {
+ printf("No device found, is it plugged in?\n");
return 1;
}
if (LOCKDOWN_E_SUCCESS != lockdownd_client_new_with_handshake(phone, &client, "afccheck")) {
- iphone_device_free(phone);
+ idevice_free(phone);
return 1;
}
if (LOCKDOWN_E_SUCCESS == lockdownd_start_service(client, "com.apple.afc", &port) && !port) {
lockdownd_client_free(client);
- iphone_device_free(phone);
+ idevice_free(phone);
fprintf(stderr, "Something went wrong when starting AFC.");
return 1;
}
@@ -140,7 +140,7 @@ int main(int argc, char *argv[])
}
lockdownd_client_free(client);
- iphone_device_free(phone);
+ idevice_free(phone);
return 0;
}
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 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <stdio.h>
-#include <libiphone/libiphone.h>
-#include <libiphone/lockdown.h>
-#include <libiphone/file_relay.h>
+#include <libimobiledevice/libimobiledevice.h>
+#include <libimobiledevice/lockdown.h>
+#include <libimobiledevice/file_relay.h>
int main(int argc, char **argv)
{
- iphone_device_t dev = NULL;
+ idevice_t dev = NULL;
lockdownd_client_t client = NULL;
file_relay_client_t frc = NULL;
- if (iphone_device_new(&dev, NULL) != IPHONE_E_SUCCESS) {
+ if (idevice_new(&dev, NULL) != IDEVICE_E_SUCCESS) {
printf("no device connected?!\n");
goto leave_cleanup;
}
@@ -56,7 +56,7 @@ int main(int argc, char **argv)
goto leave_cleanup;
}
- iphone_connection_t dump = NULL;
+ idevice_connection_t dump = NULL;
const char *sources[] = {"AppleSupport", "Network", "VPN", "WiFi", "UserDatabases", "CrashReporter", "tmp", "SystemConfiguration", NULL};
printf("Requesting");
@@ -83,7 +83,7 @@ int main(int argc, char **argv)
FILE *f = fopen("dump.cpio.gz", "w");
setbuf(stdout, NULL);
printf("receiving ");
- while (iphone_connection_receive(dump, buf, 4096, &len) == IPHONE_E_SUCCESS) {
+ while (idevice_connection_receive(dump, buf, 4096, &len) == IDEVICE_E_SUCCESS) {
fwrite(buf, 1, len, f);
cnt += len;
printf(".", len);
@@ -101,7 +101,7 @@ leave_cleanup:
lockdownd_client_free(client);
}
if (dev) {
- iphone_device_free(dev);
+ idevice_free(dev);
}
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 @@
/*
* main.c
- * Rudimentary interface to the iPhone
+ * Test program for testing several services.
*
* Copyright (c) 2008 Zach C. All Rights Reserved.
*
@@ -25,10 +25,10 @@
#include <errno.h>
#include <glib.h>
-#include <libiphone/libiphone.h>
-#include <libiphone/lockdown.h>
-#include <libiphone/afc.h>
-#include <libiphone/notification_proxy.h>
+#include <libimobiledevice/libimobiledevice.h>
+#include <libimobiledevice/lockdown.h>
+#include <libimobiledevice/afc.h>
+#include <libimobiledevice/notification_proxy.h>
static void notifier(const char *notification)
{
@@ -37,7 +37,7 @@ static void notifier(const char *notification)
printf("---------------------------------------------------------\n");
}
-static void perform_notification(iphone_device_t phone, lockdownd_client_t client, const char *notification)
+static void perform_notification(idevice_t phone, lockdownd_client_t client, const char *notification)
{
uint16_t nport = 0;
np_client_t np;
@@ -62,30 +62,30 @@ int main(int argc, char *argv[])
uint16_t port = 0, i = 0;
uint16_t npp;
lockdownd_client_t client = NULL;
- iphone_device_t phone = NULL;
+ idevice_t phone = NULL;
uint64_t lockfile = 0;
np_client_t gnp = NULL;
if (argc > 1 && !strcasecmp(argv[1], "--debug")) {
- iphone_set_debug_level(1);
+ idevice_set_debug_level(1);
} else {
- iphone_set_debug_level(0);
+ idevice_set_debug_level(0);
}
- if (IPHONE_E_SUCCESS != iphone_device_new(&phone, NULL)) {
- printf("No iPhone found, is it plugged in?\n");
+ if (IDEVICE_E_SUCCESS != idevice_new(&phone, NULL)) {
+ printf("No device found, is it plugged in?\n");
return -1;
}
char *uuid = NULL;
- if (IPHONE_E_SUCCESS == iphone_device_get_uuid(phone, &uuid)) {
+ if (IDEVICE_E_SUCCESS == idevice_get_uuid(phone, &uuid)) {
printf("DeviceUniqueID : %s\n", uuid);
}
if (uuid)
free(uuid);
- if (LOCKDOWN_E_SUCCESS != lockdownd_client_new_with_handshake(phone, &client, "iphoneclient")) {
- iphone_device_free(phone);
+ if (LOCKDOWN_E_SUCCESS != lockdownd_client_new_with_handshake(phone, &client, "ideviceclient")) {
+ idevice_free(phone);
printf("Exiting.\n");
return -1;
}
@@ -154,7 +154,7 @@ int main(int argc, char *argv[])
uint64_t my_file = 0;
char **info = NULL;
uint64_t fsize = 0;
- if (AFC_E_SUCCESS == afc_get_file_info(afc, "/readme.libiphone.fx", &info) && info) {
+ if (AFC_E_SUCCESS == afc_get_file_info(afc, "/readme.libimobiledevice.fx", &info) && info) {
for (i = 0; info[i]; i += 2) {
printf("%s: %s\n", info[i], info[i+1]);
if (!strcmp(info[i], "st_size")) {
@@ -164,7 +164,7 @@ int main(int argc, char *argv[])
}
if (AFC_E_SUCCESS ==
- afc_file_open(afc, "/readme.libiphone.fx", AFC_FOPEN_RDONLY, &my_file) && my_file) {
+ afc_file_open(afc, "/readme.libimobiledevice.fx", AFC_FOPEN_RDONLY, &my_file) && my_file) {
printf("A file size: %llu\n", (long long)fsize);
char *file_data = (char *) malloc(sizeof(char) * fsize);
afc_file_read(afc, my_file, file_data, fsize, &bytes);
@@ -178,7 +178,7 @@ int main(int argc, char *argv[])
} else
printf("couldn't open a file\n");
- afc_file_open(afc, "/readme.libiphone.fx", AFC_FOPEN_WR, &my_file);
+ afc_file_open(afc, "/readme.libimobiledevice.fx", AFC_FOPEN_WR, &my_file);
if (my_file) {
char *outdatafile = strdup("this is a bitchin text file\n");
afc_file_write(afc, my_file, outdatafile, strlen(outdatafile), &bytes);
@@ -204,7 +204,7 @@ int main(int argc, char *argv[])
printf("Failure. (expected unless you have a /renme file on your phone)\n");
printf("Seek & read\n");
- afc_file_open(afc, "/readme.libiphone.fx", AFC_FOPEN_RDONLY, &my_file);
+ afc_file_open(afc, "/readme.libimobiledevice.fx", AFC_FOPEN_RDONLY, &my_file);
if (AFC_E_SUCCESS != afc_file_seek(afc, my_file, 5, SEEK_CUR))
printf("WARN: SEEK DID NOT WORK\n");
char *threeletterword = (char *) malloc(sizeof(char) * 5);
@@ -246,7 +246,7 @@ int main(int argc, char *argv[])
printf("All done.\n");
lockdownd_client_free(client);
- iphone_device_free(phone);
+ idevice_free(phone);
return 0;
}
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 @@
/*
- * iphoneenterrecovery.c
+ * ideviceenterrecovery.c
* Simple utility to make a device in normal mode enter recovery mode.
*
* Copyright (c) 2009 Martin Szulecki All Rights Reserved.
@@ -24,8 +24,8 @@
#include <errno.h>
#include <stdlib.h>
-#include <libiphone/libiphone.h>
-#include <libiphone/lockdown.h>
+#include <libimobiledevice/libimobiledevice.h>
+#include <libimobiledevice/lockdown.h>
static void print_usage(int argc, char **argv)
{
@@ -42,8 +42,8 @@ static void print_usage(int argc, char **argv)
int main(int argc, char *argv[])
{
lockdownd_client_t client = NULL;
- iphone_device_t phone = NULL;
- iphone_error_t ret = IPHONE_E_UNKNOWN_ERROR;
+ idevice_t phone = NULL;
+ idevice_error_t ret = IDEVICE_E_UNKNOWN_ERROR;
int i;
char uuid[41];
uuid[0] = 0;
@@ -51,7 +51,7 @@ int main(int argc, char *argv[])
/* parse cmdline args */
for (i = 1; i < argc; i++) {
if (!strcmp(argv[i], "-d") || !strcmp(argv[i], "--debug")) {
- iphone_set_debug_level(1);
+ idevice_set_debug_level(1);
continue;
}
else if (!strcmp(argv[i], "-h") || !strcmp(argv[i], "--help")) {
@@ -67,14 +67,14 @@ int main(int argc, char *argv[])
}
strcpy(uuid, argv[i]);
- ret = iphone_device_new(&phone, uuid);
- if (ret != IPHONE_E_SUCCESS) {
+ ret = idevice_new(&phone, uuid);
+ if (ret != IDEVICE_E_SUCCESS) {
printf("No device found with uuid %s, is it plugged in?\n", uuid);
return -1;
}
- if (LOCKDOWN_E_SUCCESS != lockdownd_client_new_with_handshake(phone, &client, "iphoneenterrecovery")) {
- iphone_device_free(phone);
+ if (LOCKDOWN_E_SUCCESS != lockdownd_client_new_with_handshake(phone, &client, "ideviceenterrecovery")) {
+ idevice_free(phone);
return -1;
}
@@ -87,7 +87,7 @@ int main(int argc, char *argv[])
printf("Device is successfully switching to recovery mode.\n");
lockdownd_client_free(client);
- iphone_device_free(phone);
+ idevice_free(phone);
return 0;
}
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 @@
#include <readline/readline.h>
#include <readline/history.h>
-#include <libiphone/libiphone.h>
-#include <libiphone/lockdown.h>
+#include <libimobiledevice/libimobiledevice.h>
+#include <libimobiledevice/lockdown.h>
int main(int argc, char *argv[])
{
lockdownd_client_t client = NULL;
- iphone_device_t phone = NULL;
+ idevice_t phone = NULL;
- iphone_set_debug_level(1);
+ idevice_set_debug_level(1);
- if (IPHONE_E_SUCCESS != iphone_device_new(&phone, NULL)) {
- printf("No iPhone found, is it plugged in?\n");
+ if (IDEVICE_E_SUCCESS != idevice_new(&phone, NULL)) {
+ printf("No device found, is it plugged in?\n");
return -1;
}
char *uuid = NULL;
- if (IPHONE_E_SUCCESS == iphone_device_get_uuid(phone, &uuid)) {
+ if (IDEVICE_E_SUCCESS == idevice_get_uuid(phone, &uuid)) {
printf("DeviceUniqueID : %s\n", uuid);
}
if (uuid)
free(uuid);
if (LOCKDOWN_E_SUCCESS != lockdownd_client_new_with_handshake(phone, &client, "lckdclient")) {
- iphone_device_free(phone);
+ idevice_free(phone);
return -1;
}
@@ -109,7 +109,7 @@ int main(int argc, char *argv[])
}
clear_history();
lockdownd_client_free(client);
- iphone_device_free(phone);
+ idevice_free(phone);
return 0;
}
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 @@
#! /usr/bin/env python
-from iphone import *
+from imobiledevice import *
from plist import *
# get msync client
def GetMobileSyncClient() :
- phone = iPhone()
+ phone = idevice()
if not phone.init_device() :
print "Couldn't find device, is it connected ?\n"
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 @@
/*
* msyncclient.c
- * Rudimentary interface to the MobileSync iPhone
+ * Rudimentary interface to the MobileSync service.
*
* Copyright (c) 2009 Jonathan Beck All Rights Reserved.
*
@@ -23,9 +23,9 @@
#include <string.h>
#include <errno.h>
-#include <libiphone/libiphone.h>
-#include <libiphone/lockdown.h>
-#include <libiphone/mobilesync.h>
+#include <libimobiledevice/libimobiledevice.h>
+#include <libimobiledevice/lockdown.h>
+#include <libimobiledevice/mobilesync.h>
static char check_string(plist_t node, char* string)
{
@@ -143,18 +143,18 @@ int main(int argc, char *argv[])
{
uint16_t port = 0;
lockdownd_client_t client = NULL;
- iphone_device_t phone = NULL;
+ idevice_t phone = NULL;
if (argc > 1 && !strcasecmp(argv[1], "--debug"))
- iphone_set_debug_level(1);
+ idevice_set_debug_level(1);
- if (IPHONE_E_SUCCESS != iphone_device_new(&phone, NULL)) {
- printf("No iPhone found, is it plugged in?\n");
+ if (IDEVICE_E_SUCCESS != idevice_new(&phone, NULL)) {
+ printf("No device found, is it plugged in?\n");
return -1;
}
if (LOCKDOWN_E_SUCCESS != lockdownd_client_new_with_handshake(phone, &client, "msyncclient")) {
- iphone_device_free(phone);
+ idevice_free(phone);
return -1;
}
@@ -174,7 +174,7 @@ int main(int argc, char *argv[])
printf("All done.\n");
lockdownd_client_free(client);
- iphone_device_free(phone);
+ idevice_free(phone);
return 0;
}
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 @@
-nobase_include_HEADERS = libiphone/libiphone.h \
- libiphone/lockdown.h \
- libiphone/afc.h \
- libiphone/file_relay.h \
- libiphone/notification_proxy.h \
- libiphone/installation_proxy.h \
- libiphone/sbservices.h \
- libiphone/mobilesync.h \
- libiphone/mobilebackup.h
+nobase_include_HEADERS = libimobiledevice/libimobiledevice.h \
+ libimobiledevice/lockdown.h \
+ libimobiledevice/afc.h \
+ libimobiledevice/file_relay.h \
+ libimobiledevice/notification_proxy.h \
+ libimobiledevice/installation_proxy.h \
+ libimobiledevice/sbservices.h \
+ libimobiledevice/mobilesync.h \
+ 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 @@
/**
- * @file libiphone/afc.h
+ * @file libimobiledevice/afc.h
* @brief AFC Implementation
* \internal
*
@@ -27,7 +27,7 @@
extern "C" {
#endif
-#include <libiphone/libiphone.h>
+#include <libimobiledevice/libimobiledevice.h>
/* Error Codes */
#define AFC_E_SUCCESS 0
@@ -87,7 +87,7 @@ struct afc_client_int;
typedef struct afc_client_int *afc_client_t;
/* Interface */
-afc_error_t afc_client_new(iphone_device_t device, uint16_t port, afc_client_t *client);
+afc_error_t afc_client_new(idevice_t device, uint16_t port, afc_client_t *client);
afc_error_t afc_client_free(afc_client_t client);
afc_error_t afc_get_device_info(afc_client_t client, char ***infos);
afc_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 @@
/**
- * @file libiphone/file_relay.h
+ * @file libimobiledevice/file_relay.h
* @brief file_relay Implementation
* \internal
*
@@ -27,7 +27,7 @@
extern "C" {
#endif
-#include <libiphone/libiphone.h>
+#include <libimobiledevice/libimobiledevice.h>
/* Error Codes */
#define FILE_RELAY_E_SUCCESS 0
@@ -44,10 +44,10 @@ typedef int16_t file_relay_error_t;
struct file_relay_client_int;
typedef struct file_relay_client_int *file_relay_client_t;
-file_relay_error_t file_relay_client_new(iphone_device_t device, uint16_t port, file_relay_client_t *client);
+file_relay_error_t file_relay_client_new(idevice_t device, uint16_t port, file_relay_client_t *client);
file_relay_error_t file_relay_client_free(file_relay_client_t client);
-file_relay_error_t file_relay_request_sources(file_relay_client_t client, const char **sources, iphone_connection_t *connection);
+file_relay_error_t file_relay_request_sources(file_relay_client_t client, const char **sources, idevice_connection_t *connection);
#ifdef __cplusplus
}
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 @@
/**
- * @file libiphone/installation_proxy.h
+ * @file libimobiledevice/installation_proxy.h
* @brief Implementation to talk to the installation proxy on a device
* \internal
*
@@ -27,7 +27,7 @@
extern "C" {
#endif
-#include <libiphone/libiphone.h>
+#include <libimobiledevice/libimobiledevice.h>
#include <glib.h>
/* Error Codes */
@@ -48,7 +48,7 @@ typedef struct instproxy_client_int *instproxy_client_t;
typedef void (*instproxy_status_cb_t) (const char *operation, plist_t status);
/* Interface */
-instproxy_error_t instproxy_client_new(iphone_device_t device, uint16_t port, instproxy_client_t *client);
+instproxy_error_t instproxy_client_new(idevice_t device, uint16_t port, instproxy_client_t *client);
instproxy_error_t instproxy_client_free(instproxy_client_t client);
instproxy_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 @@
+/**
+ * @file libimobiledevice/libimobiledevice.h
+ * @brief Common code and device handling
+ * \internal
+ *
+ * Copyright (c) 2008 Jonathan Beck All Rights Reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef LIBIMOBILEDEVICE_H
+#define LIBIMOBILEDEVICE_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <plist/plist.h>
+
+/* Error Codes */
+#define IDEVICE_E_SUCCESS 0
+#define IDEVICE_E_INVALID_ARG -1
+#define IDEVICE_E_UNKNOWN_ERROR -2
+#define IDEVICE_E_NO_DEVICE -3
+#define IDEVICE_E_NOT_ENOUGH_DATA -4
+#define IDEVICE_E_BAD_HEADER -5
+#define IDEVICE_E_SSL_ERROR -6
+
+typedef int16_t idevice_error_t;
+
+struct idevice_int;
+typedef struct idevice_int *idevice_t;
+
+struct idevice_connection_int;
+typedef struct idevice_connection_int *idevice_connection_t;
+
+/* generic */
+void idevice_set_debug_level(int level);
+
+/* discovery (events/asynchronous) */
+// event type
+enum idevice_event_type {
+ IDEVICE_DEVICE_ADD = 1,
+ IDEVICE_DEVICE_REMOVE
+};
+
+// event data structure
+typedef struct {
+ enum idevice_event_type event;
+ const char *uuid;
+ int conn_type;
+} idevice_event_t;
+
+// event callback function prototype
+typedef void (*idevice_event_cb_t) (const idevice_event_t *event, void *user_data);
+
+// functions
+idevice_error_t idevice_event_subscribe(idevice_event_cb_t callback, void *user_data);
+idevice_error_t idevice_event_unsubscribe();
+
+/* discovery (synchronous) */
+idevice_error_t idevice_get_device_list(char ***devices, int *count);
+idevice_error_t idevice_device_list_free(char **devices);
+
+/* device structure creation and destruction */
+idevice_error_t idevice_new(idevice_t *device, const char *uuid);
+idevice_error_t idevice_free(idevice_t device);
+
+/* connection/disconnection */
+idevice_error_t idevice_connect(idevice_t device, uint16_t port, idevice_connection_t *connection);
+idevice_error_t idevice_disconnect(idevice_connection_t connection);
+
+/* communication */
+idevice_error_t idevice_connection_send(idevice_connection_t connection, const char *data, uint32_t len, uint32_t *sent_bytes);
+idevice_error_t idevice_connection_receive_timeout(idevice_connection_t connection, char *data, uint32_t len, uint32_t *recv_bytes, unsigned int timeout);
+idevice_error_t idevice_connection_receive(idevice_connection_t connection, char *data, uint32_t len, uint32_t *recv_bytes);
+
+/* misc */
+idevice_error_t idevice_get_handle(idevice_t device, uint32_t *handle);
+idevice_error_t idevice_get_uuid(idevice_t device, char **uuid);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
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 @@
/**
- * @file libiphone/lockdown.h
+ * @file libimobiledevice/lockdown.h
* @brief Communcation with the lockdown device daemon
* \internal
*
@@ -28,7 +28,7 @@
extern "C" {
#endif
-#include <libiphone/libiphone.h>
+#include <libimobiledevice/libimobiledevice.h>
/* Error Codes */
#define LOCKDOWN_E_SUCCESS 0
@@ -66,8 +66,8 @@ struct lockdownd_pair_record {
typedef struct lockdownd_pair_record *lockdownd_pair_record_t;
/* Interface */
-lockdownd_error_t lockdownd_client_new(iphone_device_t device, lockdownd_client_t *client, const char *label);
-lockdownd_error_t lockdownd_client_new_with_handshake(iphone_device_t device, lockdownd_client_t *client, const char *label);
+lockdownd_error_t lockdownd_client_new(idevice_t device, lockdownd_client_t *client, const char *label);
+lockdownd_error_t lockdownd_client_new_with_handshake(idevice_t device, lockdownd_client_t *client, const char *label);
lockdownd_error_t lockdownd_client_free(lockdownd_client_t client);
lockdownd_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 @@
/**
- * @file libiphone/mobilebackup.h
+ * @file libimobiledevice/mobilebackup.h
* @brief MobileBackup Implementation
* \internal
*
@@ -27,7 +27,7 @@
extern "C" {
#endif
-#include <libiphone/libiphone.h>
+#include <libimobiledevice/libimobiledevice.h>
/* Error Codes */
#define MOBILEBACKUP_E_SUCCESS 0
@@ -43,7 +43,7 @@ typedef int16_t mobilebackup_error_t;
struct mobilebackup_client_int;
typedef struct mobilebackup_client_int *mobilebackup_client_t;
-mobilebackup_error_t mobilebackup_client_new(iphone_device_t device, uint16_t port, mobilebackup_client_t * client);
+mobilebackup_error_t mobilebackup_client_new(idevice_t device, uint16_t port, mobilebackup_client_t * client);
mobilebackup_error_t mobilebackup_client_free(mobilebackup_client_t client);
mobilebackup_error_t mobilebackup_receive(mobilebackup_client_t client, plist_t *plist);
mobilebackup_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 @@
/**
- * @file libiphone/mobilesync.h
+ * @file libimobiledevice/mobilesync.h
* @brief MobileSync Implementation
* \internal
*
@@ -27,7 +27,7 @@
extern "C" {
#endif
-#include <libiphone/libiphone.h>
+#include <libimobiledevice/libimobiledevice.h>
/* Error Codes */
#define MOBILESYNC_E_SUCCESS 0
@@ -43,7 +43,7 @@ typedef int16_t mobilesync_error_t;
struct mobilesync_client_int;
typedef struct mobilesync_client_int *mobilesync_client_t;
-mobilesync_error_t mobilesync_client_new(iphone_device_t device, uint16_t port, mobilesync_client_t * client);
+mobilesync_error_t mobilesync_client_new(idevice_t device, uint16_t port, mobilesync_client_t * client);
mobilesync_error_t mobilesync_client_free(mobilesync_client_t client);
mobilesync_error_t mobilesync_receive(mobilesync_client_t client, plist_t *plist);
mobilesync_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 @@
/**
- * @file libiphone/notification_proxy.h
+ * @file libimobiledevice/notification_proxy.h
* @brief Implementation to talk to the notification proxy on a device
* \internal
*
@@ -27,7 +27,7 @@
extern "C" {
#endif
-#include <libiphone/libiphone.h>
+#include <libimobiledevice/libimobiledevice.h>
/* Error Codes */
#define NP_E_SUCCESS 0
@@ -74,7 +74,7 @@ typedef struct np_client_int *np_client_t;
typedef void (*np_notify_cb_t) (const char *notification);
/* Interface */
-np_error_t np_client_new(iphone_device_t device, uint16_t port, np_client_t *client);
+np_error_t np_client_new(idevice_t device, uint16_t port, np_client_t *client);
np_error_t np_client_free(np_client_t client);
np_error_t np_post_notification(np_client_t client, const char *notification);
np_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 @@
/**
- * @file libiphone/sbservices.h
+ * @file libimobiledevice/sbservices.h
* @brief Implementation to talk to com.apple.springboardservices on a device
* \internal
*
@@ -27,7 +27,7 @@
extern "C" {
#endif
-#include <libiphone/libiphone.h>
+#include <libimobiledevice/libimobiledevice.h>
/* Error Codes */
#define SBSERVICES_E_SUCCESS 0
@@ -43,7 +43,7 @@ struct sbservices_client_int;
typedef struct sbservices_client_int *sbservices_client_t;
/* Interface */
-sbservices_error_t sbservices_client_new(iphone_device_t device, uint16_t port, sbservices_client_t *client);
+sbservices_error_t sbservices_client_new(idevice_t device, uint16_t port, sbservices_client_t *client);
sbservices_error_t sbservices_client_free(sbservices_client_t client);
sbservices_error_t sbservices_get_icon_state(sbservices_client_t client, plist_t *state);
sbservices_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 @@
-/**
- * @file libiphone/libiphone.h
- * @brief Common code and device handling
- * \internal
- *
- * Copyright (c) 2008 Jonathan Beck All Rights Reserved.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef LIBIPHONE_H
-#define LIBIPHONE_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <stdint.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <plist/plist.h>
-
-/* Error Codes */
-#define IPHONE_E_SUCCESS 0
-#define IPHONE_E_INVALID_ARG -1
-#define IPHONE_E_UNKNOWN_ERROR -2
-#define IPHONE_E_NO_DEVICE -3
-#define IPHONE_E_NOT_ENOUGH_DATA -4
-#define IPHONE_E_BAD_HEADER -5
-#define IPHONE_E_SSL_ERROR -6
-
-typedef int16_t iphone_error_t;
-
-struct iphone_device_int;
-typedef struct iphone_device_int *iphone_device_t;
-
-struct iphone_connection_int;
-typedef struct iphone_connection_int *iphone_connection_t;
-
-/* generic */
-void iphone_set_debug_level(int level);
-
-/* discovery (events/asynchronous) */
-// event type
-enum iphone_event_type {
- IPHONE_DEVICE_ADD = 1,
- IPHONE_DEVICE_REMOVE
-};
-
-// event data structure
-typedef struct {
- enum iphone_event_type event;
- const char *uuid;
- int conn_type;
-} iphone_event_t;
-
-// event callback function prototype
-typedef void (*iphone_event_cb_t) (const iphone_event_t *event, void *user_data);
-
-// functions
-iphone_error_t iphone_event_subscribe(iphone_event_cb_t callback, void *user_data);
-iphone_error_t iphone_event_unsubscribe();
-
-/* discovery (synchronous) */
-iphone_error_t iphone_get_device_list(char ***devices, int *count);
-iphone_error_t iphone_device_list_free(char **devices);
-
-/* device structure creation and destruction */
-iphone_error_t iphone_device_new(iphone_device_t *device, const char *uuid);
-iphone_error_t iphone_device_free(iphone_device_t device);
-
-/* connection/disconnection */
-iphone_error_t iphone_device_connect(iphone_device_t device, uint16_t port, iphone_connection_t *connection);
-iphone_error_t iphone_device_disconnect(iphone_connection_t connection);
-
-/* communication */
-iphone_error_t iphone_connection_send(iphone_connection_t connection, const char *data, uint32_t len, uint32_t *sent_bytes);
-iphone_error_t iphone_connection_receive_timeout(iphone_connection_t connection, char *data, uint32_t len, uint32_t *recv_bytes, unsigned int timeout);
-iphone_error_t iphone_connection_receive(iphone_connection_t connection, char *data, uint32_t len, uint32_t *recv_bytes);
-
-/* misc */
-iphone_error_t iphone_device_get_handle(iphone_device_t device, uint32_t *handle);
-iphone_error_t iphone_device_get_uuid(iphone_device_t device, char **uuid);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-
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@
libdir=@libdir@
includedir=@includedir@
-Name: libiphone
-Description: A library to communicate with the Lockdown server on the iPhone
+Name: libimobiledevice
+Description: A library to communicate with services running on Apple iPhone/iPod Touch devices.
Version: @VERSION@
Requires: 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
-Libs: -L${libdir} -liphone
+Libs: -L${libdir} -limobiledevice
Cflags: -I${includedir}
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
AM_CFLAGS = $(GLOBAL_CFLAGS) $(libusbmuxd_CFLAGS) $(libglib2_CFLAGS) $(libgnutls_CFLAGS) $(libtasn1_CFLAGS) $(libgthread2_CFLAGS) $(libplist_CFLAGS) $(LFS_CFLAGS)
AM_LDFLAGS = $(libglib2_LIBS) $(libgnutls_LIBS) $(libtasn1_LIBS) $(libgthread2_LIBS) $(libplist_LIBS) $(libusbmuxd_LIBS) $(libgcrypt_LIBS)
-lib_LTLIBRARIES = libiphone.la
-libiphone_la_SOURCES = iphone.c iphone.h \
+lib_LTLIBRARIES = libimobiledevice.la
+libimobiledevice_la_SOURCES = idevice.c idevice.h \
debug.c debug.h\
userpref.c userpref.h\
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 @@
#include <unistd.h>
#include "afc.h"
-#include "iphone.h"
+#include "idevice.h"
#include "debug.h"
// This is the maximum size an AFC data packet can be
@@ -61,7 +61,7 @@ static void afc_unlock(afc_client_t client)
* is invalid, AFC_E_MUX_ERROR when the connection failed, or AFC_E_NO_MEM
* when there's a memory allocation problem.
*/
-afc_error_t afc_client_new(iphone_device_t device, uint16_t port, afc_client_t * client)
+afc_error_t afc_client_new(idevice_t device, uint16_t port, afc_client_t * client)
{
/* makes sure thread environment is available */
if (!g_thread_supported())
@@ -71,8 +71,8 @@ afc_error_t afc_client_new(iphone_device_t device, uint16_t port, afc_client_t *
return AFC_E_INVALID_ARGUMENT;
/* attempt connection */
- iphone_connection_t connection = NULL;
- if (iphone_device_connect(device, port, &connection) != IPHONE_E_SUCCESS) {
+ idevice_connection_t connection = NULL;
+ if (idevice_connect(device, port, &connection) != IDEVICE_E_SUCCESS) {
return AFC_E_MUX_ERROR;
}
@@ -82,7 +82,7 @@ afc_error_t afc_client_new(iphone_device_t device, uint16_t port, afc_client_t *
/* allocate a packet */
client_loc->afc_packet = (AFCPacket *) malloc(sizeof(AFCPacket));
if (!client_loc->afc_packet) {
- iphone_device_disconnect(client_loc->connection);
+ idevice_disconnect(client_loc->connection);
free(client_loc);
return AFC_E_NO_MEM;
}
@@ -108,7 +108,7 @@ afc_error_t afc_client_free(afc_client_t client)
if (!client || !client->connection || !client->afc_packet)
return AFC_E_INVALID_ARGUMENT;
- iphone_device_disconnect(client->connection);
+ idevice_disconnect(client->connection);
free(client->afc_packet);
if (client->mutex) {
g_mutex_free(client->mutex);
@@ -169,7 +169,7 @@ static afc_error_t afc_dispatch_packet(afc_client_t client, const char *data, ui
/* send AFC packet header */
AFCPacket_to_LE(client->afc_packet);
sent = 0;
- iphone_connection_send(client->connection, (void*)client->afc_packet, sizeof(AFCPacket), &sent);
+ idevice_connection_send(client->connection, (void*)client->afc_packet, sizeof(AFCPacket), &sent);
if (sent == 0) {
/* FIXME: should this be handled as success?! */
return AFC_E_SUCCESS;
@@ -178,7 +178,7 @@ static afc_error_t afc_dispatch_packet(afc_client_t client, const char *data, ui
/* send AFC packet data */
sent = 0;
- iphone_connection_send(client->connection, data, offset, &sent);
+ idevice_connection_send(client->connection, data, offset, &sent);
if (sent == 0) {
return AFC_E_SUCCESS;
}
@@ -190,7 +190,7 @@ static afc_error_t afc_dispatch_packet(afc_client_t client, const char *data, ui
debug_buffer(data + offset, length - offset);
sent = 0;
- iphone_connection_send(client->connection, data + offset, length - offset, &sent);
+ idevice_connection_send(client->connection, data + offset, length - offset, &sent);
*bytes_sent = sent;
return AFC_E_SUCCESS;
@@ -203,7 +203,7 @@ static afc_error_t afc_dispatch_packet(afc_client_t client, const char *data, ui
/* send AFC packet header */
AFCPacket_to_LE(client->afc_packet);
sent = 0;
- iphone_connection_send(client->connection, (void*)client->afc_packet, sizeof(AFCPacket), &sent);
+ idevice_connection_send(client->connection, (void*)client->afc_packet, sizeof(AFCPacket), &sent);
if (sent == 0) {
return AFC_E_SUCCESS;
}
@@ -213,7 +213,7 @@ static afc_error_t afc_dispatch_packet(afc_client_t client, const char *data, ui
debug_info("packet data follows");
debug_buffer(data, length);
- iphone_connection_send(client->connection, data, length, &sent);
+ idevice_connection_send(client->connection, data, length, &sent);
*bytes_sent += sent;
}
return AFC_E_SUCCESS;
@@ -241,7 +241,7 @@ static afc_error_t afc_receive_data(afc_client_t client, char **dump_here, uint3
*bytes_recv = 0;
/* first, read the AFC header */
- iphone_connection_receive(client->connection, (char*)&header, sizeof(AFCPacket), bytes_recv);
+ idevice_connection_receive(client->connection, (char*)&header, sizeof(AFCPacket), bytes_recv);
AFCPacket_from_LE(&header);
if (*bytes_recv == 0) {
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
*dump_here = (char*)malloc(entire_len);
if (this_len > 0) {
- iphone_connection_receive(client->connection, *dump_here, this_len, bytes_recv);
+ idevice_connection_receive(client->connection, *dump_here, this_len, bytes_recv);
if (*bytes_recv <= 0) {
free(*dump_here);
*dump_here = NULL;
@@ -313,7 +313,7 @@ static afc_error_t afc_receive_data(afc_client_t client, char **dump_here, uint3
if (entire_len > this_len) {
while (current_count < entire_len) {
- iphone_connection_receive(client->connection, (*dump_here)+current_count, entire_len - current_count, bytes_recv);
+ idevice_connection_receive(client->connection, (*dump_here)+current_count, entire_len - current_count, bytes_recv);
if (*bytes_recv <= 0) {
debug_info("Error receiving data (recv returned %d)", *bytes_recv);
break;
@@ -701,7 +701,7 @@ afc_error_t afc_get_file_info(afc_client_t client, const char *path, char ***inf
*
* @return AFC_E_SUCCESS on success or an AFC_E_* error on failure.
*/
-iphone_error_t
+idevice_error_t
afc_file_open(afc_client_t client, const char *filename,
afc_file_mode_t file_mode, uint64_t *handle)
{
@@ -760,7 +760,7 @@ afc_file_open(afc_client_t client, const char *filename,
*
* @return AFC_E_SUCCESS on success or an AFC_E_* error value on error.
*/
-iphone_error_t
+idevice_error_t
afc_file_read(afc_client_t client, uint64_t handle, char *data, uint32_t length, uint32_t *bytes_read)
{
char *input = NULL;
@@ -833,7 +833,7 @@ afc_file_read(afc_client_t client, uint64_t handle, char *data, uint32_t length,
*
* @return AFC_E_SUCCESS on success, or an AFC_E_* error value on error.
*/
-iphone_error_t
+idevice_error_t
afc_file_write(afc_client_t client, uint64_t handle, const char *data, uint32_t length, uint32_t *bytes_written)
{
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 @@
#include <glib.h>
#include <stdint.h>
-#include "libiphone/afc.h"
+#include "libimobiledevice/afc.h"
#define AFC_MAGIC "CFA6LPAA"
#define AFC_MAGIC_LEN (8)
@@ -58,7 +58,7 @@ typedef struct __AFCToken {
} AFCToken;
struct afc_client_int {
- iphone_connection_t connection;
+ idevice_connection_t connection;
AFCPacket *afc_packet;
int file_handle;
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 @@
#include <stdlib.h>
#include "debug.h"
-#include "libiphone/libiphone.h"
+#include "libimobiledevice/libimobiledevice.h"
int debug_level = 0;
@@ -38,7 +38,7 @@ int debug_level = 0;
*
* @param level Set to 0 for no debugging or 1 for debugging.
*/
-void iphone_set_debug_level(int level)
+void idevice_set_debug_level(int level)
{
debug_level = level;
}
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)
* DEVICE_LINK_SERVICE_E_INVALID_ARG when one of the parameters is invalid,
* or DEVICE_LINK_SERVICE_E_MUX_ERROR when the connection failed.
*/
-device_link_service_error_t device_link_service_client_new(iphone_device_t device, uint16_t port, device_link_service_client_t *client)
+device_link_service_error_t device_link_service_client_new(idevice_t device, uint16_t port, device_link_service_client_t *client)
{
if (!device || port == 0 || !client || *client) {
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;
typedef int16_t device_link_service_error_t;
-device_link_service_error_t device_link_service_client_new(iphone_device_t device, uint16_t port, device_link_service_client_t *client);
+device_link_service_error_t device_link_service_client_new(idevice_t device, uint16_t port, device_link_service_client_t *client);
device_link_service_error_t device_link_service_client_free(device_link_service_client_t client);
device_link_service_error_t device_link_service_version_exchange(device_link_service_client_t client, uint64_t version_major, uint64_t version_minor);
device_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 @@
* FILE_RELAY_E_INVALID_ARG when one of the parameters is invalid,
* or FILE_RELAY_E_MUX_ERROR when the connection failed.
*/
-file_relay_error_t file_relay_client_new(iphone_device_t device, uint16_t port, file_relay_client_t *client)
+file_relay_error_t file_relay_client_new(idevice_t device, uint16_t port, file_relay_client_t *client)
{
if (!device || port == 0 || !client || *client) {
return FILE_RELAY_E_INVALID_ARG;
@@ -92,7 +92,7 @@ file_relay_error_t file_relay_client_free(file_relay_client_t client)
* - tmp
* - SystemConfiguration
* @param connection The connection that has to be used for receiving the
- * data using iphone_connection_receive(). The connection will be closed
+ * data using idevice_connection_receive(). The connection will be closed
* automatically by the device, but use file_relay_client_free() to clean
* up properly.
*
@@ -107,7 +107,7 @@ file_relay_error_t file_relay_client_free(file_relay_client_t client)
* sources are invalid, FILE_RELAY_E_STAGING_EMPTY if no data is available
* for the given sources, or FILE_RELAY_E_UNKNOWN_ERROR otherwise.
*/
-file_relay_error_t file_relay_request_sources(file_relay_client_t client, const char **sources, iphone_connection_t *connection)
+file_relay_error_t file_relay_request_sources(file_relay_client_t client, const char **sources, idevice_connection_t *connection)
{
if (!client || !client->parent || !sources || !sources[0]) {
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 @@
#ifndef FILE_RELAY_H
#define FILE_RELAY_H
-#include "libiphone/file_relay.h"
+#include "libimobiledevice/file_relay.h"
#include "property_list_service.h"
/* 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 @@
/*
- * iphone.c
+ * idevice.c
* Device discovery and communication interface.
*
* Copyright (c) 2008 Zach C. All Rights Reserved.
@@ -27,14 +27,14 @@
#include <usbmuxd.h>
#include <gnutls/gnutls.h>
-#include "iphone.h"
+#include "idevice.h"
#include "debug.h"
-static iphone_event_cb_t event_cb = NULL;
+static idevice_event_cb_t event_cb = NULL;
static void usbmux_event_cb(const usbmuxd_event_t *event, void *user_data)
{
- iphone_event_t ev;
+ idevice_event_t ev;
ev.event = event->event;
ev.uuid = event->device.uuid;
@@ -53,35 +53,35 @@ static void usbmux_event_cb(const usbmuxd_event_t *event, void *user_data)
* @param user_data Application-specific data passed as parameter
* to the registered callback function.
*
- * @return IPHONE_E_SUCCESS on success or an error value when an error occured.
+ * @return IDEVICE_E_SUCCESS on success or an error value when an error occured.
*/
-iphone_error_t iphone_event_subscribe(iphone_event_cb_t callback, void *user_data)
+idevice_error_t idevice_event_subscribe(idevice_event_cb_t callback, void *user_data)
{
event_cb = callback;
int res = usbmuxd_subscribe(usbmux_event_cb, user_data);
if (res != 0) {
event_cb = NULL;
debug_info("Error %d when subscribing usbmux event callback!", res);
- return IPHONE_E_UNKNOWN_ERROR;
+ return IDEVICE_E_UNKNOWN_ERROR;
}
- return IPHONE_E_SUCCESS;
+ return IDEVICE_E_SUCCESS;
}
/**
* Release the event callback function that has been registered with
- * iphone_event_subscribe().
+ * idevice_event_subscribe().
*
- * @return IPHONE_E_SUCCESS on success or an error value when an error occured.
+ * @return IDEVICE_E_SUCCESS on success or an error value when an error occured.
*/
-iphone_error_t iphone_event_unsubscribe()
+idevice_error_t idevice_event_unsubscribe()
{
event_cb = NULL;
int res = usbmuxd_unsubscribe();
if (res != 0) {
debug_info("Error %d when unsubscribing usbmux event callback!", res);
- return IPHONE_E_UNKNOWN_ERROR;
+ return IDEVICE_E_UNKNOWN_ERROR;
}
- return IPHONE_E_SUCCESS;
+ return IDEVICE_E_SUCCESS;
}
/**
@@ -91,9 +91,9 @@ iphone_error_t iphone_event_unsubscribe()
* This list is terminated by a NULL pointer.
* @param count Number of devices found.
*
- * @return IPHONE_E_SUCCESS on success or an error value when an error occured.
+ * @return IDEVICE_E_SUCCESS on success or an error value when an error occured.
*/
-iphone_error_t iphone_get_device_list(char ***devices, int *count)
+idevice_error_t idevice_get_device_list(char ***devices, int *count)
{
usbmuxd_device_info_t *dev_list;
@@ -102,7 +102,7 @@ iphone_error_t iphone_get_device_list(char ***devices, int *count)
if (usbmuxd_get_device_list(&dev_list) < 0) {
debug_info("ERROR: usbmuxd is not running!\n", __func__);
- return IPHONE_E_NO_DEVICE;
+ return IDEVICE_E_NO_DEVICE;
}
char **newlist = NULL;
@@ -120,7 +120,7 @@ iphone_error_t iphone_get_device_list(char ***devices, int *count)
newlist[newcount] = NULL;
*devices = newlist;
- return IPHONE_E_SUCCESS;
+ return IDEVICE_E_SUCCESS;
}
/**
@@ -128,9 +128,9 @@ iphone_error_t iphone_get_device_list(char ***devices, int *count)
*
* @param devices List of uuids to free.
*
- * @return Always returnes IPHONE_E_SUCCESS.
+ * @return Always returnes IDEVICE_E_SUCCESS.
*/
-iphone_error_t iphone_device_list_free(char **devices)
+idevice_error_t idevice_device_list_free(char **devices)
{
if (devices) {
int i = 0;
@@ -139,52 +139,52 @@ iphone_error_t iphone_device_list_free(char **devices)
}
free(devices);
}
- return IPHONE_E_SUCCESS;
+ return IDEVICE_E_SUCCESS;
}
/**
- * Creates an iphone_device_t structure for the device specified by uuid,
+ * Creates an idevice_t structure for the device specified by uuid,
* if the device is available.
*
- * @note The resulting iphone_device_t structure has to be freed with
- * iphone_device_free() if it is no longer used.
+ * @note The resulting idevice_t structure has to be freed with
+ * idevice_free() if it is no longer used.
*
* @param device Upon calling this function, a pointer to a location of type
- * iphone_device_t. On successful return, this location will be populated.
+ * idevice_t. On successful return, this location will be populated.
* @param uuid The UUID to match.
*
- * @return IPHONE_E_SUCCESS if ok, otherwise an error code.
+ * @return IDEVICE_E_SUCCESS if ok, otherwise an error code.
*/
-iphone_error_t iphone_device_new(iphone_device_t * device, const char *uuid)
+idevice_error_t idevice_new(idevice_t * device, const char *uuid)
{
usbmuxd_device_info_t muxdev;
int res = usbmuxd_get_device_by_uuid(uuid, &muxdev);
if (res > 0) {
- iphone_device_t phone = (iphone_device_t) malloc(sizeof(struct iphone_device_int));
+ idevice_t phone = (idevice_t) malloc(sizeof(struct idevice_int));
phone->uuid = strdup(muxdev.uuid);
phone->conn_type = CONNECTION_USBMUXD;
phone->conn_data = (void*)muxdev.handle;
*device = phone;
- return IPHONE_E_SUCCESS;
+ return IDEVICE_E_SUCCESS;
}
/* other connection types could follow here */
- return IPHONE_E_NO_DEVICE;
+ return IDEVICE_E_NO_DEVICE;
}
-/** Cleans up an iPhone structure, then frees the structure itself.
- * This is a library-level function; deals directly with the iPhone to tear
+/** Cleans up an idevice structure, then frees the structure itself.
+ * This is a library-level function; deals directly with the device to tear
* down relations, but otherwise is mostly internal.
*
- * @param device A pointer to an iPhone structure.
+ * @param device idevice_t to free.
*/
-iphone_error_t iphone_device_free(iphone_device_t device)
+idevice_error_t idevice_free(idevice_t device)
{
if (!device)
- return IPHONE_E_INVALID_ARG;
- iphone_error_t ret = IPHONE_E_UNKNOWN_ERROR;
+ return IDEVICE_E_INVALID_ARG;
+ idevice_error_t ret = IDEVICE_E_UNKNOWN_ERROR;
- ret = IPHONE_E_SUCCESS;
+ ret = IDEVICE_E_SUCCESS;
free(device->uuid);
@@ -203,34 +203,34 @@ iphone_error_t iphone_device_free(iphone_device_t device)
*
* @param device The device to connect to.
* @param port The destination port to connect to.
- * @param connection Pointer to an iphone_connection_t that will be filled
+ * @param connection Pointer to an idevice_connection_t that will be filled
* with the necessary data of the connection.
*
- * @return IPHONE_E_SUCCESS if ok, otherwise an error code.
+ * @return IDEVICE_E_SUCCESS if ok, otherwise an error code.
*/
-iphone_error_t iphone_device_connect(iphone_device_t device, uint16_t port, iphone_connection_t *connection)
+idevice_error_t idevice_connect(idevice_t device, uint16_t port, idevice_connection_t *connection)
{
if (!device) {
- return IPHONE_E_INVALID_ARG;
+ return IDEVICE_E_INVALID_ARG;
}
if (device->conn_type == CONNECTION_USBMUXD) {
int sfd = usbmuxd_connect((uint32_t)(device->conn_data), port);
if (sfd < 0) {
debug_info("ERROR: Connecting to usbmuxd failed: %d (%s)", sfd, strerror(-sfd));
- return IPHONE_E_UNKNOWN_ERROR;
+ return IDEVICE_E_UNKNOWN_ERROR;
}
- iphone_connection_t new_connection = (iphone_connection_t)malloc(sizeof(struct iphone_connection_int));
+ idevice_connection_t new_connection = (idevice_connection_t)malloc(sizeof(struct idevice_connection_int));
new_connection->type = CONNECTION_USBMUXD;
new_connection->data = (void*)sfd;
new_connection->ssl_data = NULL;
*connection = new_connection;
- return IPHONE_E_SUCCESS;
+ return IDEVICE_E_SUCCESS;
} else {
debug_info("Unknown connection type %d", device->conn_type);
}
- return IPHONE_E_UNKNOWN_ERROR;
+ return IDEVICE_E_UNKNOWN_ERROR;
}
/**
@@ -238,21 +238,21 @@ iphone_error_t iphone_device_connect(iphone_device_t device, uint16_t port, ipho
*
* @param connection The connection to close.
*
- * @return IPHONE_E_SUCCESS if ok, otherwise an error code.
+ * @return IDEVICE_E_SUCCESS if ok, otherwise an error code.
*/
-iphone_error_t iphone_device_disconnect(iphone_connection_t connection)
+idevice_error_t idevice_disconnect(idevice_connection_t connection)
{
if (!connection) {
- return IPHONE_E_INVALID_ARG;
+ return IDEVICE_E_INVALID_ARG;
}
/* shut down ssl if enabled */
if (connection->ssl_data) {
- iphone_connection_disable_ssl(connection);
+ idevice_connection_disable_ssl(connection);
}
- iphone_error_t result = IPHONE_E_UNKNOWN_ERROR;
+ idevice_error_t result = IDEVICE_E_UNKNOWN_ERROR;
if (connection->type == CONNECTION_USBMUXD) {
usbmuxd_disconnect((int)(connection->data));
- result = IPHONE_E_SUCCESS;
+ result = IDEVICE_E_SUCCESS;
} else {
debug_info("Unknown connection type %d", connection->type);
}
@@ -263,23 +263,23 @@ iphone_error_t iphone_device_disconnect(iphone_connection_t connection)
/**
* Internally used function to send raw data over the given connection.
*/
-static iphone_error_t internal_connection_send(iphone_connection_t connection, const char *data, uint32_t len, uint32_t *sent_bytes)
+static idevice_error_t internal_connection_send(idevice_connection_t connection, const char *data, uint32_t len, uint32_t *sent_bytes)
{
if (!connection || !data) {
- return IPHONE_E_INVALID_ARG;
+ return IDEVICE_E_INVALID_ARG;
}
if (connection->type == CONNECTION_USBMUXD) {
int res = usbmuxd_send((int)(connection->data), data, len, sent_bytes);
if (res < 0) {
debug_info("ERROR: usbmuxd_send returned %d (%s)", res, strerror(-res));
- return IPHONE_E_UNKNOWN_ERROR;
+ return IDEVICE_E_UNKNOWN_ERROR;
}
- return IPHONE_E_SUCCESS;
+ return IDEVICE_E_SUCCESS;
} else {
debug_info("Unknown connection type %d", connection->type);
}
- return IPHONE_E_UNKNOWN_ERROR;
+ return IDEVICE_E_UNKNOWN_ERROR;
}
@@ -292,22 +292,22 @@ static iphone_error_t internal_connection_send(iphone_connection_t connection, c
* @param sent_bytes Pointer to an uint32_t that will be filled
* with the number of bytes actually sent.
*
- * @return IPHONE_E_SUCCESS if ok, otherwise an error code.
+ * @return IDEVICE_E_SUCCESS if ok, otherwise an error code.
*/
-iphone_error_t iphone_connection_send(iphone_connection_t connection, const char *data, uint32_t len, uint32_t *sent_bytes)
+idevice_error_t idevice_connection_send(idevice_connection_t connection, const char *data, uint32_t len, uint32_t *sent_bytes)
{
if (!connection || !data || (connection->ssl_data && !connection->ssl_data->session)) {
- return IPHONE_E_INVALID_ARG;
+ return IDEVICE_E_INVALID_ARG;
}
if (connection->ssl_data) {
ssize_t sent = gnutls_record_send(connection->ssl_data->session, (void*)data, (size_t)len);
if ((uint32_t)sent == (uint32_t)len) {
*sent_bytes = sent;
- return IPHONE_E_SUCCESS;
+ return IDEVICE_E_SUCCESS;
}
*sent_bytes = 0;
- return IPHONE_E_SSL_ERROR;
+ return IDEVICE_E_SSL_ERROR;
}
return internal_connection_send(connection, data, len, sent_bytes);
}
@@ -316,23 +316,23 @@ iphone_error_t iphone_connection_send(iphone_connection_t connection, const char
* Internally used function for receiving raw data over the given connection
* using a timeout.
*/
-static iphone_error_t internal_connection_receive_timeout(iphone_connection_t connection, char *data, uint32_t len, uint32_t *recv_bytes, unsigned int timeout)
+static idevice_error_t internal_connection_receive_timeout(idevice_connection_t connection, char *data, uint32_t len, uint32_t *recv_bytes, unsigned int timeout)
{
if (!connection) {
- return IPHONE_E_INVALID_ARG;
+ return IDEVICE_E_INVALID_ARG;
}
if (connection->type == CONNECTION_USBMUXD) {
int res = usbmuxd_recv_timeout((int)(connection->data), data, len, recv_bytes, timeout);
if (res < 0) {
debug_info("ERROR: usbmuxd_recv_timeout returned %d (%s)", res, strerror(-res));
- return IPHONE_E_UNKNOWN_ERROR;
+ return IDEVICE_E_UNKNOWN_ERROR;
}
- return IPHONE_E_SUCCESS;
+ return IDEVICE_E_SUCCESS;
} else {
debug_info("Unknown connection type %d", connection->type);
}
- return IPHONE_E_UNKNOWN_ERROR;
+ return IDEVICE_E_UNKNOWN_ERROR;
}
/**
@@ -348,22 +348,22 @@ static iphone_error_t internal_connection_receive_timeout(iphone_connection_t co
* @param timeout Timeout in milliseconds after which this function should
* return even if no data has been received.
*
- * @return IPHONE_E_SUCCESS if ok, otherwise an error code.
+ * @return IDEVICE_E_SUCCESS if ok, otherwise an error code.
*/
-iphone_error_t iphone_connection_receive_timeout(iphone_connection_t connection, char *data, uint32_t len, uint32_t *recv_bytes, unsigned int timeout)
+idevice_error_t idevice_connection_receive_timeout(idevice_connection_t connection, char *data, uint32_t len, uint32_t *recv_bytes, unsigned int timeout)
{
if (!connection || (connection->ssl_data && !connection->ssl_data->session)) {
- return IPHONE_E_INVALID_ARG;
+ return IDEVICE_E_INVALID_ARG;
}
if (connection->ssl_data) {
ssize_t received = gnutls_record_recv(connection->ssl_data->session, (void*)data, (size_t)len);
if (received > 0) {
*recv_bytes = received;
- return IPHONE_E_SUCCESS;
+ return IDEVICE_E_SUCCESS;
}
*recv_bytes = 0;
- return IPHONE_E_SSL_ERROR;
+ return IDEVICE_E_SSL_ERROR;
}
return internal_connection_receive_timeout(connection, data, len, recv_bytes, timeout);
}
@@ -371,30 +371,30 @@ iphone_error_t iphone_connection_receive_timeout(iphone_connection_t connection,
/**
* Internally used function for receiving raw data over the given connection.
*/
-static iphone_error_t internal_connection_receive(iphone_connection_t connection, char *data, uint32_t len, uint32_t *recv_bytes)
+static idevice_error_t internal_connection_receive(idevice_connection_t connection, char *data, uint32_t len, uint32_t *recv_bytes)
{
if (!connection) {
- return IPHONE_E_INVALID_ARG;
+ return IDEVICE_E_INVALID_ARG;
}
if (connection->type == CONNECTION_USBMUXD) {
int res = usbmuxd_recv((int)(connection->data), data, len, recv_bytes);
if (res < 0) {
debug_info("ERROR: usbmuxd_recv returned %d (%s)", res, strerror(-res));
- return IPHONE_E_UNKNOWN_ERROR;
+ return IDEVICE_E_UNKNOWN_ERROR;
}
- return IPHONE_E_SUCCESS;
+ return IDEVICE_E_SUCCESS;
} else {
debug_info("Unknown connection type %d", connection->type);
}
- return IPHONE_E_UNKNOWN_ERROR;
+ return IDEVICE_E_UNKNOWN_ERROR;
}
/**
* Receive data from a device via the given connection.
- * This function is like iphone_connection_receive_timeout, but with a predefined
- * reasonable timeout.
+ * This function is like idevice_connection_receive_timeout, but with a
+ * predefined reasonable timeout.
*
* @param connection The connection to receive data from.
* @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
* @param len Buffer size or number of bytes to receive.
* @param recv_bytes Number of bytes actually received.
*
- * @return IPHONE_E_SUCCESS if ok, otherwise an error code.
+ * @return IDEVICE_E_SUCCESS if ok, otherwise an error code.
*/
-iphone_error_t iphone_connection_receive(iphone_connection_t connection, char *data, uint32_t len, uint32_t *recv_bytes)
+idevice_error_t idevice_connection_receive(idevice_connection_t connection, char *data, uint32_t len, uint32_t *recv_bytes)
{
if (!connection || (connection->ssl_data && !connection->ssl_data->session)) {
- return IPHONE_E_INVALID_ARG;
+ return IDEVICE_E_INVALID_ARG;
}
if (connection->ssl_data) {
ssize_t received = gnutls_record_recv(connection->ssl_data->session, (void*)data, (size_t)len);
if (received > 0) {
*recv_bytes = received;
- return IPHONE_E_SUCCESS;
+ return IDEVICE_E_SUCCESS;
}
*recv_bytes = 0;
- return IPHONE_E_SSL_ERROR;
+ return IDEVICE_E_SSL_ERROR;
}
return internal_connection_receive(connection, data, len, recv_bytes);
}
-iphone_error_t iphone_device_get_handle(iphone_device_t device, uint32_t *handle)
+idevice_error_t idevice_get_handle(idevice_t device, uint32_t *handle)
{
if (!device)
- return IPHONE_E_INVALID_ARG;
+ return IDEVICE_E_INVALID_ARG;
if (device->conn_type == CONNECTION_USBMUXD) {
*handle = (uint32_t)device->conn_data;
- return IPHONE_E_SUCCESS;
+ return IDEVICE_E_SUCCESS;
} else {
debug_info("Unknown connection type %d", device->conn_type);
}
- return IPHONE_E_UNKNOWN_ERROR;
+ return IDEVICE_E_UNKNOWN_ERROR;
}
-iphone_error_t iphone_device_get_uuid(iphone_device_t device, char **uuid)
+idevice_error_t idevice_get_uuid(idevice_t device, char **uuid)
{
if (!device)
- return IPHONE_E_INVALID_ARG;
+ return IDEVICE_E_INVALID_ARG;
*uuid = strdup(device->uuid);
- return IPHONE_E_SUCCESS;
+ return IDEVICE_E_SUCCESS;
}
/**
@@ -453,8 +453,8 @@ static ssize_t internal_ssl_read(gnutls_transport_ptr_t transport, char *buffer,
int bytes = 0, pos_start_fill = 0;
size_t tbytes = 0;
int this_len = length;
- iphone_error_t res;
- iphone_connection_t connection = (iphone_connection_t)transport;
+ idevice_error_t res;
+ idevice_connection_t connection = (idevice_connection_t)transport;
char *recv_buffer;
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,
/* repeat until we have the full data or an error occurs */
do {
- if ((res = internal_connection_receive(connection, recv_buffer, this_len, (uint32_t*)&bytes)) != IPHONE_E_SUCCESS) {
- debug_info("ERROR: iphone_connection_receive returned %d", res);
+ if ((res = internal_connection_receive(connection, recv_buffer, this_len, (uint32_t*)&bytes)) != IDEVICE_E_SUCCESS) {
+ debug_info("ERROR: idevice_connection_receive returned %d", res);
return res;
}
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,
static ssize_t internal_ssl_write(gnutls_transport_ptr_t transport, char *buffer, size_t length)
{
uint32_t bytes = 0;
- iphone_connection_t connection = (iphone_connection_t)transport;
+ idevice_connection_t connection = (idevice_connection_t)transport;
debug_info("pre-send length = %zi", length);
internal_connection_send(connection, buffer, length, &bytes);
debug_info("post-send sent %i bytes", bytes);
@@ -524,16 +524,16 @@ static void internal_ssl_cleanup(ssl_data_t ssl_data)
*
* @param connection The connection to enable SSL for.
*
- * @return IPHONE_E_SUCCESS on success, IPHONE_E_INVALID_ARG when connection
- * is NULL or connection->ssl_data is non-NULL, or IPHONE_E_SSL_ERROR when
+ * @return IDEVICE_E_SUCCESS on success, IDEVICE_E_INVALID_ARG when connection
+ * is NULL or connection->ssl_data is non-NULL, or IDEVICE_E_SSL_ERROR when
* SSL initialization, setup, or handshake fails.
*/
-iphone_error_t iphone_connection_enable_ssl(iphone_connection_t connection)
+idevice_error_t idevice_connection_enable_ssl(idevice_connection_t connection)
{
if (!connection || connection->ssl_data)
- return IPHONE_E_INVALID_ARG;
+ return IDEVICE_E_INVALID_ARG;
- iphone_error_t ret = IPHONE_E_SSL_ERROR;
+ idevice_error_t ret = IDEVICE_E_SSL_ERROR;
uint32_t return_me = 0;
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)
debug_info("oh.. errno says %s", strerror(errno));
} else {
connection->ssl_data = ssl_data_loc;
- ret = IPHONE_E_SUCCESS;
+ ret = IDEVICE_E_SUCCESS;
debug_info("SSL mode enabled");
}
return ret;
@@ -591,17 +591,17 @@ iphone_error_t iphone_connection_enable_ssl(iphone_connection_t connection)
*
* @param connection The connection to disable SSL for.
*
- * @return IPHONE_E_SUCCESS on success, IPHONE_E_INVALID_ARG when connection
- * is NULL. This function also returns IPHONE_E_SUCCESS when SSL is not
+ * @return IDEVICE_E_SUCCESS on success, IDEVICE_E_INVALID_ARG when connection
+ * is NULL. This function also returns IDEVICE_E_SUCCESS when SSL is not
* enabled and does no further error checking on cleanup.
*/
-iphone_error_t iphone_connection_disable_ssl(iphone_connection_t connection)
+idevice_error_t idevice_connection_disable_ssl(idevice_connection_t connection)
{
if (!connection)
- return IPHONE_E_INVALID_ARG;
+ return IDEVICE_E_INVALID_ARG;
if (!connection->ssl_data) {
/* ignore if ssl is not enabled */
- return IPHONE_E_SUCCESS;
+ return IDEVICE_E_SUCCESS;
}
if (connection->ssl_data->session) {
@@ -613,6 +613,6 @@ iphone_error_t iphone_connection_disable_ssl(iphone_connection_t connection)
debug_info("SSL mode disabled");
- return IPHONE_E_SUCCESS;
+ return IDEVICE_E_SUCCESS;
}
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 @@
/*
- * iphone.h
+ * idevice.h
* Device discovery and communication interface -- header file.
*
* Copyright (c) 2008 Zach C. All Rights Reserved.
@@ -18,13 +18,13 @@
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#ifndef IPHONE_H
-#define IPHONE_H
+#ifndef IDEVICE_H
+#define IDEVICE_H
#include <plist/plist.h>
#include <gnutls/gnutls.h>
-#include "libiphone/libiphone.h"
+#include "libimobiledevice/libimobiledevice.h"
enum connection_type {
CONNECTION_USBMUXD = 1
@@ -36,19 +36,19 @@ struct ssl_data_int {
};
typedef struct ssl_data_int *ssl_data_t;
-struct iphone_connection_int {
+struct idevice_connection_int {
enum connection_type type;
void *data;
ssl_data_t ssl_data;
};
-struct iphone_device_int {
+struct idevice_int {
char *uuid;
enum connection_type conn_type;
void *conn_data;
};
-iphone_error_t iphone_connection_enable_ssl(iphone_connection_t connection);
-iphone_error_t iphone_connection_disable_ssl(iphone_connection_t connection);
+idevice_error_t idevice_connection_enable_ssl(idevice_connection_t connection);
+idevice_error_t idevice_connection_disable_ssl(idevice_connection_t connection);
#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)
* @return INSTPROXY_E_SUCCESS on success, or an INSTPROXY_E_* error value
* when an error occured.
*/
-instproxy_error_t instproxy_client_new(iphone_device_t device, uint16_t port, instproxy_client_t *client)
+instproxy_error_t instproxy_client_new(idevice_t device, uint16_t port, instproxy_client_t *client)
{
/* makes sure thread environment is available */
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 @@
#include <glib.h>
-#include "libiphone/installation_proxy.h"
+#include "libimobiledevice/installation_proxy.h"
#include "property_list_service.h"
struct 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 @@
/*
* lockdown.c
- * libiphone built-in lockdownd client
+ * libimobiledevice built-in lockdownd client
*
* Copyright (c) 2008 Zach C. All Rights Reserved.
*
@@ -30,7 +30,7 @@
#include "property_list_service.h"
#include "lockdown.h"
-#include "iphone.h"
+#include "idevice.h"
#include "debug.h"
#include "userpref.h"
@@ -229,7 +229,7 @@ void lockdownd_client_set_label(lockdownd_client_t client, const char *label)
}
}
-/** Polls the iPhone for lockdownd data.
+/** Polls the device for lockdownd data.
*
* @param control The lockdownd client
* @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)
return ret;
}
-/** Sends lockdownd data to the iPhone
+/** Sends lockdownd data to the device
*
* @note This function is low-level and should only be used if you need to send
* a new type of message.
@@ -270,7 +270,7 @@ lockdownd_error_t lockdownd_send(lockdownd_client_t client, plist_t plist)
return LOCKDOWN_E_INVALID_ARG;
lockdownd_error_t ret = LOCKDOWN_E_SUCCESS;
- iphone_error_t err;
+ idevice_error_t err;
err = property_list_service_send_xml_plist(client->parent, plist);
if (err != PROPERTY_LIST_SERVICE_E_SUCCESS) {
@@ -578,7 +578,7 @@ lockdownd_error_t lockdownd_get_device_name(lockdownd_client_t client, char **de
*
* @return an error code (LOCKDOWN_E_SUCCESS on success)
*/
-lockdownd_error_t lockdownd_client_new(iphone_device_t device, lockdownd_client_t *client, const char *label)
+lockdownd_error_t lockdownd_client_new(idevice_t device, lockdownd_client_t *client, const char *label)
{
if (!client)
return LOCKDOWN_E_INVALID_ARG;
@@ -619,7 +619,7 @@ lockdownd_error_t lockdownd_client_new(iphone_device_t device, lockdownd_client_
*
* @return an error code (LOCKDOWN_E_SUCCESS on success)
*/
-lockdownd_error_t lockdownd_client_new_with_handshake(iphone_device_t device, lockdownd_client_t *client, const char *label)
+lockdownd_error_t lockdownd_client_new_with_handshake(idevice_t device, lockdownd_client_t *client, const char *label)
{
if (!client)
return LOCKDOWN_E_INVALID_ARG;
@@ -644,7 +644,7 @@ lockdownd_error_t lockdownd_client_new_with_handshake(iphone_device_t device, lo
free(type);
}
- ret = iphone_device_get_uuid(device, &client_loc->uuid);
+ ret = idevice_get_uuid(device, &client_loc->uuid);
if (LOCKDOWN_E_SUCCESS != ret) {
debug_info("failed to get device uuid.");
}
@@ -759,7 +759,7 @@ static lockdownd_error_t lockdownd_do_pair(lockdownd_client_t client, lockdownd_
plist_t dict = NULL;
plist_t dict_record = NULL;
gnutls_datum_t public_key = { NULL, 0 };
- int pairing_mode = 0; /* 0 = libiphone, 1 = external */
+ int pairing_mode = 0; /* 0 = libimobiledevice, 1 = external */
if (pair_record && pair_record->host_id) {
/* valid pair_record passed? */
@@ -780,7 +780,7 @@ static lockdownd_error_t lockdownd_do_pair(lockdownd_client_t client, lockdownd_
return ret;
}
debug_info("device public key follows:\n%s", public_key.data);
- /* get libiphone pair_record */
+ /* get libimobiledevice pair_record */
ret = generate_pair_record_plist(public_key, NULL, &dict_record);
if (ret != LOCKDOWN_E_SUCCESS) {
if (dict_record)
@@ -795,7 +795,7 @@ static lockdownd_error_t lockdownd_do_pair(lockdownd_client_t client, lockdownd_
plist_dict_insert_item(dict,"PairRecord", dict_record);
plist_dict_insert_item(dict, "Request", plist_new_string(verb));
- /* send to iPhone */
+ /* send to device */
ret = lockdownd_send(client, dict);
plist_free(dict);
dict = NULL;
@@ -803,7 +803,7 @@ static lockdownd_error_t lockdownd_do_pair(lockdownd_client_t client, lockdownd_
if (ret != LOCKDOWN_E_SUCCESS)
return ret;
- /* Now get iPhone's answer */
+ /* Now get device's answer */
ret = lockdownd_receive(client, &dict);
if (ret != LOCKDOWN_E_SUCCESS)
@@ -1116,7 +1116,7 @@ lockdownd_error_t lockdownd_gen_pair_cert(gnutls_datum_t public_key, gnutls_datu
return ret;
}
-/** Starts communication with lockdownd after the iPhone has been paired,
+/** Starts communication with lockdownd after the device has been paired,
* and if the device requires it, switches to SSL mode.
*
* @param client The lockdownd client
@@ -1244,7 +1244,7 @@ lockdownd_error_t lockdownd_start_service(lockdownd_client_t client, const char
plist_dict_insert_item(dict,"Request", plist_new_string("StartService"));
plist_dict_insert_item(dict,"Service", plist_new_string(service));
- /* send to iPhone */
+ /* send to device */
ret = lockdownd_send(client, dict);
plist_free(dict);
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 @@
#include <gnutls/gnutls.h>
#include <string.h>
-#include "libiphone/lockdown.h"
+#include "libimobiledevice/lockdown.h"
#include "property_list_service.h"
struct 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)
return MOBILEBACKUP_E_UNKNOWN_ERROR;
}
-mobilebackup_error_t mobilebackup_client_new(iphone_device_t device, uint16_t port,
+mobilebackup_error_t mobilebackup_client_new(idevice_t device, uint16_t port,
mobilebackup_client_t * client)
{
if (!device || port == 0 || !client || *client)
@@ -97,7 +97,7 @@ mobilebackup_error_t mobilebackup_client_free(mobilebackup_client_t client)
return err;
}
-/** Polls the iPhone for MobileBackup data.
+/** Polls the device for MobileBackup data.
*
* @param client The MobileBackup client
* @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
return ret;
}
-/** Sends MobileBackup data to the iPhone
+/** Sends MobileBackup data to the device
*
* @note This function is low-level and should only be used if you need to send
* 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 @@
#ifndef MOBILEBACKUP_H
#define MOBILEBACKUP_H
-#include "libiphone/mobilebackup.h"
+#include "libimobiledevice/mobilebackup.h"
#include "device_link_service.h"
struct 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)
return MOBILESYNC_E_UNKNOWN_ERROR;
}
-mobilesync_error_t mobilesync_client_new(iphone_device_t device, uint16_t port,
+mobilesync_error_t mobilesync_client_new(idevice_t device, uint16_t port,
mobilesync_client_t * client)
{
if (!device || port == 0 || !client || *client)
@@ -97,7 +97,7 @@ mobilesync_error_t mobilesync_client_free(mobilesync_client_t client)
return err;
}
-/** Polls the iPhone for MobileSync data.
+/** Polls the device for MobileSync data.
*
* @param client The MobileSync client
* @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
return ret;
}
-/** Sends MobileSync data to the iPhone
+/** Sends MobileSync data to the device
*
* @note This function is low-level and should only be used if you need to send
* 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 @@
#ifndef MOBILESYNC_H
#define MOBILESYNC_H
-#include "libiphone/mobilesync.h"
+#include "libimobiledevice/mobilesync.h"
#include "device_link_service.h"
struct 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)
* or NP_E_CONN_FAILED when the connection to the device could not be
* established.
*/
-np_error_t np_client_new(iphone_device_t device, uint16_t port, np_client_t *client)
+np_error_t np_client_new(idevice_t device, uint16_t port, np_client_t *client)
{
/* makes sure thread environment is available */
if (!g_thread_supported())
@@ -177,7 +177,7 @@ np_error_t np_post_notification(np_client_t client, const char *notification)
return res;
}
-/** Notifies the iphone to send a notification on the specified event.
+/** Notifies the device to send a notification on the specified event.
*
* @param client The client to send to
* @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
return res;
}
-/** Notifies the iphone to send a notification on specified events.
+/** Notifies the device to send a notification on specified events.
*
* @param client The client to send to
* @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 @@
#include <glib.h>
-#include "libiphone/notification_proxy.h"
+#include "libimobiledevice/notification_proxy.h"
#include "property_list_service.h"
struct 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 @@
#include <arpa/inet.h>
#include "property_list_service.h"
-#include "iphone.h"
+#include "idevice.h"
#include "debug.h"
/**
- * Convert an iphone_error_t value to an property_list_service_error_t value.
+ * Convert an idevice_error_t value to an property_list_service_error_t value.
* Used internally to get correct error codes.
*
- * @param err An iphone_error_t error code
+ * @param err An idevice_error_t error code
*
* @return A matching property_list_service_error_t error code,
* PROPERTY_LIST_SERVICE_E_UNKNOWN_ERROR otherwise.
*/
-static property_list_service_error_t iphone_to_property_list_service_error(iphone_error_t err)
+static property_list_service_error_t idevice_to_property_list_service_error(idevice_error_t err)
{
switch (err) {
- case IPHONE_E_SUCCESS:
+ case IDEVICE_E_SUCCESS:
return PROPERTY_LIST_SERVICE_E_SUCCESS;
- case IPHONE_E_INVALID_ARG:
+ case IDEVICE_E_INVALID_ARG:
return PROPERTY_LIST_SERVICE_E_INVALID_ARG;
- case IPHONE_E_SSL_ERROR:
+ case IDEVICE_E_SSL_ERROR:
return PROPERTY_LIST_SERVICE_E_SSL_ERROR;
default:
break;
@@ -64,14 +64,14 @@ static property_list_service_error_t iphone_to_property_list_service_error(iphon
* PROPERTY_LIST_SERVICE_E_INVALID_ARG when one of the arguments is invalid,
* or PROPERTY_LIST_SERVICE_E_MUX_ERROR when connecting to the device failed.
*/
-property_list_service_error_t property_list_service_client_new(iphone_device_t device, uint16_t port, property_list_service_client_t *client)
+property_list_service_error_t property_list_service_client_new(idevice_t device, uint16_t port, property_list_service_client_t *client)
{
if (!device || port == 0 || !client || *client)
return PROPERTY_LIST_SERVICE_E_INVALID_ARG;
/* Attempt connection */
- iphone_connection_t connection = NULL;
- if (iphone_device_connect(device, port, &connection) != IPHONE_E_SUCCESS) {
+ idevice_connection_t connection = NULL;
+ if (idevice_connect(device, port, &connection) != IDEVICE_E_SUCCESS) {
return PROPERTY_LIST_SERVICE_E_MUX_ERROR;
}
@@ -98,7 +98,7 @@ property_list_service_error_t property_list_service_client_free(property_list_se
if (!client)
return PROPERTY_LIST_SERVICE_E_INVALID_ARG;
- property_list_service_error_t err = iphone_to_property_list_service_error(iphone_device_disconnect(client->connection));
+ property_list_service_error_t err = idevice_to_property_list_service_error(idevice_disconnect(client->connection));
free(client);
return err;
}
@@ -141,9 +141,9 @@ static property_list_service_error_t internal_plist_send(property_list_service_c
nlen = htonl(length);
debug_info("sending %d bytes", length);
- iphone_connection_send(client->connection, (const char*)&nlen, sizeof(nlen), (uint32_t*)&bytes);
+ idevice_connection_send(client->connection, (const char*)&nlen, sizeof(nlen), (uint32_t*)&bytes);
if (bytes == sizeof(nlen)) {
- iphone_connection_send(client->connection, content, length, (uint32_t*)&bytes);
+ idevice_connection_send(client->connection, content, length, (uint32_t*)&bytes);
if (bytes > 0) {
debug_info("sent %d bytes", bytes);
debug_plist(plist);
@@ -221,7 +221,7 @@ static property_list_service_error_t internal_plist_receive_timeout(property_lis
return PROPERTY_LIST_SERVICE_E_INVALID_ARG;
}
- iphone_connection_receive_timeout(client->connection, (char*)&pktlen, sizeof(pktlen), &bytes, timeout);
+ idevice_connection_receive_timeout(client->connection, (char*)&pktlen, sizeof(pktlen), &bytes, timeout);
debug_info("initial read=%i", bytes);
if (bytes < 4) {
debug_info("initial read failed!");
@@ -235,7 +235,7 @@ static property_list_service_error_t internal_plist_receive_timeout(property_lis
content = (char*)malloc(pktlen);
while (curlen < pktlen) {
- iphone_connection_receive(client->connection, content+curlen, pktlen-curlen, &bytes);
+ idevice_connection_receive(client->connection, content+curlen, pktlen-curlen, &bytes);
if (bytes <= 0) {
res = PROPERTY_LIST_SERVICE_E_MUX_ERROR;
break;
@@ -324,7 +324,7 @@ property_list_service_error_t property_list_service_enable_ssl(property_list_ser
{
if (!client || !client->connection)
return PROPERTY_LIST_SERVICE_E_INVALID_ARG;
- return iphone_to_property_list_service_error(iphone_connection_enable_ssl(client->connection));
+ return idevice_to_property_list_service_error(idevice_connection_enable_ssl(client->connection));
}
/**
@@ -341,6 +341,6 @@ property_list_service_error_t property_list_service_disable_ssl(property_list_se
{
if (!client || !client->connection)
return PROPERTY_LIST_SERVICE_E_INVALID_ARG;
- return iphone_to_property_list_service_error(iphone_connection_disable_ssl(client->connection));
+ return idevice_to_property_list_service_error(idevice_connection_disable_ssl(client->connection));
}
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 @@
#ifndef PROPERTY_LIST_SERVICE_H
#define PROPERTY_LIST_SERVICE_H
-#include "iphone.h"
+#include "idevice.h"
/* Error Codes */
#define PROPERTY_LIST_SERVICE_E_SUCCESS 0
@@ -33,7 +33,7 @@
#define PROPERTY_LIST_SERVICE_E_UNKNOWN_ERROR -256
struct property_list_service_client_int {
- iphone_connection_t connection;
+ idevice_connection_t connection;
};
typedef 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;
typedef int16_t property_list_service_error_t;
/* creation and destruction */
-property_list_service_error_t property_list_service_client_new(iphone_device_t device, uint16_t port, property_list_service_client_t *client);
+property_list_service_error_t property_list_service_client_new(idevice_t device, uint16_t port, property_list_service_client_t *client);
property_list_service_error_t property_list_service_client_free(property_list_service_client_t client);
/* 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)
* @return SBSERVICES_E_SUCCESS on success, SBSERVICES_E_INVALID_ARG when
* client is NULL, or an SBSERVICES_E_* error code otherwise.
*/
-sbservices_error_t sbservices_client_new(iphone_device_t device, uint16_t port, sbservices_client_t *client)
+sbservices_error_t sbservices_client_new(idevice_t device, uint16_t port, sbservices_client_t *client)
{
/* makes sure thread environment is available */
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 @@
#include <glib.h>
-#include "libiphone/sbservices.h"
+#include "libimobiledevice/sbservices.h"
#include "property_list_service.h"
struct 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 @@
#include "userpref.h"
#include "debug.h"
-#define LIBIPHONE_CONF_DIR "libiphone"
-#define LIBIPHONE_CONF_FILE "libiphonerc"
+#define LIBIMOBILEDEVICE_CONF_DIR "libimobiledevice"
+#define LIBIMOBILEDEVICE_CONF_FILE "libimobiledevicerc"
-#define LIBIPHONE_ROOT_PRIVKEY "RootPrivateKey.pem"
-#define LIBIPHONE_HOST_PRIVKEY "HostPrivateKey.pem"
-#define LIBIPHONE_ROOT_CERTIF "RootCertificate.pem"
-#define LIBIPHONE_HOST_CERTIF "HostCertificate.pem"
+#define LIBIMOBILEDEVICE_ROOT_PRIVKEY "RootPrivateKey.pem"
+#define LIBIMOBILEDEVICE_HOST_PRIVKEY "HostPrivateKey.pem"
+#define LIBIMOBILEDEVICE_ROOT_CERTIF "RootCertificate.pem"
+#define LIBIMOBILEDEVICE_HOST_CERTIF "HostCertificate.pem"
-/** Creates a freedesktop compatible configuration directory for libiphone.
+/** Creates a freedesktop compatible configuration directory.
*/
static void userpref_create_config_dir(void)
{
- gchar *config_dir = g_build_path(G_DIR_SEPARATOR_S, g_get_user_config_dir(), LIBIPHONE_CONF_DIR, NULL);
+ gchar *config_dir = g_build_path(G_DIR_SEPARATOR_S, g_get_user_config_dir(), LIBIMOBILEDEVICE_CONF_DIR, NULL);
if (!g_file_test(config_dir, (G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR)))
g_mkdir_with_parents(config_dir, 0755);
@@ -112,7 +112,7 @@ static int userpref_set_host_id(const char *host_id)
/* Write config file on disk */
buf = g_key_file_to_data(key_file, &length, NULL);
config_file =
- g_build_path(G_DIR_SEPARATOR_S, g_get_user_config_dir(), LIBIPHONE_CONF_DIR, LIBIPHONE_CONF_FILE, NULL);
+ g_build_path(G_DIR_SEPARATOR_S, g_get_user_config_dir(), LIBIMOBILEDEVICE_CONF_DIR, LIBIMOBILEDEVICE_CONF_FILE, NULL);
file = g_io_channel_new_file(config_file, "w", NULL);
g_free(config_file);
g_io_channel_write_chars(file, buf, length, NULL, NULL);
@@ -136,7 +136,7 @@ void userpref_get_host_id(char **host_id)
gchar *loc_host_id;
config_file =
- g_build_path(G_DIR_SEPARATOR_S, g_get_user_config_dir(), LIBIPHONE_CONF_DIR, LIBIPHONE_CONF_FILE, NULL);
+ g_build_path(G_DIR_SEPARATOR_S, g_get_user_config_dir(), LIBIMOBILEDEVICE_CONF_DIR, LIBIMOBILEDEVICE_CONF_FILE, NULL);
/* now parse file to get the HostID */
key_file = g_key_file_new();
@@ -158,11 +158,11 @@ void userpref_get_host_id(char **host_id)
debug_info("Using %s as HostID", *host_id);
}
-/** Determines whether this iPhone has been connected to this system before.
+/** Determines whether this device has been connected to this system before.
*
- * @param uid The device uid as given by the iPhone.
+ * @param uid The device uid as given by the device.
*
- * @return 1 if the iPhone has been connected previously to this configuration
+ * @return 1 if the device has been connected previously to this configuration
* or 0 otherwise.
*/
int userpref_has_device_public_key(const char *uuid)
@@ -172,7 +172,7 @@ int userpref_has_device_public_key(const char *uuid)
/* first get config file */
gchar *device_file = g_strconcat(uuid, ".pem", NULL);
- config_file = g_build_path(G_DIR_SEPARATOR_S, g_get_user_config_dir(), LIBIPHONE_CONF_DIR, device_file, NULL);
+ config_file = g_build_path(G_DIR_SEPARATOR_S, g_get_user_config_dir(), LIBIMOBILEDEVICE_CONF_DIR, device_file, NULL);
if (g_file_test(config_file, (G_FILE_TEST_EXISTS | G_FILE_TEST_IS_REGULAR)))
ret = 1;
g_free(config_file);
@@ -180,10 +180,10 @@ int userpref_has_device_public_key(const char *uuid)
return ret;
}
-/** Mark the iPhone (as represented by the key) as having connected to this
+/** Mark the device (as represented by the key) as having connected to this
* configuration.
*
- * @param public_key The public key given by the iPhone
+ * @param public_key The public key given by the device
*
* @return 1 on success and 0 if no public key is given or if it has already
* been marked as connected previously.
@@ -201,7 +201,7 @@ userpref_error_t userpref_set_device_public_key(const char *uuid, gnutls_datum_t
/* build file path */
gchar *device_file = g_strconcat(uuid, ".pem", NULL);
- gchar *pem = g_build_path(G_DIR_SEPARATOR_S, g_get_user_config_dir(), LIBIPHONE_CONF_DIR, device_file, NULL);
+ gchar *pem = g_build_path(G_DIR_SEPARATOR_S, g_get_user_config_dir(), LIBIMOBILEDEVICE_CONF_DIR, device_file, NULL);
/* store file */
FILE *pFile = fopen(pem, "wb");
@@ -226,7 +226,7 @@ userpref_error_t userpref_remove_device_public_key(const char *uuid)
/* build file path */
gchar *device_file = g_strconcat(uuid, ".pem", NULL);
- gchar *pem = g_build_path(G_DIR_SEPARATOR_S, g_get_user_config_dir(), LIBIPHONE_CONF_DIR, device_file, NULL);
+ gchar *pem = g_build_path(G_DIR_SEPARATOR_S, g_get_user_config_dir(), LIBIMOBILEDEVICE_CONF_DIR, device_file, NULL);
/* remove file */
g_remove(pem);
@@ -255,7 +255,7 @@ static int userpref_get_file_contents(const char *file, gnutls_datum_t * data)
return 0;
/* Read file */
- filepath = g_build_path(G_DIR_SEPARATOR_S, g_get_user_config_dir(), LIBIPHONE_CONF_DIR, file, NULL);
+ filepath = g_build_path(G_DIR_SEPARATOR_S, g_get_user_config_dir(), LIBIMOBILEDEVICE_CONF_DIR, file, NULL);
success = g_file_get_contents(filepath, &content, &size, NULL);
g_free(filepath);
@@ -392,7 +392,7 @@ static userpref_error_t userpref_import_key(const char* key_name, gnutls_x509_pr
* @param crt_name The filename of the certificate to import.
* @param cert the gnutls certificate structure.
*
- * @return IPHONE_E_SUCCESS if the certificate was successfully imported.
+ * @return IDEVICE_E_SUCCESS if the certificate was successfully imported.
*/
static userpref_error_t userpref_import_crt(const char* crt_name, gnutls_x509_crt_t cert)
{
@@ -426,16 +426,16 @@ userpref_error_t userpref_get_keys_and_certs(gnutls_x509_privkey_t root_privkey,
userpref_error_t ret = USERPREF_E_SUCCESS;
if (ret == USERPREF_E_SUCCESS)
- ret = userpref_import_key(LIBIPHONE_ROOT_PRIVKEY, root_privkey);
+ ret = userpref_import_key(LIBIMOBILEDEVICE_ROOT_PRIVKEY, root_privkey);
if (ret == USERPREF_E_SUCCESS)
- ret = userpref_import_key(LIBIPHONE_HOST_PRIVKEY, host_privkey);
+ ret = userpref_import_key(LIBIMOBILEDEVICE_HOST_PRIVKEY, host_privkey);
if (ret == USERPREF_E_SUCCESS)
- ret = userpref_import_crt(LIBIPHONE_ROOT_CERTIF, root_crt);
+ ret = userpref_import_crt(LIBIMOBILEDEVICE_ROOT_CERTIF, root_crt);
if (ret == USERPREF_E_SUCCESS)
- ret = userpref_import_crt(LIBIPHONE_HOST_CERTIF, host_crt);
+ ret = userpref_import_crt(LIBIMOBILEDEVICE_HOST_CERTIF, host_crt);
if (USERPREF_E_SUCCESS != ret) {
@@ -444,16 +444,16 @@ userpref_error_t userpref_get_keys_and_certs(gnutls_x509_privkey_t root_privkey,
ret = userpref_gen_keys_and_cert();
if (ret == USERPREF_E_SUCCESS)
- ret = userpref_import_key(LIBIPHONE_ROOT_PRIVKEY, root_privkey);
+ ret = userpref_import_key(LIBIMOBILEDEVICE_ROOT_PRIVKEY, root_privkey);
if (ret == USERPREF_E_SUCCESS)
- ret = userpref_import_key(LIBIPHONE_HOST_PRIVKEY, host_privkey);
+ ret = userpref_import_key(LIBIMOBILEDEVICE_HOST_PRIVKEY, host_privkey);
if (ret == USERPREF_E_SUCCESS)
- ret = userpref_import_crt(LIBIPHONE_ROOT_CERTIF, root_crt);
+ ret = userpref_import_crt(LIBIMOBILEDEVICE_ROOT_CERTIF, root_crt);
if (ret == USERPREF_E_SUCCESS)
- ret = userpref_import_crt(LIBIPHONE_HOST_CERTIF, host_crt);
+ ret = userpref_import_crt(LIBIMOBILEDEVICE_HOST_CERTIF, host_crt);
}
return ret;
@@ -471,7 +471,7 @@ userpref_error_t userpref_get_certs_as_pem(gnutls_datum_t *pem_root_cert, gnutls
if (!pem_root_cert || !pem_host_cert)
return USERPREF_E_INVALID_ARG;
- if (userpref_get_file_contents(LIBIPHONE_ROOT_CERTIF, pem_root_cert) && userpref_get_file_contents(LIBIPHONE_HOST_CERTIF, pem_host_cert))
+ if (userpref_get_file_contents(LIBIMOBILEDEVICE_ROOT_CERTIF, pem_root_cert) && userpref_get_file_contents(LIBIMOBILEDEVICE_HOST_CERTIF, pem_host_cert))
return USERPREF_E_SUCCESS;
else {
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
userpref_create_config_dir();
/* Now write keys and certificates to disk */
- pem = g_build_path(G_DIR_SEPARATOR_S, g_get_user_config_dir(), LIBIPHONE_CONF_DIR, LIBIPHONE_ROOT_PRIVKEY, NULL);
+ pem = g_build_path(G_DIR_SEPARATOR_S, g_get_user_config_dir(), LIBIMOBILEDEVICE_CONF_DIR, LIBIMOBILEDEVICE_ROOT_PRIVKEY, NULL);
pFile = fopen(pem, "wb");
fwrite(root_key->data, 1, root_key->size, pFile);
fclose(pFile);
g_free(pem);
- pem = g_build_path(G_DIR_SEPARATOR_S, g_get_user_config_dir(), LIBIPHONE_CONF_DIR, LIBIPHONE_HOST_PRIVKEY, NULL);
+ pem = g_build_path(G_DIR_SEPARATOR_S, g_get_user_config_dir(), LIBIMOBILEDEVICE_CONF_DIR, LIBIMOBILEDEVICE_HOST_PRIVKEY, NULL);
pFile = fopen(pem, "wb");
fwrite(host_key->data, 1, host_key->size, pFile);
fclose(pFile);
g_free(pem);
- pem = g_build_path(G_DIR_SEPARATOR_S, g_get_user_config_dir(), LIBIPHONE_CONF_DIR, LIBIPHONE_ROOT_CERTIF, NULL);
+ pem = g_build_path(G_DIR_SEPARATOR_S, g_get_user_config_dir(), LIBIMOBILEDEVICE_CONF_DIR, LIBIMOBILEDEVICE_ROOT_CERTIF, NULL);
pFile = fopen(pem, "wb");
fwrite(root_cert->data, 1, root_cert->size, pFile);
fclose(pFile);
g_free(pem);
- pem = g_build_path(G_DIR_SEPARATOR_S, g_get_user_config_dir(), LIBIPHONE_CONF_DIR, LIBIPHONE_HOST_CERTIF, NULL);
+ pem = g_build_path(G_DIR_SEPARATOR_S, g_get_user_config_dir(), LIBIMOBILEDEVICE_CONF_DIR, LIBIMOBILEDEVICE_HOST_CERTIF, NULL);
pFile = fopen(pem, "wb");
fwrite(host_cert->data, 1, host_cert->size, pFile);
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 @@
INCLUDES = -I$(top_srcdir)/include $(libplist_CFLAGS) $(SWIG_PYTHON_CPPFLAGS) -I$(oldincludedir)
if HAVE_SWIG
-BUILT_SOURCES = iphone_wrap.cxx
-SWIG_SOURCES = iphone.i
+BUILT_SOURCES = imobiledevice_wrap.cxx
+SWIG_SOURCES = imobiledevice.i
CLEANFILES = \
*.pyc \
*.pyo \
- _iphone.so \
- iphone.py \
- iphone_wrap.cxx
+ _imobiledevice.so \
+ imobiledevice.py \
+ imobiledevice_wrap.cxx
EXTRA_DIST = \
__init__.py \
- iphone.i
+ imobiledevice.i
-swigincludedir =$(includedir)/libiphone/swig
+swigincludedir =$(includedir)/libimobiledevice/swig
swiginclude_HEADERS = $(SWIG_SOURCES)
-iphonedir = $(pyexecdir)/iphone
-iphone_PYTHON = __init__.py
-nodist_iphone_PYTHON = iphone.py
-iphone_LTLIBRARIES = _iphone.la
-nodist__iphone_la_SOURCES = iphone_wrap.cxx $(SWIG_SOURCES)
-_iphone_la_CFLAGS = $(PYTHON_CPPFLAGS) -I$(top_srcdir)/src
-_iphone_la_LDFLAGS = -module -avoid-version $(PYTHON_LDFLAGS)
-_iphone_la_LIBADD = $(top_builddir)/src/libiphone.la $(libplistmm_LIBS)
+imobiledevicedir = $(pyexecdir)/imobiledevice
+imobiledevice_PYTHON = __init__.py
+nodist_imobiledevice_PYTHON = imobiledevice.py
+imobiledevice_LTLIBRARIES = _imobiledevice.la
+nodist__imobiledevice_la_SOURCES = imobiledevice_wrap.cxx $(SWIG_SOURCES)
+_imobiledevice_la_CFLAGS = $(PYTHON_CPPFLAGS) -I$(top_srcdir)/src
+_imobiledevice_la_LDFLAGS = -module -avoid-version $(PYTHON_LDFLAGS)
+_imobiledevice_la_LIBADD = $(top_builddir)/src/libimobiledevice.la $(libplistmm_LIBS)
-iphone_wrap.cxx : $(SWIG_SOURCES)
+imobiledevice_wrap.cxx : $(SWIG_SOURCES)
$(SWIG) $(SWIG_PYTHON_OPT) $(INCLUDES) -I$(top_srcdir)/src -o $@ $<
endif # 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 @@
/* swig.i */
- %module iphone
+ %module imobiledevice
%feature("autodoc", "1");
%{
/* Includes the header in the wrapper code */
- #include <libiphone/libiphone.h>
- #include <libiphone/lockdown.h>
- #include <libiphone/mobilesync.h>
+ #include <libimobiledevice/libimobiledevice.h>
+ #include <libimobiledevice/lockdown.h>
+ #include <libimobiledevice/mobilesync.h>
#include <plist/plist.h>
#include <plist/plist++.h>
#include "../src/debug.h"
typedef struct {
- iphone_device_t dev;
- } iPhone;
+ idevice_t dev;
+ } idevice;
typedef struct {
- iPhone* dev;
+ idevice* dev;
lockdownd_client_t client;
} Lockdownd;
typedef struct {
- iPhone* dev;
+ idevice* dev;
mobilesync_client_t client;
} MobileSync;
//now declare funtions to handle creation and deletion of objects
-void my_delete_iPhone(iPhone* dev);
-Lockdownd* my_new_Lockdownd(iPhone* phone);
+void my_delete_idevice(idevice* dev);
+Lockdownd* my_new_Lockdownd(idevice* device);
void my_delete_Lockdownd(Lockdownd* lckd);
MobileSync* my_new_MobileSync(Lockdownd* lckd);
PList::Node* new_node_from_plist(plist_t node);
@@ -37,16 +37,16 @@ PList::Node* new_node_from_plist(plist_t node);
%include "plist/swig/plist.i"
typedef struct {
- iphone_device_t dev;
-} iPhone;
+ idevice_t dev;
+} idevice;
typedef struct {
- iPhone* dev;
+ idevice* dev;
lockdownd_client_t client;
} Lockdownd;
typedef struct {
- iPhone* dev;
+ idevice* dev;
mobilesync_client_t client;
} MobileSync;
@@ -54,19 +54,19 @@ typedef struct {
//now define funtions to handle creation and deletion of objects
-void my_delete_iPhone(iPhone* dev) {
+void my_delete_idevice(idevice* dev) {
if (dev) {
- iphone_device_free(dev->dev);
+ idevice_free(dev->dev);
free(dev);
}
}
-Lockdownd* my_new_Lockdownd(iPhone* phone) {
- if (!phone) return NULL;
+Lockdownd* my_new_Lockdownd(idevice* device) {
+ if (!device) return NULL;
Lockdownd* client = (Lockdownd*) malloc(sizeof(Lockdownd));
- client->dev = phone;
+ client->dev = device;
client->client = NULL;
- if (LOCKDOWN_E_SUCCESS == lockdownd_client_new_with_handshake(phone->dev , &(client->client), NULL)) {
+ if (LOCKDOWN_E_SUCCESS == lockdownd_client_new_with_handshake(device->dev , &(client->client), NULL)) {
return client;
}
else {
@@ -133,29 +133,29 @@ PList::Node* new_node_from_plist(plist_t node)
%}
-%extend iPhone { // Attach these functions to struct iPhone
- iPhone() {
- iPhone* phone = (iPhone*) malloc(sizeof(iPhone));
- phone->dev = NULL;
- return phone;
+%extend idevice { // Attach these functions to struct idevice
+ idevice() {
+ idevice* device = (idevice*) malloc(sizeof(idevice));
+ device->dev = NULL;
+ return device;
}
- ~iPhone() {
- my_delete_iPhone($self);
+ ~idevice() {
+ my_delete_idevice($self);
}
void set_debug_level(int level) {
- iphone_set_debug_level(level);
+ idevice_set_debug_level(level);
}
int init_device_by_uuid(char* uuid) {
- if (IPHONE_E_SUCCESS == iphone_device_new(&($self->dev), uuid))
+ if (IDEVICE_E_SUCCESS == idevice_new(&($self->dev), uuid))
return 1;
return 0;
}
int init_device() {
- if (IPHONE_E_SUCCESS == iphone_device_new(&($self->dev), NULL))
+ if (IDEVICE_E_SUCCESS == idevice_new(&($self->dev), NULL))
return 1;
return 0;
}
@@ -163,7 +163,7 @@ PList::Node* new_node_from_plist(plist_t node)
%newobject get_uuid;
char* get_uuid(){
char* uuid = NULL;
- iphone_device_get_uuid($self->dev, &uuid);
+ idevice_get_uuid($self->dev, &uuid);
return uuid;
}
@@ -174,8 +174,8 @@ PList::Node* new_node_from_plist(plist_t node)
%extend Lockdownd { // Attach these functions to struct Lockdownd
- Lockdownd(iPhone* phone) {
- return my_new_Lockdownd(phone);
+ Lockdownd(idevice* device) {
+ return my_new_Lockdownd(device);
}
~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
AM_CFLAGS = $(GLOBAL_CFLAGS) $(libglib2_CFLAGS) $(libgnutls_CFLAGS) $(libtasn1_CFLAGS) $(libgthread2_CFLAGS) $(LFS_CFLAGS)
AM_LDFLAGS = $(libglib2_LIBS) $(libgnutls_LIBS) $(libtasn1_LIBS) $(libgthread2_LIBS)
-bin_PROGRAMS = iphone_id iphoneinfo iphonesyslog iphonebackup
+bin_PROGRAMS = idevice_id ideviceinfo idevicesyslog idevicebackup
-iphoneinfo_SOURCES = iphoneinfo.c
-iphoneinfo_CFLAGS = $(AM_CFLAGS)
-iphoneinfo_LDFLAGS = $(AM_LDFLAGS)
-iphoneinfo_LDADD = ../src/libiphone.la
+ideviceinfo_SOURCES = ideviceinfo.c
+ideviceinfo_CFLAGS = $(AM_CFLAGS)
+ideviceinfo_LDFLAGS = $(AM_LDFLAGS)
+ideviceinfo_LDADD = ../src/libimobiledevice.la
-iphonesyslog_SOURCES = iphonesyslog.c
-iphonesyslog_CFLAGS = $(AM_CFLAGS)
-iphonesyslog_LDFLAGS = $(AM_LDFLAGS)
-iphonesyslog_LDADD = ../src/libiphone.la
+idevicesyslog_SOURCES = idevicesyslog.c
+idevicesyslog_CFLAGS = $(AM_CFLAGS)
+idevicesyslog_LDFLAGS = $(AM_LDFLAGS)
+idevicesyslog_LDADD = ../src/libimobiledevice.la
-iphone_id_SOURCES = iphone_id.c
-iphone_id_CFLAGS = $(AM_CFLAGS)
-iphone_id_LDFLAGS = $(AM_LDFLAGS)
-iphone_id_LDADD = ../src/libiphone.la
+idevice_id_SOURCES = idevice_id.c
+idevice_id_CFLAGS = $(AM_CFLAGS)
+idevice_id_LDFLAGS = $(AM_LDFLAGS)
+idevice_id_LDADD = ../src/libimobiledevice.la
-iphonebackup_SOURCES = iphonebackup.c
-iphonebackup_CFLAGS = $(AM_CFLAGS)
-iphonebackup_LDFLAGS = $(AM_LDFLAGS)
-iphonebackup_LDADD = ../src/libiphone.la
+idevicebackup_SOURCES = idevicebackup.c
+idevicebackup_CFLAGS = $(AM_CFLAGS)
+idevicebackup_LDFLAGS = $(AM_LDFLAGS)
+idevicebackup_LDADD = ../src/libimobiledevice.la
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 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
-#include <libiphone/libiphone.h>
-#include <libiphone/lockdown.h>
+#include <libimobiledevice/libimobiledevice.h>
+#include <libimobiledevice/lockdown.h>
#define MODE_NONE 0
#define MODE_SHOW_ID 1
@@ -25,7 +25,7 @@ static void print_usage(int argc, char **argv)
int main(int argc, char **argv)
{
- iphone_device_t phone = NULL;
+ idevice_t phone = NULL;
lockdownd_client_t client = NULL;
char **dev_list = NULL;
char *devname = NULL;
@@ -38,7 +38,7 @@ int main(int argc, char **argv)
/* parse cmdline args */
for (i = 1; i < argc; i++) {
if (!strcmp(argv[i], "-d") || !strcmp(argv[i], "--debug")) {
- iphone_set_debug_level(1);
+ idevice_set_debug_level(1);
continue;
}
else if (!strcmp(argv[i], "-l") || !strcmp(argv[i], "--list")) {
@@ -63,14 +63,14 @@ int main(int argc, char **argv)
switch (mode) {
case MODE_SHOW_ID:
- iphone_device_new(&phone, uuid);
+ idevice_new(&phone, uuid);
if (!phone) {
fprintf(stderr, "ERROR: No device with UUID=%s attached.\n", uuid);
return -2;
}
- if (LOCKDOWN_E_SUCCESS != lockdownd_client_new(phone, &client, "iphone_id")) {
- iphone_device_free(phone);
+ if (LOCKDOWN_E_SUCCESS != lockdownd_client_new(phone, &client, "idevice_id")) {
+ idevice_free(phone);
fprintf(stderr, "ERROR: Connecting to device failed!\n");
return -2;
}
@@ -81,7 +81,7 @@ int main(int argc, char **argv)
}
lockdownd_client_free(client);
- iphone_device_free(phone);
+ idevice_free(phone);
if (ret == 0) {
printf("%s\n", devname);
@@ -94,14 +94,14 @@ int main(int argc, char **argv)
return ret;
case MODE_LIST_DEVICES:
default:
- if (iphone_get_device_list(&dev_list, &i) < 0) {
+ if (idevice_get_device_list(&dev_list, &i) < 0) {
fprintf(stderr, "ERROR: Unable to retrieve device list!\n");
return -1;
}
for (i = 0; dev_list[i] != NULL; i++) {
printf("%s\n", dev_list[i]);
}
- iphone_device_list_free(dev_list);
+ idevice_device_list_free(dev_list);
return 0;
}
}
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 @@
/*
- * iphonebackup.c
+ * idevicebackup.c
* Command line interface to use the device's backup and restore service
*
* Copyright (c) 2009-2010 Martin Szulecki All Rights Reserved.
@@ -27,18 +27,18 @@
#include <signal.h>
#include <glib.h>
-#include <libiphone/libiphone.h>
-#include <libiphone/lockdown.h>
-#include <libiphone/mobilebackup.h>
-#include <libiphone/notification_proxy.h>
-#include <libiphone/afc.h>
+#include <libimobiledevice/libimobiledevice.h>
+#include <libimobiledevice/lockdown.h>
+#include <libimobiledevice/mobilebackup.h>
+#include <libimobiledevice/notification_proxy.h>
+#include <libimobiledevice/afc.h>
#define MOBILEBACKUP_SERVICE_NAME "com.apple.mobilebackup"
#define NP_SERVICE_NAME "com.apple.mobile.notification_proxy"
static mobilebackup_client_t mobilebackup = NULL;
static lockdownd_client_t client = NULL;
-static iphone_device_t phone = NULL;
+static idevice_t phone = NULL;
static int quit_flag = 0;
@@ -111,7 +111,7 @@ static plist_t mobilebackup_factory_info_plist_new()
plist_dict_insert_item(ret, "Serial Number", plist_copy(value_node));
value_node = plist_dict_get_item(root_node, "UniqueDeviceID");
- iphone_device_get_uuid(phone, &uuid);
+ idevice_get_uuid(phone, &uuid);
plist_dict_insert_item(ret, "Target Identifier", plist_new_string(uuid));
/* uppercase */
@@ -383,7 +383,7 @@ static void do_post_notification(const char *notification)
np_client_t np;
if (!client) {
- if (lockdownd_client_new_with_handshake(phone, &client, "iphonebackup") != LOCKDOWN_E_SUCCESS) {
+ if (lockdownd_client_new_with_handshake(phone, &client, "idevicebackup") != LOCKDOWN_E_SUCCESS) {
return;
}
}
@@ -427,7 +427,7 @@ static void print_usage(int argc, char **argv)
int main(int argc, char *argv[])
{
- iphone_error_t ret = IPHONE_E_UNKNOWN_ERROR;
+ idevice_error_t ret = IDEVICE_E_UNKNOWN_ERROR;
int i;
char uuid[41];
uint16_t port = 0;
@@ -455,7 +455,7 @@ int main(int argc, char *argv[])
/* parse cmdline args */
for (i = 1; i < argc; i++) {
if (!strcmp(argv[i], "-d") || !strcmp(argv[i], "--debug")) {
- iphone_set_debug_level(1);
+ idevice_set_debug_level(1);
continue;
}
else if (!strcmp(argv[i], "-u") || !strcmp(argv[i], "--uuid")) {
@@ -518,23 +518,23 @@ int main(int argc, char *argv[])
printf("Backup directory is \"%s\"\n", backup_directory);
if (uuid[0] != 0) {
- ret = iphone_device_new(&phone, uuid);
- if (ret != IPHONE_E_SUCCESS) {
+ ret = idevice_new(&phone, uuid);
+ if (ret != IDEVICE_E_SUCCESS) {
printf("No device found with uuid %s, is it plugged in?\n", uuid);
return -1;
}
}
else
{
- ret = iphone_device_new(&phone, NULL);
- if (ret != IPHONE_E_SUCCESS) {
+ ret = idevice_new(&phone, NULL);
+ if (ret != IDEVICE_E_SUCCESS) {
printf("No device found, is it plugged in?\n");
return -1;
}
}
- if (LOCKDOWN_E_SUCCESS != lockdownd_client_new_with_handshake(phone, &client, "iphonebackup")) {
- iphone_device_free(phone);
+ if (LOCKDOWN_E_SUCCESS != lockdownd_client_new_with_handshake(phone, &client, "idevicebackup")) {
+ idevice_free(phone);
return -1;
}
@@ -946,7 +946,7 @@ int main(int argc, char *argv[])
if (mobilebackup)
mobilebackup_client_free(mobilebackup);
- iphone_device_free(phone);
+ idevice_free(phone);
return 0;
}
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 @@
/*
- * iphoneinfo.c
+ * ideviceinfo.c
* Simple utility to show information about an attached device
*
* Copyright (c) 2009 Martin Szulecki All Rights Reserved.
@@ -25,8 +25,8 @@
#include <stdlib.h>
#include <glib.h>
-#include <libiphone/libiphone.h>
-#include <libiphone/lockdown.h>
+#include <libimobiledevice/libimobiledevice.h>
+#include <libimobiledevice/lockdown.h>
#define FORMAT_KEY_VALUE 1
#define FORMAT_XML 2
@@ -197,7 +197,7 @@ static void print_usage(int argc, char **argv)
name = strrchr(argv[0], '/');
printf("Usage: %s [OPTIONS]\n", (name ? name + 1: argv[0]));
- printf("Show information about the first connected iPhone/iPod Touch.\n\n");
+ printf("Show information about a connected iPhone/iPod Touch.\n\n");
printf(" -d, --debug\t\tenable communication debugging\n");
printf(" -u, --uuid UUID\ttarget specific device by its 40-digit device UUID\n");
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)
int main(int argc, char *argv[])
{
lockdownd_client_t client = NULL;
- iphone_device_t phone = NULL;
- iphone_error_t ret = IPHONE_E_UNKNOWN_ERROR;
+ idevice_t phone = NULL;
+ idevice_error_t ret = IDEVICE_E_UNKNOWN_ERROR;
int i;
int format = FORMAT_KEY_VALUE;
char uuid[41];
@@ -231,7 +231,7 @@ int main(int argc, char *argv[])
/* parse cmdline args */
for (i = 1; i < argc; i++) {
if (!strcmp(argv[i], "-d") || !strcmp(argv[i], "--debug")) {
- iphone_set_debug_level(1);
+ idevice_set_debug_level(1);
continue;
}
else if (!strcmp(argv[i], "-u") || !strcmp(argv[i], "--uuid")) {
@@ -279,23 +279,23 @@ int main(int argc, char *argv[])
}
if (uuid[0] != 0) {
- ret = iphone_device_new(&phone, uuid);
- if (ret != IPHONE_E_SUCCESS) {
+ ret = idevice_new(&phone, uuid);
+ if (ret != IDEVICE_E_SUCCESS) {
printf("No device found with uuid %s, is it plugged in?\n", uuid);
return -1;
}
}
else
{
- ret = iphone_device_new(&phone, NULL);
- if (ret != IPHONE_E_SUCCESS) {
+ ret = idevice_new(&phone, NULL);
+ if (ret != IDEVICE_E_SUCCESS) {
printf("No device found, is it plugged in?\n");
return -1;
}
}
- if (LOCKDOWN_E_SUCCESS != lockdownd_client_new_with_handshake(phone, &client, "iphoneinfo")) {
- iphone_device_free(phone);
+ if (LOCKDOWN_E_SUCCESS != lockdownd_client_new_with_handshake(phone, &client, "ideviceinfo")) {
+ idevice_free(phone);
return -1;
}
@@ -329,7 +329,7 @@ int main(int argc, char *argv[])
if (domain != NULL)
free(domain);
lockdownd_client_free(client);
- iphone_device_free(phone);
+ idevice_free(phone);
return 0;
}
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 @@
/*
- * syslog_relay.c
+ * idevicesyslog.c
* Relay the syslog of a device to stdout
*
* Copyright (c) 2009 Martin Szulecki All Rights Reserved.
@@ -26,8 +26,8 @@
#include <signal.h>
#include <stdlib.h>
-#include <libiphone/libiphone.h>
-#include <libiphone/lockdown.h>
+#include <libimobiledevice/libimobiledevice.h>
+#include <libimobiledevice/lockdown.h>
static int quit_flag = 0;
@@ -45,8 +45,8 @@ static void clean_exit(int sig)
int main(int argc, char *argv[])
{
lockdownd_client_t client = NULL;
- iphone_device_t phone = NULL;
- iphone_error_t ret = IPHONE_E_UNKNOWN_ERROR;
+ idevice_t phone = NULL;
+ idevice_error_t ret = IDEVICE_E_UNKNOWN_ERROR;
int i;
char uuid[41];
uint16_t port = 0;
@@ -60,7 +60,7 @@ int main(int argc, char *argv[])
/* parse cmdline args */
for (i = 1; i < argc; i++) {
if (!strcmp(argv[i], "-d") || !strcmp(argv[i], "--debug")) {
- iphone_set_debug_level(1);
+ idevice_set_debug_level(1);
continue;
}
else if (!strcmp(argv[i], "-u") || !strcmp(argv[i], "--uuid")) {
@@ -83,23 +83,23 @@ int main(int argc, char *argv[])
}
if (uuid[0] != 0) {
- ret = iphone_device_new(&phone, uuid);
- if (ret != IPHONE_E_SUCCESS) {
+ ret = idevice_new(&phone, uuid);
+ if (ret != IDEVICE_E_SUCCESS) {
printf("No device found with uuid %s, is it plugged in?\n", uuid);
return -1;
}
}
else
{
- ret = iphone_device_new(&phone, NULL);
- if (ret != IPHONE_E_SUCCESS) {
+ ret = idevice_new(&phone, NULL);
+ if (ret != IDEVICE_E_SUCCESS) {
printf("No device found, is it plugged in?\n");
return -1;
}
}
- if (LOCKDOWN_E_SUCCESS != lockdownd_client_new_with_handshake(phone, &client, "iphonesyslog")) {
- iphone_device_free(phone);
+ if (LOCKDOWN_E_SUCCESS != lockdownd_client_new_with_handshake(phone, &client, "idevicesyslog")) {
+ idevice_free(phone);
return -1;
}
@@ -109,15 +109,15 @@ int main(int argc, char *argv[])
lockdownd_client_free(client);
/* connect to socket relay messages */
- iphone_connection_t conn = NULL;
- if ((iphone_device_connect(phone, port, &conn) != IPHONE_E_SUCCESS) || !conn) {
+ idevice_connection_t conn = NULL;
+ if ((idevice_connect(phone, port, &conn) != IDEVICE_E_SUCCESS) || !conn) {
printf("ERROR: Could not open usbmux connection.\n");
} else {
while (!quit_flag) {
char *receive = NULL;
uint32_t datalen = 0, bytes = 0, recv_bytes = 0;
- ret = iphone_connection_receive(conn, (char *) &datalen, sizeof(datalen), &bytes);
+ ret = idevice_connection_receive(conn, (char *) &datalen, sizeof(datalen), &bytes);
datalen = ntohl(datalen);
if (datalen == 0)
@@ -127,7 +127,7 @@ int main(int argc, char *argv[])
receive = (char *) malloc(sizeof(char) * datalen);
while (!quit_flag && (recv_bytes <= datalen)) {
- ret = iphone_connection_receive(conn, receive, datalen, &bytes);
+ ret = idevice_connection_receive(conn, receive, datalen, &bytes);
if (bytes == 0)
break;
@@ -140,12 +140,12 @@ int main(int argc, char *argv[])
free(receive);
}
}
- iphone_device_disconnect(conn);
+ idevice_disconnect(conn);
} else {
printf("ERROR: Could not start service com.apple.syslog_relay.\n");
}
- iphone_device_free(phone);
+ idevice_free(phone);
return 0;
}