summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2010-01-28 22:18:41 +0100
committerGravatar Martin Szulecki2010-01-29 02:16:00 +0100
commit96101a1231a4ddfeb40fd738a24e108a3a904048 (patch)
tree65a8f54354d9acbbba93dac2c8602d07e469482c /src
parent45b88ae3956de089fdc35605910f1359a1d3961c (diff)
downloadlibimobiledevice-96101a1231a4ddfeb40fd738a24e108a3a904048.tar.gz
libimobiledevice-96101a1231a4ddfeb40fd738a24e108a3a904048.tar.bz2
Global renames due to project rename to libimobiledevice
Diffstat (limited to 'src')
-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
25 files changed, 227 insertions, 227 deletions
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);