diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/Makefile.am | 4 | ||||
| -rw-r--r-- | src/afc.c | 34 | ||||
| -rw-r--r-- | src/afc.h | 4 | ||||
| -rw-r--r-- | src/debug.c | 4 | ||||
| -rw-r--r-- | src/device_link_service.c | 2 | ||||
| -rw-r--r-- | src/device_link_service.h | 2 | ||||
| -rw-r--r-- | src/file_relay.c | 6 | ||||
| -rw-r--r-- | src/file_relay.h | 2 | ||||
| -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.c | 2 | ||||
| -rw-r--r-- | src/installation_proxy.h | 2 | ||||
| -rw-r--r-- | src/lockdown.c | 28 | ||||
| -rw-r--r-- | src/lockdown.h | 2 | ||||
| -rw-r--r-- | src/mobilebackup.c | 6 | ||||
| -rw-r--r-- | src/mobilebackup.h | 2 | ||||
| -rw-r--r-- | src/mobilesync.c | 6 | ||||
| -rw-r--r-- | src/mobilesync.h | 2 | ||||
| -rw-r--r-- | src/notification_proxy.c | 6 | ||||
| -rw-r--r-- | src/notification_proxy.h | 2 | ||||
| -rw-r--r-- | src/property_list_service.c | 34 | ||||
| -rw-r--r-- | src/property_list_service.h | 6 | ||||
| -rw-r--r-- | src/sbservices.c | 2 | ||||
| -rw-r--r-- | src/sbservices.h | 2 | ||||
| -rw-r--r-- | src/userpref.c | 66 |
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 | |||
| 3 | AM_CFLAGS = $(GLOBAL_CFLAGS) $(libusbmuxd_CFLAGS) $(libglib2_CFLAGS) $(libgnutls_CFLAGS) $(libtasn1_CFLAGS) $(libgthread2_CFLAGS) $(libplist_CFLAGS) $(LFS_CFLAGS) | 3 | AM_CFLAGS = $(GLOBAL_CFLAGS) $(libusbmuxd_CFLAGS) $(libglib2_CFLAGS) $(libgnutls_CFLAGS) $(libtasn1_CFLAGS) $(libgthread2_CFLAGS) $(libplist_CFLAGS) $(LFS_CFLAGS) |
| 4 | AM_LDFLAGS = $(libglib2_LIBS) $(libgnutls_LIBS) $(libtasn1_LIBS) $(libgthread2_LIBS) $(libplist_LIBS) $(libusbmuxd_LIBS) $(libgcrypt_LIBS) | 4 | AM_LDFLAGS = $(libglib2_LIBS) $(libgnutls_LIBS) $(libtasn1_LIBS) $(libgthread2_LIBS) $(libplist_LIBS) $(libusbmuxd_LIBS) $(libgcrypt_LIBS) |
| 5 | 5 | ||
| 6 | lib_LTLIBRARIES = libiphone.la | 6 | lib_LTLIBRARIES = libimobiledevice.la |
| 7 | libiphone_la_SOURCES = iphone.c iphone.h \ | 7 | libimobiledevice_la_SOURCES = idevice.c idevice.h \ |
| 8 | debug.c debug.h\ | 8 | debug.c debug.h\ |
| 9 | userpref.c userpref.h\ | 9 | userpref.c userpref.h\ |
| 10 | property_list_service.c property_list_service.h\ | 10 | property_list_service.c property_list_service.h\ |
| @@ -24,7 +24,7 @@ | |||
| 24 | #include <unistd.h> | 24 | #include <unistd.h> |
| 25 | 25 | ||
| 26 | #include "afc.h" | 26 | #include "afc.h" |
| 27 | #include "iphone.h" | 27 | #include "idevice.h" |
| 28 | #include "debug.h" | 28 | #include "debug.h" |
| 29 | 29 | ||
| 30 | // This is the maximum size an AFC data packet can be | 30 | // This is the maximum size an AFC data packet can be |
| @@ -61,7 +61,7 @@ static void afc_unlock(afc_client_t client) | |||
| 61 | * is invalid, AFC_E_MUX_ERROR when the connection failed, or AFC_E_NO_MEM | 61 | * is invalid, AFC_E_MUX_ERROR when the connection failed, or AFC_E_NO_MEM |
| 62 | * when there's a memory allocation problem. | 62 | * when there's a memory allocation problem. |
| 63 | */ | 63 | */ |
| 64 | afc_error_t afc_client_new(iphone_device_t device, uint16_t port, afc_client_t * client) | 64 | afc_error_t afc_client_new(idevice_t device, uint16_t port, afc_client_t * client) |
| 65 | { | 65 | { |
| 66 | /* makes sure thread environment is available */ | 66 | /* makes sure thread environment is available */ |
| 67 | if (!g_thread_supported()) | 67 | if (!g_thread_supported()) |
| @@ -71,8 +71,8 @@ afc_error_t afc_client_new(iphone_device_t device, uint16_t port, afc_client_t * | |||
| 71 | return AFC_E_INVALID_ARGUMENT; | 71 | return AFC_E_INVALID_ARGUMENT; |
| 72 | 72 | ||
| 73 | /* attempt connection */ | 73 | /* attempt connection */ |
| 74 | iphone_connection_t connection = NULL; | 74 | idevice_connection_t connection = NULL; |
| 75 | if (iphone_device_connect(device, port, &connection) != IPHONE_E_SUCCESS) { | 75 | if (idevice_connect(device, port, &connection) != IDEVICE_E_SUCCESS) { |
| 76 | return AFC_E_MUX_ERROR; | 76 | return AFC_E_MUX_ERROR; |
| 77 | } | 77 | } |
| 78 | 78 | ||
| @@ -82,7 +82,7 @@ afc_error_t afc_client_new(iphone_device_t device, uint16_t port, afc_client_t * | |||
| 82 | /* allocate a packet */ | 82 | /* allocate a packet */ |
| 83 | client_loc->afc_packet = (AFCPacket *) malloc(sizeof(AFCPacket)); | 83 | client_loc->afc_packet = (AFCPacket *) malloc(sizeof(AFCPacket)); |
| 84 | if (!client_loc->afc_packet) { | 84 | if (!client_loc->afc_packet) { |
| 85 | iphone_device_disconnect(client_loc->connection); | 85 | idevice_disconnect(client_loc->connection); |
| 86 | free(client_loc); | 86 | free(client_loc); |
| 87 | return AFC_E_NO_MEM; | 87 | return AFC_E_NO_MEM; |
| 88 | } | 88 | } |
| @@ -108,7 +108,7 @@ afc_error_t afc_client_free(afc_client_t client) | |||
| 108 | if (!client || !client->connection || !client->afc_packet) | 108 | if (!client || !client->connection || !client->afc_packet) |
| 109 | return AFC_E_INVALID_ARGUMENT; | 109 | return AFC_E_INVALID_ARGUMENT; |
| 110 | 110 | ||
| 111 | iphone_device_disconnect(client->connection); | 111 | idevice_disconnect(client->connection); |
| 112 | free(client->afc_packet); | 112 | free(client->afc_packet); |
| 113 | if (client->mutex) { | 113 | if (client->mutex) { |
| 114 | g_mutex_free(client->mutex); | 114 | g_mutex_free(client->mutex); |
| @@ -169,7 +169,7 @@ static afc_error_t afc_dispatch_packet(afc_client_t client, const char *data, ui | |||
| 169 | /* send AFC packet header */ | 169 | /* send AFC packet header */ |
| 170 | AFCPacket_to_LE(client->afc_packet); | 170 | AFCPacket_to_LE(client->afc_packet); |
| 171 | sent = 0; | 171 | sent = 0; |
| 172 | iphone_connection_send(client->connection, (void*)client->afc_packet, sizeof(AFCPacket), &sent); | 172 | idevice_connection_send(client->connection, (void*)client->afc_packet, sizeof(AFCPacket), &sent); |
| 173 | if (sent == 0) { | 173 | if (sent == 0) { |
| 174 | /* FIXME: should this be handled as success?! */ | 174 | /* FIXME: should this be handled as success?! */ |
| 175 | return AFC_E_SUCCESS; | 175 | return AFC_E_SUCCESS; |
| @@ -178,7 +178,7 @@ static afc_error_t afc_dispatch_packet(afc_client_t client, const char *data, ui | |||
| 178 | 178 | ||
| 179 | /* send AFC packet data */ | 179 | /* send AFC packet data */ |
| 180 | sent = 0; | 180 | sent = 0; |
| 181 | iphone_connection_send(client->connection, data, offset, &sent); | 181 | idevice_connection_send(client->connection, data, offset, &sent); |
| 182 | if (sent == 0) { | 182 | if (sent == 0) { |
| 183 | return AFC_E_SUCCESS; | 183 | return AFC_E_SUCCESS; |
| 184 | } | 184 | } |
| @@ -190,7 +190,7 @@ static afc_error_t afc_dispatch_packet(afc_client_t client, const char *data, ui | |||
| 190 | debug_buffer(data + offset, length - offset); | 190 | debug_buffer(data + offset, length - offset); |
| 191 | 191 | ||
| 192 | sent = 0; | 192 | sent = 0; |
| 193 | iphone_connection_send(client->connection, data + offset, length - offset, &sent); | 193 | idevice_connection_send(client->connection, data + offset, length - offset, &sent); |
| 194 | 194 | ||
| 195 | *bytes_sent = sent; | 195 | *bytes_sent = sent; |
| 196 | return AFC_E_SUCCESS; | 196 | return AFC_E_SUCCESS; |
| @@ -203,7 +203,7 @@ static afc_error_t afc_dispatch_packet(afc_client_t client, const char *data, ui | |||
| 203 | /* send AFC packet header */ | 203 | /* send AFC packet header */ |
| 204 | AFCPacket_to_LE(client->afc_packet); | 204 | AFCPacket_to_LE(client->afc_packet); |
| 205 | sent = 0; | 205 | sent = 0; |
| 206 | iphone_connection_send(client->connection, (void*)client->afc_packet, sizeof(AFCPacket), &sent); | 206 | idevice_connection_send(client->connection, (void*)client->afc_packet, sizeof(AFCPacket), &sent); |
| 207 | if (sent == 0) { | 207 | if (sent == 0) { |
| 208 | return AFC_E_SUCCESS; | 208 | return AFC_E_SUCCESS; |
| 209 | } | 209 | } |
| @@ -213,7 +213,7 @@ static afc_error_t afc_dispatch_packet(afc_client_t client, const char *data, ui | |||
| 213 | debug_info("packet data follows"); | 213 | debug_info("packet data follows"); |
| 214 | 214 | ||
| 215 | debug_buffer(data, length); | 215 | debug_buffer(data, length); |
| 216 | iphone_connection_send(client->connection, data, length, &sent); | 216 | idevice_connection_send(client->connection, data, length, &sent); |
| 217 | *bytes_sent += sent; | 217 | *bytes_sent += sent; |
| 218 | } | 218 | } |
| 219 | return AFC_E_SUCCESS; | 219 | return AFC_E_SUCCESS; |
| @@ -241,7 +241,7 @@ static afc_error_t afc_receive_data(afc_client_t client, char **dump_here, uint3 | |||
| 241 | *bytes_recv = 0; | 241 | *bytes_recv = 0; |
| 242 | 242 | ||
| 243 | /* first, read the AFC header */ | 243 | /* first, read the AFC header */ |
| 244 | iphone_connection_receive(client->connection, (char*)&header, sizeof(AFCPacket), bytes_recv); | 244 | idevice_connection_receive(client->connection, (char*)&header, sizeof(AFCPacket), bytes_recv); |
| 245 | AFCPacket_from_LE(&header); | 245 | AFCPacket_from_LE(&header); |
| 246 | if (*bytes_recv == 0) { | 246 | if (*bytes_recv == 0) { |
| 247 | debug_info("Just didn't get enough."); | 247 | debug_info("Just didn't get enough."); |
| @@ -295,7 +295,7 @@ static afc_error_t afc_receive_data(afc_client_t client, char **dump_here, uint3 | |||
| 295 | 295 | ||
| 296 | *dump_here = (char*)malloc(entire_len); | 296 | *dump_here = (char*)malloc(entire_len); |
| 297 | if (this_len > 0) { | 297 | if (this_len > 0) { |
| 298 | iphone_connection_receive(client->connection, *dump_here, this_len, bytes_recv); | 298 | idevice_connection_receive(client->connection, *dump_here, this_len, bytes_recv); |
| 299 | if (*bytes_recv <= 0) { | 299 | if (*bytes_recv <= 0) { |
| 300 | free(*dump_here); | 300 | free(*dump_here); |
| 301 | *dump_here = NULL; | 301 | *dump_here = NULL; |
| @@ -313,7 +313,7 @@ static afc_error_t afc_receive_data(afc_client_t client, char **dump_here, uint3 | |||
| 313 | 313 | ||
| 314 | if (entire_len > this_len) { | 314 | if (entire_len > this_len) { |
| 315 | while (current_count < entire_len) { | 315 | while (current_count < entire_len) { |
| 316 | iphone_connection_receive(client->connection, (*dump_here)+current_count, entire_len - current_count, bytes_recv); | 316 | idevice_connection_receive(client->connection, (*dump_here)+current_count, entire_len - current_count, bytes_recv); |
| 317 | if (*bytes_recv <= 0) { | 317 | if (*bytes_recv <= 0) { |
| 318 | debug_info("Error receiving data (recv returned %d)", *bytes_recv); | 318 | debug_info("Error receiving data (recv returned %d)", *bytes_recv); |
| 319 | break; | 319 | break; |
| @@ -701,7 +701,7 @@ afc_error_t afc_get_file_info(afc_client_t client, const char *path, char ***inf | |||
| 701 | * | 701 | * |
| 702 | * @return AFC_E_SUCCESS on success or an AFC_E_* error on failure. | 702 | * @return AFC_E_SUCCESS on success or an AFC_E_* error on failure. |
| 703 | */ | 703 | */ |
| 704 | iphone_error_t | 704 | idevice_error_t |
| 705 | afc_file_open(afc_client_t client, const char *filename, | 705 | afc_file_open(afc_client_t client, const char *filename, |
| 706 | afc_file_mode_t file_mode, uint64_t *handle) | 706 | afc_file_mode_t file_mode, uint64_t *handle) |
| 707 | { | 707 | { |
| @@ -760,7 +760,7 @@ afc_file_open(afc_client_t client, const char *filename, | |||
| 760 | * | 760 | * |
| 761 | * @return AFC_E_SUCCESS on success or an AFC_E_* error value on error. | 761 | * @return AFC_E_SUCCESS on success or an AFC_E_* error value on error. |
| 762 | */ | 762 | */ |
| 763 | iphone_error_t | 763 | idevice_error_t |
| 764 | afc_file_read(afc_client_t client, uint64_t handle, char *data, uint32_t length, uint32_t *bytes_read) | 764 | afc_file_read(afc_client_t client, uint64_t handle, char *data, uint32_t length, uint32_t *bytes_read) |
| 765 | { | 765 | { |
| 766 | char *input = NULL; | 766 | char *input = NULL; |
| @@ -833,7 +833,7 @@ afc_file_read(afc_client_t client, uint64_t handle, char *data, uint32_t length, | |||
| 833 | * | 833 | * |
| 834 | * @return AFC_E_SUCCESS on success, or an AFC_E_* error value on error. | 834 | * @return AFC_E_SUCCESS on success, or an AFC_E_* error value on error. |
| 835 | */ | 835 | */ |
| 836 | iphone_error_t | 836 | idevice_error_t |
| 837 | afc_file_write(afc_client_t client, uint64_t handle, const char *data, uint32_t length, uint32_t *bytes_written) | 837 | afc_file_write(afc_client_t client, uint64_t handle, const char *data, uint32_t length, uint32_t *bytes_written) |
| 838 | { | 838 | { |
| 839 | char *acknowledgement = NULL; | 839 | char *acknowledgement = NULL; |
| @@ -26,7 +26,7 @@ | |||
| 26 | #include <glib.h> | 26 | #include <glib.h> |
| 27 | #include <stdint.h> | 27 | #include <stdint.h> |
| 28 | 28 | ||
| 29 | #include "libiphone/afc.h" | 29 | #include "libimobiledevice/afc.h" |
| 30 | 30 | ||
| 31 | #define AFC_MAGIC "CFA6LPAA" | 31 | #define AFC_MAGIC "CFA6LPAA" |
| 32 | #define AFC_MAGIC_LEN (8) | 32 | #define AFC_MAGIC_LEN (8) |
| @@ -58,7 +58,7 @@ typedef struct __AFCToken { | |||
| 58 | } AFCToken; | 58 | } AFCToken; |
| 59 | 59 | ||
| 60 | struct afc_client_int { | 60 | struct afc_client_int { |
| 61 | iphone_connection_t connection; | 61 | idevice_connection_t connection; |
| 62 | AFCPacket *afc_packet; | 62 | AFCPacket *afc_packet; |
| 63 | int file_handle; | 63 | int file_handle; |
| 64 | int lock; | 64 | int lock; |
diff --git a/src/debug.c b/src/debug.c index b194b0d..a40c249 100644 --- a/src/debug.c +++ b/src/debug.c | |||
| @@ -28,7 +28,7 @@ | |||
| 28 | #include <stdlib.h> | 28 | #include <stdlib.h> |
| 29 | 29 | ||
| 30 | #include "debug.h" | 30 | #include "debug.h" |
| 31 | #include "libiphone/libiphone.h" | 31 | #include "libimobiledevice/libimobiledevice.h" |
| 32 | 32 | ||
| 33 | int debug_level = 0; | 33 | int debug_level = 0; |
| 34 | 34 | ||
| @@ -38,7 +38,7 @@ int debug_level = 0; | |||
| 38 | * | 38 | * |
| 39 | * @param level Set to 0 for no debugging or 1 for debugging. | 39 | * @param level Set to 0 for no debugging or 1 for debugging. |
| 40 | */ | 40 | */ |
| 41 | void iphone_set_debug_level(int level) | 41 | void idevice_set_debug_level(int level) |
| 42 | { | 42 | { |
| 43 | debug_level = level; | 43 | debug_level = level; |
| 44 | } | 44 | } |
diff --git a/src/device_link_service.c b/src/device_link_service.c index 9998fd0..10e9e9c 100644 --- a/src/device_link_service.c +++ b/src/device_link_service.c | |||
| @@ -78,7 +78,7 @@ static char *device_link_service_get_message(plist_t dl_msg) | |||
| 78 | * DEVICE_LINK_SERVICE_E_INVALID_ARG when one of the parameters is invalid, | 78 | * DEVICE_LINK_SERVICE_E_INVALID_ARG when one of the parameters is invalid, |
| 79 | * or DEVICE_LINK_SERVICE_E_MUX_ERROR when the connection failed. | 79 | * or DEVICE_LINK_SERVICE_E_MUX_ERROR when the connection failed. |
| 80 | */ | 80 | */ |
| 81 | device_link_service_error_t device_link_service_client_new(iphone_device_t device, uint16_t port, device_link_service_client_t *client) | 81 | device_link_service_error_t device_link_service_client_new(idevice_t device, uint16_t port, device_link_service_client_t *client) |
| 82 | { | 82 | { |
| 83 | if (!device || port == 0 || !client || *client) { | 83 | if (!device || port == 0 || !client || *client) { |
| 84 | return DEVICE_LINK_SERVICE_E_INVALID_ARG; | 84 | return DEVICE_LINK_SERVICE_E_INVALID_ARG; |
diff --git a/src/device_link_service.h b/src/device_link_service.h index 8345d57..4fc9a9f 100644 --- a/src/device_link_service.h +++ b/src/device_link_service.h | |||
| @@ -41,7 +41,7 @@ typedef struct device_link_service_client_int *device_link_service_client_t; | |||
| 41 | 41 | ||
| 42 | typedef int16_t device_link_service_error_t; | 42 | typedef int16_t device_link_service_error_t; |
| 43 | 43 | ||
| 44 | device_link_service_error_t device_link_service_client_new(iphone_device_t device, uint16_t port, device_link_service_client_t *client); | 44 | device_link_service_error_t device_link_service_client_new(idevice_t device, uint16_t port, device_link_service_client_t *client); |
| 45 | device_link_service_error_t device_link_service_client_free(device_link_service_client_t client); | 45 | device_link_service_error_t device_link_service_client_free(device_link_service_client_t client); |
| 46 | device_link_service_error_t device_link_service_version_exchange(device_link_service_client_t client, uint64_t version_major, uint64_t version_minor); | 46 | device_link_service_error_t device_link_service_version_exchange(device_link_service_client_t client, uint64_t version_major, uint64_t version_minor); |
| 47 | device_link_service_error_t device_link_service_process_message(device_link_service_client_t client, plist_t message); | 47 | 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 @@ | |||
| 36 | * FILE_RELAY_E_INVALID_ARG when one of the parameters is invalid, | 36 | * FILE_RELAY_E_INVALID_ARG when one of the parameters is invalid, |
| 37 | * or FILE_RELAY_E_MUX_ERROR when the connection failed. | 37 | * or FILE_RELAY_E_MUX_ERROR when the connection failed. |
| 38 | */ | 38 | */ |
| 39 | file_relay_error_t file_relay_client_new(iphone_device_t device, uint16_t port, file_relay_client_t *client) | 39 | file_relay_error_t file_relay_client_new(idevice_t device, uint16_t port, file_relay_client_t *client) |
| 40 | { | 40 | { |
| 41 | if (!device || port == 0 || !client || *client) { | 41 | if (!device || port == 0 || !client || *client) { |
| 42 | return FILE_RELAY_E_INVALID_ARG; | 42 | return FILE_RELAY_E_INVALID_ARG; |
| @@ -92,7 +92,7 @@ file_relay_error_t file_relay_client_free(file_relay_client_t client) | |||
| 92 | * - tmp | 92 | * - tmp |
| 93 | * - SystemConfiguration | 93 | * - SystemConfiguration |
| 94 | * @param connection The connection that has to be used for receiving the | 94 | * @param connection The connection that has to be used for receiving the |
| 95 | * data using iphone_connection_receive(). The connection will be closed | 95 | * data using idevice_connection_receive(). The connection will be closed |
| 96 | * automatically by the device, but use file_relay_client_free() to clean | 96 | * automatically by the device, but use file_relay_client_free() to clean |
| 97 | * up properly. | 97 | * up properly. |
| 98 | * | 98 | * |
| @@ -107,7 +107,7 @@ file_relay_error_t file_relay_client_free(file_relay_client_t client) | |||
| 107 | * sources are invalid, FILE_RELAY_E_STAGING_EMPTY if no data is available | 107 | * sources are invalid, FILE_RELAY_E_STAGING_EMPTY if no data is available |
| 108 | * for the given sources, or FILE_RELAY_E_UNKNOWN_ERROR otherwise. | 108 | * for the given sources, or FILE_RELAY_E_UNKNOWN_ERROR otherwise. |
| 109 | */ | 109 | */ |
| 110 | file_relay_error_t file_relay_request_sources(file_relay_client_t client, const char **sources, iphone_connection_t *connection) | 110 | file_relay_error_t file_relay_request_sources(file_relay_client_t client, const char **sources, idevice_connection_t *connection) |
| 111 | { | 111 | { |
| 112 | if (!client || !client->parent || !sources || !sources[0]) { | 112 | if (!client || !client->parent || !sources || !sources[0]) { |
| 113 | return FILE_RELAY_E_INVALID_ARG; | 113 | return FILE_RELAY_E_INVALID_ARG; |
diff --git a/src/file_relay.h b/src/file_relay.h index 9b2488c..7a94c89 100644 --- a/src/file_relay.h +++ b/src/file_relay.h | |||
| @@ -21,7 +21,7 @@ | |||
| 21 | #ifndef FILE_RELAY_H | 21 | #ifndef FILE_RELAY_H |
| 22 | #define FILE_RELAY_H | 22 | #define FILE_RELAY_H |
| 23 | 23 | ||
| 24 | #include "libiphone/file_relay.h" | 24 | #include "libimobiledevice/file_relay.h" |
| 25 | #include "property_list_service.h" | 25 | #include "property_list_service.h" |
| 26 | 26 | ||
| 27 | /* Error Codes */ | 27 | /* Error Codes */ |
diff --git a/src/iphone.c b/src/idevice.c index b471e35..c5050d5 100644 --- a/src/iphone.c +++ b/src/idevice.c | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * iphone.c | 2 | * idevice.c |
| 3 | * Device discovery and communication interface. | 3 | * Device discovery and communication interface. |
| 4 | * | 4 | * |
| 5 | * Copyright (c) 2008 Zach C. All Rights Reserved. | 5 | * Copyright (c) 2008 Zach C. All Rights Reserved. |
| @@ -27,14 +27,14 @@ | |||
| 27 | 27 | ||
| 28 | #include <usbmuxd.h> | 28 | #include <usbmuxd.h> |
| 29 | #include <gnutls/gnutls.h> | 29 | #include <gnutls/gnutls.h> |
| 30 | #include "iphone.h" | 30 | #include "idevice.h" |
| 31 | #include "debug.h" | 31 | #include "debug.h" |
| 32 | 32 | ||
| 33 | static iphone_event_cb_t event_cb = NULL; | 33 | static idevice_event_cb_t event_cb = NULL; |
| 34 | 34 | ||
| 35 | static void usbmux_event_cb(const usbmuxd_event_t *event, void *user_data) | 35 | static void usbmux_event_cb(const usbmuxd_event_t *event, void *user_data) |
| 36 | { | 36 | { |
| 37 | iphone_event_t ev; | 37 | idevice_event_t ev; |
| 38 | 38 | ||
| 39 | ev.event = event->event; | 39 | ev.event = event->event; |
| 40 | ev.uuid = event->device.uuid; | 40 | ev.uuid = event->device.uuid; |
| @@ -53,35 +53,35 @@ static void usbmux_event_cb(const usbmuxd_event_t *event, void *user_data) | |||
| 53 | * @param user_data Application-specific data passed as parameter | 53 | * @param user_data Application-specific data passed as parameter |
| 54 | * to the registered callback function. | 54 | * to the registered callback function. |
| 55 | * | 55 | * |
| 56 | * @return IPHONE_E_SUCCESS on success or an error value when an error occured. | 56 | * @return IDEVICE_E_SUCCESS on success or an error value when an error occured. |
| 57 | */ | 57 | */ |
| 58 | iphone_error_t iphone_event_subscribe(iphone_event_cb_t callback, void *user_data) | 58 | idevice_error_t idevice_event_subscribe(idevice_event_cb_t callback, void *user_data) |
| 59 | { | 59 | { |
| 60 | event_cb = callback; | 60 | event_cb = callback; |
| 61 | int res = usbmuxd_subscribe(usbmux_event_cb, user_data); | 61 | int res = usbmuxd_subscribe(usbmux_event_cb, user_data); |
| 62 | if (res != 0) { | 62 | if (res != 0) { |
| 63 | event_cb = NULL; | 63 | event_cb = NULL; |
| 64 | debug_info("Error %d when subscribing usbmux event callback!", res); | 64 | debug_info("Error %d when subscribing usbmux event callback!", res); |
| 65 | return IPHONE_E_UNKNOWN_ERROR; | 65 | return IDEVICE_E_UNKNOWN_ERROR; |
| 66 | } | 66 | } |
| 67 | return IPHONE_E_SUCCESS; | 67 | return IDEVICE_E_SUCCESS; |
| 68 | } | 68 | } |
| 69 | 69 | ||
| 70 | /** | 70 | /** |
| 71 | * Release the event callback function that has been registered with | 71 | * Release the event callback function that has been registered with |
| 72 | * iphone_event_subscribe(). | 72 | * idevice_event_subscribe(). |
| 73 | * | 73 | * |
| 74 | * @return IPHONE_E_SUCCESS on success or an error value when an error occured. | 74 | * @return IDEVICE_E_SUCCESS on success or an error value when an error occured. |
| 75 | */ | 75 | */ |
| 76 | iphone_error_t iphone_event_unsubscribe() | 76 | idevice_error_t idevice_event_unsubscribe() |
| 77 | { | 77 | { |
| 78 | event_cb = NULL; | 78 | event_cb = NULL; |
| 79 | int res = usbmuxd_unsubscribe(); | 79 | int res = usbmuxd_unsubscribe(); |
| 80 | if (res != 0) { | 80 | if (res != 0) { |
| 81 | debug_info("Error %d when unsubscribing usbmux event callback!", res); | 81 | debug_info("Error %d when unsubscribing usbmux event callback!", res); |
| 82 | return IPHONE_E_UNKNOWN_ERROR; | 82 | return IDEVICE_E_UNKNOWN_ERROR; |
| 83 | } | 83 | } |
| 84 | return IPHONE_E_SUCCESS; | 84 | return IDEVICE_E_SUCCESS; |
| 85 | } | 85 | } |
| 86 | 86 | ||
| 87 | /** | 87 | /** |
| @@ -91,9 +91,9 @@ iphone_error_t iphone_event_unsubscribe() | |||
| 91 | * This list is terminated by a NULL pointer. | 91 | * This list is terminated by a NULL pointer. |
| 92 | * @param count Number of devices found. | 92 | * @param count Number of devices found. |
| 93 | * | 93 | * |
| 94 | * @return IPHONE_E_SUCCESS on success or an error value when an error occured. | 94 | * @return IDEVICE_E_SUCCESS on success or an error value when an error occured. |
| 95 | */ | 95 | */ |
| 96 | iphone_error_t iphone_get_device_list(char ***devices, int *count) | 96 | idevice_error_t idevice_get_device_list(char ***devices, int *count) |
| 97 | { | 97 | { |
| 98 | usbmuxd_device_info_t *dev_list; | 98 | usbmuxd_device_info_t *dev_list; |
| 99 | 99 | ||
| @@ -102,7 +102,7 @@ iphone_error_t iphone_get_device_list(char ***devices, int *count) | |||
| 102 | 102 | ||
| 103 | if (usbmuxd_get_device_list(&dev_list) < 0) { | 103 | if (usbmuxd_get_device_list(&dev_list) < 0) { |
| 104 | debug_info("ERROR: usbmuxd is not running!\n", __func__); | 104 | debug_info("ERROR: usbmuxd is not running!\n", __func__); |
| 105 | return IPHONE_E_NO_DEVICE; | 105 | return IDEVICE_E_NO_DEVICE; |
| 106 | } | 106 | } |
| 107 | 107 | ||
| 108 | char **newlist = NULL; | 108 | char **newlist = NULL; |
| @@ -120,7 +120,7 @@ iphone_error_t iphone_get_device_list(char ***devices, int *count) | |||
| 120 | newlist[newcount] = NULL; | 120 | newlist[newcount] = NULL; |
| 121 | *devices = newlist; | 121 | *devices = newlist; |
| 122 | 122 | ||
| 123 | return IPHONE_E_SUCCESS; | 123 | return IDEVICE_E_SUCCESS; |
| 124 | } | 124 | } |
| 125 | 125 | ||
| 126 | /** | 126 | /** |
| @@ -128,9 +128,9 @@ iphone_error_t iphone_get_device_list(char ***devices, int *count) | |||
| 128 | * | 128 | * |
| 129 | * @param devices List of uuids to free. | 129 | * @param devices List of uuids to free. |
| 130 | * | 130 | * |
| 131 | * @return Always returnes IPHONE_E_SUCCESS. | 131 | * @return Always returnes IDEVICE_E_SUCCESS. |
| 132 | */ | 132 | */ |
| 133 | iphone_error_t iphone_device_list_free(char **devices) | 133 | idevice_error_t idevice_device_list_free(char **devices) |
| 134 | { | 134 | { |
| 135 | if (devices) { | 135 | if (devices) { |
| 136 | int i = 0; | 136 | int i = 0; |
| @@ -139,52 +139,52 @@ iphone_error_t iphone_device_list_free(char **devices) | |||
| 139 | } | 139 | } |
| 140 | free(devices); | 140 | free(devices); |
| 141 | } | 141 | } |
| 142 | return IPHONE_E_SUCCESS; | 142 | return IDEVICE_E_SUCCESS; |
| 143 | } | 143 | } |
| 144 | 144 | ||
| 145 | /** | 145 | /** |
| 146 | * Creates an iphone_device_t structure for the device specified by uuid, | 146 | * Creates an idevice_t structure for the device specified by uuid, |
| 147 | * if the device is available. | 147 | * if the device is available. |
| 148 | * | 148 | * |
| 149 | * @note The resulting iphone_device_t structure has to be freed with | 149 | * @note The resulting idevice_t structure has to be freed with |
| 150 | * iphone_device_free() if it is no longer used. | 150 | * idevice_free() if it is no longer used. |
| 151 | * | 151 | * |
| 152 | * @param device Upon calling this function, a pointer to a location of type | 152 | * @param device Upon calling this function, a pointer to a location of type |
| 153 | * iphone_device_t. On successful return, this location will be populated. | 153 | * idevice_t. On successful return, this location will be populated. |
| 154 | * @param uuid The UUID to match. | 154 | * @param uuid The UUID to match. |
| 155 | * | 155 | * |
| 156 | * @return IPHONE_E_SUCCESS if ok, otherwise an error code. | 156 | * @return IDEVICE_E_SUCCESS if ok, otherwise an error code. |
| 157 | */ | 157 | */ |
| 158 | iphone_error_t iphone_device_new(iphone_device_t * device, const char *uuid) | 158 | idevice_error_t idevice_new(idevice_t * device, const char *uuid) |
| 159 | { | 159 | { |
| 160 | usbmuxd_device_info_t muxdev; | 160 | usbmuxd_device_info_t muxdev; |
| 161 | int res = usbmuxd_get_device_by_uuid(uuid, &muxdev); | 161 | int res = usbmuxd_get_device_by_uuid(uuid, &muxdev); |
| 162 | if (res > 0) { | 162 | if (res > 0) { |
| 163 | iphone_device_t phone = (iphone_device_t) malloc(sizeof(struct iphone_device_int)); | 163 | idevice_t phone = (idevice_t) malloc(sizeof(struct idevice_int)); |
| 164 | phone->uuid = strdup(muxdev.uuid); | 164 | phone->uuid = strdup(muxdev.uuid); |
| 165 | phone->conn_type = CONNECTION_USBMUXD; | 165 | phone->conn_type = CONNECTION_USBMUXD; |
| 166 | phone->conn_data = (void*)muxdev.handle; | 166 | phone->conn_data = (void*)muxdev.handle; |
| 167 | *device = phone; | 167 | *device = phone; |
| 168 | return IPHONE_E_SUCCESS; | 168 | return IDEVICE_E_SUCCESS; |
| 169 | } | 169 | } |
| 170 | /* other connection types could follow here */ | 170 | /* other connection types could follow here */ |
| 171 | 171 | ||
| 172 | return IPHONE_E_NO_DEVICE; | 172 | return IDEVICE_E_NO_DEVICE; |
| 173 | } | 173 | } |
| 174 | 174 | ||
| 175 | /** Cleans up an iPhone structure, then frees the structure itself. | 175 | /** Cleans up an idevice structure, then frees the structure itself. |
| 176 | * This is a library-level function; deals directly with the iPhone to tear | 176 | * This is a library-level function; deals directly with the device to tear |
| 177 | * down relations, but otherwise is mostly internal. | 177 | * down relations, but otherwise is mostly internal. |
| 178 | * | 178 | * |
| 179 | * @param device A pointer to an iPhone structure. | 179 | * @param device idevice_t to free. |
| 180 | */ | 180 | */ |
| 181 | iphone_error_t iphone_device_free(iphone_device_t device) | 181 | idevice_error_t idevice_free(idevice_t device) |
| 182 | { | 182 | { |
| 183 | if (!device) | 183 | if (!device) |
| 184 | return IPHONE_E_INVALID_ARG; | 184 | return IDEVICE_E_INVALID_ARG; |
| 185 | iphone_error_t ret = IPHONE_E_UNKNOWN_ERROR; | 185 | idevice_error_t ret = IDEVICE_E_UNKNOWN_ERROR; |
| 186 | 186 | ||
| 187 | ret = IPHONE_E_SUCCESS; | 187 | ret = IDEVICE_E_SUCCESS; |
| 188 | 188 | ||
| 189 | free(device->uuid); | 189 | free(device->uuid); |
| 190 | 190 | ||
| @@ -203,34 +203,34 @@ iphone_error_t iphone_device_free(iphone_device_t device) | |||
| 203 | * | 203 | * |
| 204 | * @param device The device to connect to. | 204 | * @param device The device to connect to. |
| 205 | * @param port The destination port to connect to. | 205 | * @param port The destination port to connect to. |
| 206 | * @param connection Pointer to an iphone_connection_t that will be filled | 206 | * @param connection Pointer to an idevice_connection_t that will be filled |
| 207 | * with the necessary data of the connection. | 207 | * with the necessary data of the connection. |
| 208 | * | 208 | * |
| 209 | * @return IPHONE_E_SUCCESS if ok, otherwise an error code. | 209 | * @return IDEVICE_E_SUCCESS if ok, otherwise an error code. |
| 210 | */ | 210 | */ |
| 211 | iphone_error_t iphone_device_connect(iphone_device_t device, uint16_t port, iphone_connection_t *connection) | 211 | idevice_error_t idevice_connect(idevice_t device, uint16_t port, idevice_connection_t *connection) |
| 212 | { | 212 | { |
| 213 | if (!device) { | 213 | if (!device) { |
| 214 | return IPHONE_E_INVALID_ARG; | 214 | return IDEVICE_E_INVALID_ARG; |
| 215 | } | 215 | } |
| 216 | 216 | ||
| 217 | if (device->conn_type == CONNECTION_USBMUXD) { | 217 | if (device->conn_type == CONNECTION_USBMUXD) { |
| 218 | int sfd = usbmuxd_connect((uint32_t)(device->conn_data), port); | 218 | int sfd = usbmuxd_connect((uint32_t)(device->conn_data), port); |
| 219 | if (sfd < 0) { | 219 | if (sfd < 0) { |
| 220 | debug_info("ERROR: Connecting to usbmuxd failed: %d (%s)", sfd, strerror(-sfd)); | 220 | debug_info("ERROR: Connecting to usbmuxd failed: %d (%s)", sfd, strerror(-sfd)); |
| 221 | return IPHONE_E_UNKNOWN_ERROR; | 221 | return IDEVICE_E_UNKNOWN_ERROR; |
| 222 | } | 222 | } |
| 223 | iphone_connection_t new_connection = (iphone_connection_t)malloc(sizeof(struct iphone_connection_int)); | 223 | idevice_connection_t new_connection = (idevice_connection_t)malloc(sizeof(struct idevice_connection_int)); |
| 224 | new_connection->type = CONNECTION_USBMUXD; | 224 | new_connection->type = CONNECTION_USBMUXD; |
| 225 | new_connection->data = (void*)sfd; | 225 | new_connection->data = (void*)sfd; |
| 226 | new_connection->ssl_data = NULL; | 226 | new_connection->ssl_data = NULL; |
| 227 | *connection = new_connection; | 227 | *connection = new_connection; |
| 228 | return IPHONE_E_SUCCESS; | 228 | return IDEVICE_E_SUCCESS; |
| 229 | } else { | 229 | } else { |
| 230 | debug_info("Unknown connection type %d", device->conn_type); | 230 | debug_info("Unknown connection type %d", device->conn_type); |
| 231 | } | 231 | } |
| 232 | 232 | ||
| 233 | return IPHONE_E_UNKNOWN_ERROR; | 233 | return IDEVICE_E_UNKNOWN_ERROR; |
| 234 | } | 234 | } |
| 235 | 235 | ||
| 236 | /** | 236 | /** |
| @@ -238,21 +238,21 @@ iphone_error_t iphone_device_connect(iphone_device_t device, uint16_t port, ipho | |||
| 238 | * | 238 | * |
| 239 | * @param connection The connection to close. | 239 | * @param connection The connection to close. |
| 240 | * | 240 | * |
| 241 | * @return IPHONE_E_SUCCESS if ok, otherwise an error code. | 241 | * @return IDEVICE_E_SUCCESS if ok, otherwise an error code. |
| 242 | */ | 242 | */ |
| 243 | iphone_error_t iphone_device_disconnect(iphone_connection_t connection) | 243 | idevice_error_t idevice_disconnect(idevice_connection_t connection) |
| 244 | { | 244 | { |
| 245 | if (!connection) { | 245 | if (!connection) { |
| 246 | return IPHONE_E_INVALID_ARG; | 246 | return IDEVICE_E_INVALID_ARG; |
| 247 | } | 247 | } |
| 248 | /* shut down ssl if enabled */ | 248 | /* shut down ssl if enabled */ |
| 249 | if (connection->ssl_data) { | 249 | if (connection->ssl_data) { |
| 250 | iphone_connection_disable_ssl(connection); | 250 | idevice_connection_disable_ssl(connection); |
| 251 | } | 251 | } |
| 252 | iphone_error_t result = IPHONE_E_UNKNOWN_ERROR; | 252 | idevice_error_t result = IDEVICE_E_UNKNOWN_ERROR; |
| 253 | if (connection->type == CONNECTION_USBMUXD) { | 253 | if (connection->type == CONNECTION_USBMUXD) { |
| 254 | usbmuxd_disconnect((int)(connection->data)); | 254 | usbmuxd_disconnect((int)(connection->data)); |
| 255 | result = IPHONE_E_SUCCESS; | 255 | result = IDEVICE_E_SUCCESS; |
| 256 | } else { | 256 | } else { |
| 257 | debug_info("Unknown connection type %d", connection->type); | 257 | debug_info("Unknown connection type %d", connection->type); |
| 258 | } | 258 | } |
| @@ -263,23 +263,23 @@ iphone_error_t iphone_device_disconnect(iphone_connection_t connection) | |||
| 263 | /** | 263 | /** |
| 264 | * Internally used function to send raw data over the given connection. | 264 | * Internally used function to send raw data over the given connection. |
| 265 | */ | 265 | */ |
| 266 | static iphone_error_t internal_connection_send(iphone_connection_t connection, const char *data, uint32_t len, uint32_t *sent_bytes) | 266 | static idevice_error_t internal_connection_send(idevice_connection_t connection, const char *data, uint32_t len, uint32_t *sent_bytes) |
| 267 | { | 267 | { |
| 268 | if (!connection || !data) { | 268 | if (!connection || !data) { |
| 269 | return IPHONE_E_INVALID_ARG; | 269 | return IDEVICE_E_INVALID_ARG; |
| 270 | } | 270 | } |
| 271 | 271 | ||
| 272 | if (connection->type == CONNECTION_USBMUXD) { | 272 | if (connection->type == CONNECTION_USBMUXD) { |
| 273 | int res = usbmuxd_send((int)(connection->data), data, len, sent_bytes); | 273 | int res = usbmuxd_send((int)(connection->data), data, len, sent_bytes); |
| 274 | if (res < 0) { | 274 | if (res < 0) { |
| 275 | debug_info("ERROR: usbmuxd_send returned %d (%s)", res, strerror(-res)); | 275 | debug_info("ERROR: usbmuxd_send returned %d (%s)", res, strerror(-res)); |
| 276 | return IPHONE_E_UNKNOWN_ERROR; | 276 | return IDEVICE_E_UNKNOWN_ERROR; |
| 277 | } | 277 | } |
| 278 | return IPHONE_E_SUCCESS; | 278 | return IDEVICE_E_SUCCESS; |
| 279 | } else { | 279 | } else { |
| 280 | debug_info("Unknown connection type %d", connection->type); | 280 | debug_info("Unknown connection type %d", connection->type); |
| 281 | } | 281 | } |
| 282 | return IPHONE_E_UNKNOWN_ERROR; | 282 | return IDEVICE_E_UNKNOWN_ERROR; |
| 283 | 283 | ||
| 284 | } | 284 | } |
| 285 | 285 | ||
| @@ -292,22 +292,22 @@ static iphone_error_t internal_connection_send(iphone_connection_t connection, c | |||
| 292 | * @param sent_bytes Pointer to an uint32_t that will be filled | 292 | * @param sent_bytes Pointer to an uint32_t that will be filled |
| 293 | * with the number of bytes actually sent. | 293 | * with the number of bytes actually sent. |
| 294 | * | 294 | * |
| 295 | * @return IPHONE_E_SUCCESS if ok, otherwise an error code. | 295 | * @return IDEVICE_E_SUCCESS if ok, otherwise an error code. |
| 296 | */ | 296 | */ |
| 297 | iphone_error_t iphone_connection_send(iphone_connection_t connection, const char *data, uint32_t len, uint32_t *sent_bytes) | 297 | idevice_error_t idevice_connection_send(idevice_connection_t connection, const char *data, uint32_t len, uint32_t *sent_bytes) |
| 298 | { | 298 | { |
| 299 | if (!connection || !data || (connection->ssl_data && !connection->ssl_data->session)) { | 299 | if (!connection || !data || (connection->ssl_data && !connection->ssl_data->session)) { |
| 300 | return IPHONE_E_INVALID_ARG; | 300 | return IDEVICE_E_INVALID_ARG; |
| 301 | } | 301 | } |
| 302 | 302 | ||
| 303 | if (connection->ssl_data) { | 303 | if (connection->ssl_data) { |
| 304 | ssize_t sent = gnutls_record_send(connection->ssl_data->session, (void*)data, (size_t)len); | 304 | ssize_t sent = gnutls_record_send(connection->ssl_data->session, (void*)data, (size_t)len); |
| 305 | if ((uint32_t)sent == (uint32_t)len) { | 305 | if ((uint32_t)sent == (uint32_t)len) { |
| 306 | *sent_bytes = sent; | 306 | *sent_bytes = sent; |
| 307 | return IPHONE_E_SUCCESS; | 307 | return IDEVICE_E_SUCCESS; |
| 308 | } | 308 | } |
| 309 | *sent_bytes = 0; | 309 | *sent_bytes = 0; |
| 310 | return IPHONE_E_SSL_ERROR; | 310 | return IDEVICE_E_SSL_ERROR; |
| 311 | } | 311 | } |
| 312 | return internal_connection_send(connection, data, len, sent_bytes); | 312 | return internal_connection_send(connection, data, len, sent_bytes); |
| 313 | } | 313 | } |
| @@ -316,23 +316,23 @@ iphone_error_t iphone_connection_send(iphone_connection_t connection, const char | |||
| 316 | * Internally used function for receiving raw data over the given connection | 316 | * Internally used function for receiving raw data over the given connection |
| 317 | * using a timeout. | 317 | * using a timeout. |
| 318 | */ | 318 | */ |
| 319 | static iphone_error_t internal_connection_receive_timeout(iphone_connection_t connection, char *data, uint32_t len, uint32_t *recv_bytes, unsigned int timeout) | 319 | static idevice_error_t internal_connection_receive_timeout(idevice_connection_t connection, char *data, uint32_t len, uint32_t *recv_bytes, unsigned int timeout) |
| 320 | { | 320 | { |
| 321 | if (!connection) { | 321 | if (!connection) { |
| 322 | return IPHONE_E_INVALID_ARG; | 322 | return IDEVICE_E_INVALID_ARG; |
| 323 | } | 323 | } |
| 324 | 324 | ||
| 325 | if (connection->type == CONNECTION_USBMUXD) { | 325 | if (connection->type == CONNECTION_USBMUXD) { |
| 326 | int res = usbmuxd_recv_timeout((int)(connection->data), data, len, recv_bytes, timeout); | 326 | int res = usbmuxd_recv_timeout((int)(connection->data), data, len, recv_bytes, timeout); |
| 327 | if (res < 0) { | 327 | if (res < 0) { |
| 328 | debug_info("ERROR: usbmuxd_recv_timeout returned %d (%s)", res, strerror(-res)); | 328 | debug_info("ERROR: usbmuxd_recv_timeout returned %d (%s)", res, strerror(-res)); |
| 329 | return IPHONE_E_UNKNOWN_ERROR; | 329 | return IDEVICE_E_UNKNOWN_ERROR; |
| 330 | } | 330 | } |
| 331 | return IPHONE_E_SUCCESS; | 331 | return IDEVICE_E_SUCCESS; |
| 332 | } else { | 332 | } else { |
| 333 | debug_info("Unknown connection type %d", connection->type); | 333 | debug_info("Unknown connection type %d", connection->type); |
| 334 | } | 334 | } |
| 335 | return IPHONE_E_UNKNOWN_ERROR; | 335 | return IDEVICE_E_UNKNOWN_ERROR; |
| 336 | } | 336 | } |
| 337 | 337 | ||
| 338 | /** | 338 | /** |
| @@ -348,22 +348,22 @@ static iphone_error_t internal_connection_receive_timeout(iphone_connection_t co | |||
| 348 | * @param timeout Timeout in milliseconds after which this function should | 348 | * @param timeout Timeout in milliseconds after which this function should |
| 349 | * return even if no data has been received. | 349 | * return even if no data has been received. |
| 350 | * | 350 | * |
| 351 | * @return IPHONE_E_SUCCESS if ok, otherwise an error code. | 351 | * @return IDEVICE_E_SUCCESS if ok, otherwise an error code. |
| 352 | */ | 352 | */ |
| 353 | iphone_error_t iphone_connection_receive_timeout(iphone_connection_t connection, char *data, uint32_t len, uint32_t *recv_bytes, unsigned int timeout) | 353 | idevice_error_t idevice_connection_receive_timeout(idevice_connection_t connection, char *data, uint32_t len, uint32_t *recv_bytes, unsigned int timeout) |
| 354 | { | 354 | { |
| 355 | if (!connection || (connection->ssl_data && !connection->ssl_data->session)) { | 355 | if (!connection || (connection->ssl_data && !connection->ssl_data->session)) { |
| 356 | return IPHONE_E_INVALID_ARG; | 356 | return IDEVICE_E_INVALID_ARG; |
| 357 | } | 357 | } |
| 358 | 358 | ||
| 359 | if (connection->ssl_data) { | 359 | if (connection->ssl_data) { |
| 360 | ssize_t received = gnutls_record_recv(connection->ssl_data->session, (void*)data, (size_t)len); | 360 | ssize_t received = gnutls_record_recv(connection->ssl_data->session, (void*)data, (size_t)len); |
| 361 | if (received > 0) { | 361 | if (received > 0) { |
| 362 | *recv_bytes = received; | 362 | *recv_bytes = received; |
| 363 | return IPHONE_E_SUCCESS; | 363 | return IDEVICE_E_SUCCESS; |
| 364 | } | 364 | } |
| 365 | *recv_bytes = 0; | 365 | *recv_bytes = 0; |
| 366 | return IPHONE_E_SSL_ERROR; | 366 | return IDEVICE_E_SSL_ERROR; |
| 367 | } | 367 | } |
| 368 | return internal_connection_receive_timeout(connection, data, len, recv_bytes, timeout); | 368 | return internal_connection_receive_timeout(connection, data, len, recv_bytes, timeout); |
| 369 | } | 369 | } |
| @@ -371,30 +371,30 @@ iphone_error_t iphone_connection_receive_timeout(iphone_connection_t connection, | |||
| 371 | /** | 371 | /** |
| 372 | * Internally used function for receiving raw data over the given connection. | 372 | * Internally used function for receiving raw data over the given connection. |
| 373 | */ | 373 | */ |
| 374 | static iphone_error_t internal_connection_receive(iphone_connection_t connection, char *data, uint32_t len, uint32_t *recv_bytes) | 374 | static idevice_error_t internal_connection_receive(idevice_connection_t connection, char *data, uint32_t len, uint32_t *recv_bytes) |
| 375 | { | 375 | { |
| 376 | if (!connection) { | 376 | if (!connection) { |
| 377 | return IPHONE_E_INVALID_ARG; | 377 | return IDEVICE_E_INVALID_ARG; |
| 378 | } | 378 | } |
| 379 | 379 | ||
| 380 | if (connection->type == CONNECTION_USBMUXD) { | 380 | if (connection->type == CONNECTION_USBMUXD) { |
| 381 | int res = usbmuxd_recv((int)(connection->data), data, len, recv_bytes); | 381 | int res = usbmuxd_recv((int)(connection->data), data, len, recv_bytes); |
| 382 | if (res < 0) { | 382 | if (res < 0) { |
| 383 | debug_info("ERROR: usbmuxd_recv returned %d (%s)", res, strerror(-res)); | 383 | debug_info("ERROR: usbmuxd_recv returned %d (%s)", res, strerror(-res)); |
| 384 | return IPHONE_E_UNKNOWN_ERROR; | 384 | return IDEVICE_E_UNKNOWN_ERROR; |
| 385 | } | 385 | } |
| 386 | 386 | ||
| 387 | return IPHONE_E_SUCCESS; | 387 | return IDEVICE_E_SUCCESS; |
| 388 | } else { | 388 | } else { |
| 389 | debug_info("Unknown connection type %d", connection->type); | 389 | debug_info("Unknown connection type %d", connection->type); |
| 390 | } | 390 | } |
| 391 | return IPHONE_E_UNKNOWN_ERROR; | 391 | return IDEVICE_E_UNKNOWN_ERROR; |
| 392 | } | 392 | } |
| 393 | 393 | ||
| 394 | /** | 394 | /** |
| 395 | * Receive data from a device via the given connection. | 395 | * Receive data from a device via the given connection. |
| 396 | * This function is like iphone_connection_receive_timeout, but with a predefined | 396 | * This function is like idevice_connection_receive_timeout, but with a |
| 397 | * reasonable timeout. | 397 | * predefined reasonable timeout. |
| 398 | * | 398 | * |
| 399 | * @param connection The connection to receive data from. | 399 | * @param connection The connection to receive data from. |
| 400 | * @param data Buffer that will be filled with the received data. | 400 | * @param data Buffer that will be filled with the received data. |
| @@ -402,47 +402,47 @@ static iphone_error_t internal_connection_receive(iphone_connection_t connection | |||
| 402 | * @param len Buffer size or number of bytes to receive. | 402 | * @param len Buffer size or number of bytes to receive. |
| 403 | * @param recv_bytes Number of bytes actually received. | 403 | * @param recv_bytes Number of bytes actually received. |
| 404 | * | 404 | * |
| 405 | * @return IPHONE_E_SUCCESS if ok, otherwise an error code. | 405 | * @return IDEVICE_E_SUCCESS if ok, otherwise an error code. |
| 406 | */ | 406 | */ |
| 407 | iphone_error_t iphone_connection_receive(iphone_connection_t connection, char *data, uint32_t len, uint32_t *recv_bytes) | 407 | idevice_error_t idevice_connection_receive(idevice_connection_t connection, char *data, uint32_t len, uint32_t *recv_bytes) |
| 408 | { | 408 | { |
| 409 | if (!connection || (connection->ssl_data && !connection->ssl_data->session)) { | 409 | if (!connection || (connection->ssl_data && !connection->ssl_data->session)) { |
| 410 | return IPHONE_E_INVALID_ARG; | 410 | return IDEVICE_E_INVALID_ARG; |
| 411 | } | 411 | } |
| 412 | 412 | ||
| 413 | if (connection->ssl_data) { | 413 | if (connection->ssl_data) { |
| 414 | ssize_t received = gnutls_record_recv(connection->ssl_data->session, (void*)data, (size_t)len); | 414 | ssize_t received = gnutls_record_recv(connection->ssl_data->session, (void*)data, (size_t)len); |
| 415 | if (received > 0) { | 415 | if (received > 0) { |
| 416 | *recv_bytes = received; | 416 | *recv_bytes = received; |
| 417 | return IPHONE_E_SUCCESS; | 417 | return IDEVICE_E_SUCCESS; |
| 418 | } | 418 | } |
| 419 | *recv_bytes = 0; | 419 | *recv_bytes = 0; |
| 420 | return IPHONE_E_SSL_ERROR; | 420 | return IDEVICE_E_SSL_ERROR; |
| 421 | } | 421 | } |
| 422 | return internal_connection_receive(connection, data, len, recv_bytes); | 422 | return internal_connection_receive(connection, data, len, recv_bytes); |
| 423 | } | 423 | } |
| 424 | 424 | ||
| 425 | iphone_error_t iphone_device_get_handle(iphone_device_t device, uint32_t *handle) | 425 | idevice_error_t idevice_get_handle(idevice_t device, uint32_t *handle) |
| 426 | { | 426 | { |
| 427 | if (!device) | 427 | if (!device) |
| 428 | return IPHONE_E_INVALID_ARG; | 428 | return IDEVICE_E_INVALID_ARG; |
| 429 | 429 | ||
| 430 | if (device->conn_type == CONNECTION_USBMUXD) { | 430 | if (device->conn_type == CONNECTION_USBMUXD) { |
| 431 | *handle = (uint32_t)device->conn_data; | 431 | *handle = (uint32_t)device->conn_data; |
| 432 | return IPHONE_E_SUCCESS; | 432 | return IDEVICE_E_SUCCESS; |
| 433 | } else { | 433 | } else { |
| 434 | debug_info("Unknown connection type %d", device->conn_type); | 434 | debug_info("Unknown connection type %d", device->conn_type); |
| 435 | } | 435 | } |
| 436 | return IPHONE_E_UNKNOWN_ERROR; | 436 | return IDEVICE_E_UNKNOWN_ERROR; |
| 437 | } | 437 | } |
| 438 | 438 | ||
| 439 | iphone_error_t iphone_device_get_uuid(iphone_device_t device, char **uuid) | 439 | idevice_error_t idevice_get_uuid(idevice_t device, char **uuid) |
| 440 | { | 440 | { |
| 441 | if (!device) | 441 | if (!device) |
| 442 | return IPHONE_E_INVALID_ARG; | 442 | return IDEVICE_E_INVALID_ARG; |
| 443 | 443 | ||
| 444 | *uuid = strdup(device->uuid); | 444 | *uuid = strdup(device->uuid); |
| 445 | return IPHONE_E_SUCCESS; | 445 | return IDEVICE_E_SUCCESS; |
| 446 | } | 446 | } |
| 447 | 447 | ||
| 448 | /** | 448 | /** |
| @@ -453,8 +453,8 @@ static ssize_t internal_ssl_read(gnutls_transport_ptr_t transport, char *buffer, | |||
| 453 | int bytes = 0, pos_start_fill = 0; | 453 | int bytes = 0, pos_start_fill = 0; |
| 454 | size_t tbytes = 0; | 454 | size_t tbytes = 0; |
| 455 | int this_len = length; | 455 | int this_len = length; |
| 456 | iphone_error_t res; | 456 | idevice_error_t res; |
| 457 | iphone_connection_t connection = (iphone_connection_t)transport; | 457 | idevice_connection_t connection = (idevice_connection_t)transport; |
| 458 | char *recv_buffer; | 458 | char *recv_buffer; |
| 459 | 459 | ||
| 460 | debug_info("pre-read client wants %zi bytes", length); | 460 | debug_info("pre-read client wants %zi bytes", length); |
| @@ -463,8 +463,8 @@ static ssize_t internal_ssl_read(gnutls_transport_ptr_t transport, char *buffer, | |||
| 463 | 463 | ||
| 464 | /* repeat until we have the full data or an error occurs */ | 464 | /* repeat until we have the full data or an error occurs */ |
| 465 | do { | 465 | do { |
| 466 | if ((res = internal_connection_receive(connection, recv_buffer, this_len, (uint32_t*)&bytes)) != IPHONE_E_SUCCESS) { | 466 | if ((res = internal_connection_receive(connection, recv_buffer, this_len, (uint32_t*)&bytes)) != IDEVICE_E_SUCCESS) { |
| 467 | debug_info("ERROR: iphone_connection_receive returned %d", res); | 467 | debug_info("ERROR: idevice_connection_receive returned %d", res); |
| 468 | return res; | 468 | return res; |
| 469 | } | 469 | } |
| 470 | debug_info("post-read we got %i bytes", bytes); | 470 | debug_info("post-read we got %i bytes", bytes); |
| @@ -496,7 +496,7 @@ static ssize_t internal_ssl_read(gnutls_transport_ptr_t transport, char *buffer, | |||
| 496 | static ssize_t internal_ssl_write(gnutls_transport_ptr_t transport, char *buffer, size_t length) | 496 | static ssize_t internal_ssl_write(gnutls_transport_ptr_t transport, char *buffer, size_t length) |
| 497 | { | 497 | { |
| 498 | uint32_t bytes = 0; | 498 | uint32_t bytes = 0; |
| 499 | iphone_connection_t connection = (iphone_connection_t)transport; | 499 | idevice_connection_t connection = (idevice_connection_t)transport; |
| 500 | debug_info("pre-send length = %zi", length); | 500 | debug_info("pre-send length = %zi", length); |
| 501 | internal_connection_send(connection, buffer, length, &bytes); | 501 | internal_connection_send(connection, buffer, length, &bytes); |
| 502 | debug_info("post-send sent %i bytes", bytes); | 502 | debug_info("post-send sent %i bytes", bytes); |
| @@ -524,16 +524,16 @@ static void internal_ssl_cleanup(ssl_data_t ssl_data) | |||
| 524 | * | 524 | * |
| 525 | * @param connection The connection to enable SSL for. | 525 | * @param connection The connection to enable SSL for. |
| 526 | * | 526 | * |
| 527 | * @return IPHONE_E_SUCCESS on success, IPHONE_E_INVALID_ARG when connection | 527 | * @return IDEVICE_E_SUCCESS on success, IDEVICE_E_INVALID_ARG when connection |
| 528 | * is NULL or connection->ssl_data is non-NULL, or IPHONE_E_SSL_ERROR when | 528 | * is NULL or connection->ssl_data is non-NULL, or IDEVICE_E_SSL_ERROR when |
| 529 | * SSL initialization, setup, or handshake fails. | 529 | * SSL initialization, setup, or handshake fails. |
| 530 | */ | 530 | */ |
| 531 | iphone_error_t iphone_connection_enable_ssl(iphone_connection_t connection) | 531 | idevice_error_t idevice_connection_enable_ssl(idevice_connection_t connection) |
| 532 | { | 532 | { |
| 533 | if (!connection || connection->ssl_data) | 533 | if (!connection || connection->ssl_data) |
| 534 | return IPHONE_E_INVALID_ARG; | 534 | return IDEVICE_E_INVALID_ARG; |
| 535 | 535 | ||
| 536 | iphone_error_t ret = IPHONE_E_SSL_ERROR; | 536 | idevice_error_t ret = IDEVICE_E_SSL_ERROR; |
| 537 | uint32_t return_me = 0; | 537 | uint32_t return_me = 0; |
| 538 | 538 | ||
| 539 | ssl_data_t ssl_data_loc = (ssl_data_t)malloc(sizeof(struct ssl_data_int)); | 539 | ssl_data_t ssl_data_loc = (ssl_data_t)malloc(sizeof(struct ssl_data_int)); |
| @@ -580,7 +580,7 @@ iphone_error_t iphone_connection_enable_ssl(iphone_connection_t connection) | |||
| 580 | debug_info("oh.. errno says %s", strerror(errno)); | 580 | debug_info("oh.. errno says %s", strerror(errno)); |
| 581 | } else { | 581 | } else { |
| 582 | connection->ssl_data = ssl_data_loc; | 582 | connection->ssl_data = ssl_data_loc; |
| 583 | ret = IPHONE_E_SUCCESS; | 583 | ret = IDEVICE_E_SUCCESS; |
| 584 | debug_info("SSL mode enabled"); | 584 | debug_info("SSL mode enabled"); |
| 585 | } | 585 | } |
| 586 | return ret; | 586 | return ret; |
| @@ -591,17 +591,17 @@ iphone_error_t iphone_connection_enable_ssl(iphone_connection_t connection) | |||
| 591 | * | 591 | * |
| 592 | * @param connection The connection to disable SSL for. | 592 | * @param connection The connection to disable SSL for. |
| 593 | * | 593 | * |
| 594 | * @return IPHONE_E_SUCCESS on success, IPHONE_E_INVALID_ARG when connection | 594 | * @return IDEVICE_E_SUCCESS on success, IDEVICE_E_INVALID_ARG when connection |
| 595 | * is NULL. This function also returns IPHONE_E_SUCCESS when SSL is not | 595 | * is NULL. This function also returns IDEVICE_E_SUCCESS when SSL is not |
| 596 | * enabled and does no further error checking on cleanup. | 596 | * enabled and does no further error checking on cleanup. |
| 597 | */ | 597 | */ |
| 598 | iphone_error_t iphone_connection_disable_ssl(iphone_connection_t connection) | 598 | idevice_error_t idevice_connection_disable_ssl(idevice_connection_t connection) |
| 599 | { | 599 | { |
| 600 | if (!connection) | 600 | if (!connection) |
| 601 | return IPHONE_E_INVALID_ARG; | 601 | return IDEVICE_E_INVALID_ARG; |
| 602 | if (!connection->ssl_data) { | 602 | if (!connection->ssl_data) { |
| 603 | /* ignore if ssl is not enabled */ | 603 | /* ignore if ssl is not enabled */ |
| 604 | return IPHONE_E_SUCCESS; | 604 | return IDEVICE_E_SUCCESS; |
| 605 | } | 605 | } |
| 606 | 606 | ||
| 607 | if (connection->ssl_data->session) { | 607 | if (connection->ssl_data->session) { |
| @@ -613,6 +613,6 @@ iphone_error_t iphone_connection_disable_ssl(iphone_connection_t connection) | |||
| 613 | 613 | ||
| 614 | debug_info("SSL mode disabled"); | 614 | debug_info("SSL mode disabled"); |
| 615 | 615 | ||
| 616 | return IPHONE_E_SUCCESS; | 616 | return IDEVICE_E_SUCCESS; |
| 617 | } | 617 | } |
| 618 | 618 | ||
diff --git a/src/iphone.h b/src/idevice.h index 2755349..4aab440 100644 --- a/src/iphone.h +++ b/src/idevice.h | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * iphone.h | 2 | * idevice.h |
| 3 | * Device discovery and communication interface -- header file. | 3 | * Device discovery and communication interface -- header file. |
| 4 | * | 4 | * |
| 5 | * Copyright (c) 2008 Zach C. All Rights Reserved. | 5 | * Copyright (c) 2008 Zach C. All Rights Reserved. |
| @@ -18,13 +18,13 @@ | |||
| 18 | * License along with this library; if not, write to the Free Software | 18 | * License along with this library; if not, write to the Free Software |
| 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 20 | */ | 20 | */ |
| 21 | #ifndef IPHONE_H | 21 | #ifndef IDEVICE_H |
| 22 | #define IPHONE_H | 22 | #define IDEVICE_H |
| 23 | 23 | ||
| 24 | #include <plist/plist.h> | 24 | #include <plist/plist.h> |
| 25 | #include <gnutls/gnutls.h> | 25 | #include <gnutls/gnutls.h> |
| 26 | 26 | ||
| 27 | #include "libiphone/libiphone.h" | 27 | #include "libimobiledevice/libimobiledevice.h" |
| 28 | 28 | ||
| 29 | enum connection_type { | 29 | enum connection_type { |
| 30 | CONNECTION_USBMUXD = 1 | 30 | CONNECTION_USBMUXD = 1 |
| @@ -36,19 +36,19 @@ struct ssl_data_int { | |||
| 36 | }; | 36 | }; |
| 37 | typedef struct ssl_data_int *ssl_data_t; | 37 | typedef struct ssl_data_int *ssl_data_t; |
| 38 | 38 | ||
| 39 | struct iphone_connection_int { | 39 | struct idevice_connection_int { |
| 40 | enum connection_type type; | 40 | enum connection_type type; |
| 41 | void *data; | 41 | void *data; |
| 42 | ssl_data_t ssl_data; | 42 | ssl_data_t ssl_data; |
| 43 | }; | 43 | }; |
| 44 | 44 | ||
| 45 | struct iphone_device_int { | 45 | struct idevice_int { |
| 46 | char *uuid; | 46 | char *uuid; |
| 47 | enum connection_type conn_type; | 47 | enum connection_type conn_type; |
| 48 | void *conn_data; | 48 | void *conn_data; |
| 49 | }; | 49 | }; |
| 50 | 50 | ||
| 51 | iphone_error_t iphone_connection_enable_ssl(iphone_connection_t connection); | 51 | idevice_error_t idevice_connection_enable_ssl(idevice_connection_t connection); |
| 52 | iphone_error_t iphone_connection_disable_ssl(iphone_connection_t connection); | 52 | idevice_error_t idevice_connection_disable_ssl(idevice_connection_t connection); |
| 53 | 53 | ||
| 54 | #endif | 54 | #endif |
diff --git a/src/installation_proxy.c b/src/installation_proxy.c index e0bccd3..3a6d22a 100644 --- a/src/installation_proxy.c +++ b/src/installation_proxy.c | |||
| @@ -92,7 +92,7 @@ static instproxy_error_t instproxy_error(property_list_service_error_t err) | |||
| 92 | * @return INSTPROXY_E_SUCCESS on success, or an INSTPROXY_E_* error value | 92 | * @return INSTPROXY_E_SUCCESS on success, or an INSTPROXY_E_* error value |
| 93 | * when an error occured. | 93 | * when an error occured. |
| 94 | */ | 94 | */ |
| 95 | instproxy_error_t instproxy_client_new(iphone_device_t device, uint16_t port, instproxy_client_t *client) | 95 | instproxy_error_t instproxy_client_new(idevice_t device, uint16_t port, instproxy_client_t *client) |
| 96 | { | 96 | { |
| 97 | /* makes sure thread environment is available */ | 97 | /* makes sure thread environment is available */ |
| 98 | if (!g_thread_supported()) | 98 | if (!g_thread_supported()) |
diff --git a/src/installation_proxy.h b/src/installation_proxy.h index 0204533..78128b2 100644 --- a/src/installation_proxy.h +++ b/src/installation_proxy.h | |||
| @@ -23,7 +23,7 @@ | |||
| 23 | 23 | ||
| 24 | #include <glib.h> | 24 | #include <glib.h> |
| 25 | 25 | ||
| 26 | #include "libiphone/installation_proxy.h" | 26 | #include "libimobiledevice/installation_proxy.h" |
| 27 | #include "property_list_service.h" | 27 | #include "property_list_service.h" |
| 28 | 28 | ||
| 29 | struct instproxy_client_int { | 29 | 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 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * lockdown.c | 2 | * lockdown.c |
| 3 | * libiphone built-in lockdownd client | 3 | * libimobiledevice built-in lockdownd client |
| 4 | * | 4 | * |
| 5 | * Copyright (c) 2008 Zach C. All Rights Reserved. | 5 | * Copyright (c) 2008 Zach C. All Rights Reserved. |
| 6 | * | 6 | * |
| @@ -30,7 +30,7 @@ | |||
| 30 | 30 | ||
| 31 | #include "property_list_service.h" | 31 | #include "property_list_service.h" |
| 32 | #include "lockdown.h" | 32 | #include "lockdown.h" |
| 33 | #include "iphone.h" | 33 | #include "idevice.h" |
| 34 | #include "debug.h" | 34 | #include "debug.h" |
| 35 | #include "userpref.h" | 35 | #include "userpref.h" |
| 36 | 36 | ||
| @@ -229,7 +229,7 @@ void lockdownd_client_set_label(lockdownd_client_t client, const char *label) | |||
| 229 | } | 229 | } |
| 230 | } | 230 | } |
| 231 | 231 | ||
| 232 | /** Polls the iPhone for lockdownd data. | 232 | /** Polls the device for lockdownd data. |
| 233 | * | 233 | * |
| 234 | * @param control The lockdownd client | 234 | * @param control The lockdownd client |
| 235 | * @param plist The plist to store the received data | 235 | * @param plist The plist to store the received data |
| @@ -254,7 +254,7 @@ lockdownd_error_t lockdownd_receive(lockdownd_client_t client, plist_t *plist) | |||
| 254 | return ret; | 254 | return ret; |
| 255 | } | 255 | } |
| 256 | 256 | ||
| 257 | /** Sends lockdownd data to the iPhone | 257 | /** Sends lockdownd data to the device |
| 258 | * | 258 | * |
| 259 | * @note This function is low-level and should only be used if you need to send | 259 | * @note This function is low-level and should only be used if you need to send |
| 260 | * a new type of message. | 260 | * a new type of message. |
| @@ -270,7 +270,7 @@ lockdownd_error_t lockdownd_send(lockdownd_client_t client, plist_t plist) | |||
| 270 | return LOCKDOWN_E_INVALID_ARG; | 270 | return LOCKDOWN_E_INVALID_ARG; |
| 271 | 271 | ||
| 272 | lockdownd_error_t ret = LOCKDOWN_E_SUCCESS; | 272 | lockdownd_error_t ret = LOCKDOWN_E_SUCCESS; |
| 273 | iphone_error_t err; | 273 | idevice_error_t err; |
| 274 | 274 | ||
| 275 | err = property_list_service_send_xml_plist(client->parent, plist); | 275 | err = property_list_service_send_xml_plist(client->parent, plist); |
| 276 | if (err != PROPERTY_LIST_SERVICE_E_SUCCESS) { | 276 | if (err != PROPERTY_LIST_SERVICE_E_SUCCESS) { |
| @@ -578,7 +578,7 @@ lockdownd_error_t lockdownd_get_device_name(lockdownd_client_t client, char **de | |||
| 578 | * | 578 | * |
| 579 | * @return an error code (LOCKDOWN_E_SUCCESS on success) | 579 | * @return an error code (LOCKDOWN_E_SUCCESS on success) |
| 580 | */ | 580 | */ |
| 581 | lockdownd_error_t lockdownd_client_new(iphone_device_t device, lockdownd_client_t *client, const char *label) | 581 | lockdownd_error_t lockdownd_client_new(idevice_t device, lockdownd_client_t *client, const char *label) |
| 582 | { | 582 | { |
| 583 | if (!client) | 583 | if (!client) |
| 584 | return LOCKDOWN_E_INVALID_ARG; | 584 | return LOCKDOWN_E_INVALID_ARG; |
| @@ -619,7 +619,7 @@ lockdownd_error_t lockdownd_client_new(iphone_device_t device, lockdownd_client_ | |||
| 619 | * | 619 | * |
| 620 | * @return an error code (LOCKDOWN_E_SUCCESS on success) | 620 | * @return an error code (LOCKDOWN_E_SUCCESS on success) |
| 621 | */ | 621 | */ |
| 622 | lockdownd_error_t lockdownd_client_new_with_handshake(iphone_device_t device, lockdownd_client_t *client, const char *label) | 622 | lockdownd_error_t lockdownd_client_new_with_handshake(idevice_t device, lockdownd_client_t *client, const char *label) |
| 623 | { | 623 | { |
| 624 | if (!client) | 624 | if (!client) |
| 625 | return LOCKDOWN_E_INVALID_ARG; | 625 | return LOCKDOWN_E_INVALID_ARG; |
| @@ -644,7 +644,7 @@ lockdownd_error_t lockdownd_client_new_with_handshake(iphone_device_t device, lo | |||
| 644 | free(type); | 644 | free(type); |
| 645 | } | 645 | } |
| 646 | 646 | ||
| 647 | ret = iphone_device_get_uuid(device, &client_loc->uuid); | 647 | ret = idevice_get_uuid(device, &client_loc->uuid); |
| 648 | if (LOCKDOWN_E_SUCCESS != ret) { | 648 | if (LOCKDOWN_E_SUCCESS != ret) { |
| 649 | debug_info("failed to get device uuid."); | 649 | debug_info("failed to get device uuid."); |
| 650 | } | 650 | } |
| @@ -759,7 +759,7 @@ static lockdownd_error_t lockdownd_do_pair(lockdownd_client_t client, lockdownd_ | |||
| 759 | plist_t dict = NULL; | 759 | plist_t dict = NULL; |
| 760 | plist_t dict_record = NULL; | 760 | plist_t dict_record = NULL; |
| 761 | gnutls_datum_t public_key = { NULL, 0 }; | 761 | gnutls_datum_t public_key = { NULL, 0 }; |
| 762 | int pairing_mode = 0; /* 0 = libiphone, 1 = external */ | 762 | int pairing_mode = 0; /* 0 = libimobiledevice, 1 = external */ |
| 763 | 763 | ||
| 764 | if (pair_record && pair_record->host_id) { | 764 | if (pair_record && pair_record->host_id) { |
| 765 | /* valid pair_record passed? */ | 765 | /* valid pair_record passed? */ |
| @@ -780,7 +780,7 @@ static lockdownd_error_t lockdownd_do_pair(lockdownd_client_t client, lockdownd_ | |||
| 780 | return ret; | 780 | return ret; |
| 781 | } | 781 | } |
| 782 | debug_info("device public key follows:\n%s", public_key.data); | 782 | debug_info("device public key follows:\n%s", public_key.data); |
| 783 | /* get libiphone pair_record */ | 783 | /* get libimobiledevice pair_record */ |
| 784 | ret = generate_pair_record_plist(public_key, NULL, &dict_record); | 784 | ret = generate_pair_record_plist(public_key, NULL, &dict_record); |
| 785 | if (ret != LOCKDOWN_E_SUCCESS) { | 785 | if (ret != LOCKDOWN_E_SUCCESS) { |
| 786 | if (dict_record) | 786 | if (dict_record) |
| @@ -795,7 +795,7 @@ static lockdownd_error_t lockdownd_do_pair(lockdownd_client_t client, lockdownd_ | |||
| 795 | plist_dict_insert_item(dict,"PairRecord", dict_record); | 795 | plist_dict_insert_item(dict,"PairRecord", dict_record); |
| 796 | plist_dict_insert_item(dict, "Request", plist_new_string(verb)); | 796 | plist_dict_insert_item(dict, "Request", plist_new_string(verb)); |
| 797 | 797 | ||
| 798 | /* send to iPhone */ | 798 | /* send to device */ |
| 799 | ret = lockdownd_send(client, dict); | 799 | ret = lockdownd_send(client, dict); |
| 800 | plist_free(dict); | 800 | plist_free(dict); |
| 801 | dict = NULL; | 801 | dict = NULL; |
| @@ -803,7 +803,7 @@ static lockdownd_error_t lockdownd_do_pair(lockdownd_client_t client, lockdownd_ | |||
| 803 | if (ret != LOCKDOWN_E_SUCCESS) | 803 | if (ret != LOCKDOWN_E_SUCCESS) |
| 804 | return ret; | 804 | return ret; |
| 805 | 805 | ||
| 806 | /* Now get iPhone's answer */ | 806 | /* Now get device's answer */ |
| 807 | ret = lockdownd_receive(client, &dict); | 807 | ret = lockdownd_receive(client, &dict); |
| 808 | 808 | ||
| 809 | if (ret != LOCKDOWN_E_SUCCESS) | 809 | if (ret != LOCKDOWN_E_SUCCESS) |
| @@ -1116,7 +1116,7 @@ lockdownd_error_t lockdownd_gen_pair_cert(gnutls_datum_t public_key, gnutls_datu | |||
| 1116 | return ret; | 1116 | return ret; |
| 1117 | } | 1117 | } |
| 1118 | 1118 | ||
| 1119 | /** Starts communication with lockdownd after the iPhone has been paired, | 1119 | /** Starts communication with lockdownd after the device has been paired, |
| 1120 | * and if the device requires it, switches to SSL mode. | 1120 | * and if the device requires it, switches to SSL mode. |
| 1121 | * | 1121 | * |
| 1122 | * @param client The lockdownd client | 1122 | * @param client The lockdownd client |
| @@ -1244,7 +1244,7 @@ lockdownd_error_t lockdownd_start_service(lockdownd_client_t client, const char | |||
| 1244 | plist_dict_insert_item(dict,"Request", plist_new_string("StartService")); | 1244 | plist_dict_insert_item(dict,"Request", plist_new_string("StartService")); |
| 1245 | plist_dict_insert_item(dict,"Service", plist_new_string(service)); | 1245 | plist_dict_insert_item(dict,"Service", plist_new_string(service)); |
| 1246 | 1246 | ||
| 1247 | /* send to iPhone */ | 1247 | /* send to device */ |
| 1248 | ret = lockdownd_send(client, dict); | 1248 | ret = lockdownd_send(client, dict); |
| 1249 | plist_free(dict); | 1249 | plist_free(dict); |
| 1250 | dict = NULL; | 1250 | dict = NULL; |
diff --git a/src/lockdown.h b/src/lockdown.h index 82ea01f..f515f7f 100644 --- a/src/lockdown.h +++ b/src/lockdown.h | |||
| @@ -25,7 +25,7 @@ | |||
| 25 | #include <gnutls/gnutls.h> | 25 | #include <gnutls/gnutls.h> |
| 26 | #include <string.h> | 26 | #include <string.h> |
| 27 | 27 | ||
| 28 | #include "libiphone/lockdown.h" | 28 | #include "libimobiledevice/lockdown.h" |
| 29 | #include "property_list_service.h" | 29 | #include "property_list_service.h" |
| 30 | 30 | ||
| 31 | struct lockdownd_client_int { | 31 | 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) | |||
| 59 | return MOBILEBACKUP_E_UNKNOWN_ERROR; | 59 | return MOBILEBACKUP_E_UNKNOWN_ERROR; |
| 60 | } | 60 | } |
| 61 | 61 | ||
| 62 | mobilebackup_error_t mobilebackup_client_new(iphone_device_t device, uint16_t port, | 62 | mobilebackup_error_t mobilebackup_client_new(idevice_t device, uint16_t port, |
| 63 | mobilebackup_client_t * client) | 63 | mobilebackup_client_t * client) |
| 64 | { | 64 | { |
| 65 | if (!device || port == 0 || !client || *client) | 65 | if (!device || port == 0 || !client || *client) |
| @@ -97,7 +97,7 @@ mobilebackup_error_t mobilebackup_client_free(mobilebackup_client_t client) | |||
| 97 | return err; | 97 | return err; |
| 98 | } | 98 | } |
| 99 | 99 | ||
| 100 | /** Polls the iPhone for MobileBackup data. | 100 | /** Polls the device for MobileBackup data. |
| 101 | * | 101 | * |
| 102 | * @param client The MobileBackup client | 102 | * @param client The MobileBackup client |
| 103 | * @param plist A pointer to the location where the plist should be stored | 103 | * @param plist A pointer to the location where the plist should be stored |
| @@ -112,7 +112,7 @@ mobilebackup_error_t mobilebackup_receive(mobilebackup_client_t client, plist_t | |||
| 112 | return ret; | 112 | return ret; |
| 113 | } | 113 | } |
| 114 | 114 | ||
| 115 | /** Sends MobileBackup data to the iPhone | 115 | /** Sends MobileBackup data to the device |
| 116 | * | 116 | * |
| 117 | * @note This function is low-level and should only be used if you need to send | 117 | * @note This function is low-level and should only be used if you need to send |
| 118 | * a new type of message. | 118 | * a new type of message. |
diff --git a/src/mobilebackup.h b/src/mobilebackup.h index 04ebc45..8f58236 100644 --- a/src/mobilebackup.h +++ b/src/mobilebackup.h | |||
| @@ -21,7 +21,7 @@ | |||
| 21 | #ifndef MOBILEBACKUP_H | 21 | #ifndef MOBILEBACKUP_H |
| 22 | #define MOBILEBACKUP_H | 22 | #define MOBILEBACKUP_H |
| 23 | 23 | ||
| 24 | #include "libiphone/mobilebackup.h" | 24 | #include "libimobiledevice/mobilebackup.h" |
| 25 | #include "device_link_service.h" | 25 | #include "device_link_service.h" |
| 26 | 26 | ||
| 27 | struct mobilebackup_client_int { | 27 | 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) | |||
| 59 | return MOBILESYNC_E_UNKNOWN_ERROR; | 59 | return MOBILESYNC_E_UNKNOWN_ERROR; |
| 60 | } | 60 | } |
| 61 | 61 | ||
| 62 | mobilesync_error_t mobilesync_client_new(iphone_device_t device, uint16_t port, | 62 | mobilesync_error_t mobilesync_client_new(idevice_t device, uint16_t port, |
| 63 | mobilesync_client_t * client) | 63 | mobilesync_client_t * client) |
| 64 | { | 64 | { |
| 65 | if (!device || port == 0 || !client || *client) | 65 | if (!device || port == 0 || !client || *client) |
| @@ -97,7 +97,7 @@ mobilesync_error_t mobilesync_client_free(mobilesync_client_t client) | |||
| 97 | return err; | 97 | return err; |
| 98 | } | 98 | } |
| 99 | 99 | ||
| 100 | /** Polls the iPhone for MobileSync data. | 100 | /** Polls the device for MobileSync data. |
| 101 | * | 101 | * |
| 102 | * @param client The MobileSync client | 102 | * @param client The MobileSync client |
| 103 | * @param plist A pointer to the location where the plist should be stored | 103 | * @param plist A pointer to the location where the plist should be stored |
| @@ -112,7 +112,7 @@ mobilesync_error_t mobilesync_receive(mobilesync_client_t client, plist_t * plis | |||
| 112 | return ret; | 112 | return ret; |
| 113 | } | 113 | } |
| 114 | 114 | ||
| 115 | /** Sends MobileSync data to the iPhone | 115 | /** Sends MobileSync data to the device |
| 116 | * | 116 | * |
| 117 | * @note This function is low-level and should only be used if you need to send | 117 | * @note This function is low-level and should only be used if you need to send |
| 118 | * a new type of message. | 118 | * a new type of message. |
diff --git a/src/mobilesync.h b/src/mobilesync.h index e69cb25..defb3f4 100644 --- a/src/mobilesync.h +++ b/src/mobilesync.h | |||
| @@ -21,7 +21,7 @@ | |||
| 21 | #ifndef MOBILESYNC_H | 21 | #ifndef MOBILESYNC_H |
| 22 | #define MOBILESYNC_H | 22 | #define MOBILESYNC_H |
| 23 | 23 | ||
| 24 | #include "libiphone/mobilesync.h" | 24 | #include "libimobiledevice/mobilesync.h" |
| 25 | #include "device_link_service.h" | 25 | #include "device_link_service.h" |
| 26 | 26 | ||
| 27 | struct mobilesync_client_int { | 27 | 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) | |||
| 92 | * or NP_E_CONN_FAILED when the connection to the device could not be | 92 | * or NP_E_CONN_FAILED when the connection to the device could not be |
| 93 | * established. | 93 | * established. |
| 94 | */ | 94 | */ |
| 95 | np_error_t np_client_new(iphone_device_t device, uint16_t port, np_client_t *client) | 95 | np_error_t np_client_new(idevice_t device, uint16_t port, np_client_t *client) |
| 96 | { | 96 | { |
| 97 | /* makes sure thread environment is available */ | 97 | /* makes sure thread environment is available */ |
| 98 | if (!g_thread_supported()) | 98 | if (!g_thread_supported()) |
| @@ -177,7 +177,7 @@ np_error_t np_post_notification(np_client_t client, const char *notification) | |||
| 177 | return res; | 177 | return res; |
| 178 | } | 178 | } |
| 179 | 179 | ||
| 180 | /** Notifies the iphone to send a notification on the specified event. | 180 | /** Notifies the device to send a notification on the specified event. |
| 181 | * | 181 | * |
| 182 | * @param client The client to send to | 182 | * @param client The client to send to |
| 183 | * @param notification The notifications that should be observed. | 183 | * @param notification The notifications that should be observed. |
| @@ -206,7 +206,7 @@ np_error_t np_observe_notification( np_client_t client, const char *notification | |||
| 206 | return res; | 206 | return res; |
| 207 | } | 207 | } |
| 208 | 208 | ||
| 209 | /** Notifies the iphone to send a notification on specified events. | 209 | /** Notifies the device to send a notification on specified events. |
| 210 | * | 210 | * |
| 211 | * @param client The client to send to | 211 | * @param client The client to send to |
| 212 | * @param notification_spec Specification of the notifications that should be | 212 | * @param notification_spec Specification of the notifications that should be |
diff --git a/src/notification_proxy.h b/src/notification_proxy.h index 6ff2cde..6f2dc99 100644 --- a/src/notification_proxy.h +++ b/src/notification_proxy.h | |||
| @@ -23,7 +23,7 @@ | |||
| 23 | 23 | ||
| 24 | #include <glib.h> | 24 | #include <glib.h> |
| 25 | 25 | ||
| 26 | #include "libiphone/notification_proxy.h" | 26 | #include "libimobiledevice/notification_proxy.h" |
| 27 | #include "property_list_service.h" | 27 | #include "property_list_service.h" |
| 28 | 28 | ||
| 29 | struct np_client_int { | 29 | 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 @@ | |||
| 24 | #include <arpa/inet.h> | 24 | #include <arpa/inet.h> |
| 25 | 25 | ||
| 26 | #include "property_list_service.h" | 26 | #include "property_list_service.h" |
| 27 | #include "iphone.h" | 27 | #include "idevice.h" |
| 28 | #include "debug.h" | 28 | #include "debug.h" |
| 29 | 29 | ||
| 30 | /** | 30 | /** |
| 31 | * Convert an iphone_error_t value to an property_list_service_error_t value. | 31 | * Convert an idevice_error_t value to an property_list_service_error_t value. |
| 32 | * Used internally to get correct error codes. | 32 | * Used internally to get correct error codes. |
| 33 | * | 33 | * |
| 34 | * @param err An iphone_error_t error code | 34 | * @param err An idevice_error_t error code |
| 35 | * | 35 | * |
| 36 | * @return A matching property_list_service_error_t error code, | 36 | * @return A matching property_list_service_error_t error code, |
| 37 | * PROPERTY_LIST_SERVICE_E_UNKNOWN_ERROR otherwise. | 37 | * PROPERTY_LIST_SERVICE_E_UNKNOWN_ERROR otherwise. |
| 38 | */ | 38 | */ |
| 39 | static property_list_service_error_t iphone_to_property_list_service_error(iphone_error_t err) | 39 | static property_list_service_error_t idevice_to_property_list_service_error(idevice_error_t err) |
| 40 | { | 40 | { |
| 41 | switch (err) { | 41 | switch (err) { |
| 42 | case IPHONE_E_SUCCESS: | 42 | case IDEVICE_E_SUCCESS: |
| 43 | return PROPERTY_LIST_SERVICE_E_SUCCESS; | 43 | return PROPERTY_LIST_SERVICE_E_SUCCESS; |
| 44 | case IPHONE_E_INVALID_ARG: | 44 | case IDEVICE_E_INVALID_ARG: |
| 45 | return PROPERTY_LIST_SERVICE_E_INVALID_ARG; | 45 | return PROPERTY_LIST_SERVICE_E_INVALID_ARG; |
| 46 | case IPHONE_E_SSL_ERROR: | 46 | case IDEVICE_E_SSL_ERROR: |
| 47 | return PROPERTY_LIST_SERVICE_E_SSL_ERROR; | 47 | return PROPERTY_LIST_SERVICE_E_SSL_ERROR; |
| 48 | default: | 48 | default: |
| 49 | break; | 49 | break; |
| @@ -64,14 +64,14 @@ static property_list_service_error_t iphone_to_property_list_service_error(iphon | |||
| 64 | * PROPERTY_LIST_SERVICE_E_INVALID_ARG when one of the arguments is invalid, | 64 | * PROPERTY_LIST_SERVICE_E_INVALID_ARG when one of the arguments is invalid, |
| 65 | * or PROPERTY_LIST_SERVICE_E_MUX_ERROR when connecting to the device failed. | 65 | * or PROPERTY_LIST_SERVICE_E_MUX_ERROR when connecting to the device failed. |
| 66 | */ | 66 | */ |
| 67 | property_list_service_error_t property_list_service_client_new(iphone_device_t device, uint16_t port, property_list_service_client_t *client) | 67 | property_list_service_error_t property_list_service_client_new(idevice_t device, uint16_t port, property_list_service_client_t *client) |
| 68 | { | 68 | { |
| 69 | if (!device || port == 0 || !client || *client) | 69 | if (!device || port == 0 || !client || *client) |
| 70 | return PROPERTY_LIST_SERVICE_E_INVALID_ARG; | 70 | return PROPERTY_LIST_SERVICE_E_INVALID_ARG; |
| 71 | 71 | ||
| 72 | /* Attempt connection */ | 72 | /* Attempt connection */ |
| 73 | iphone_connection_t connection = NULL; | 73 | idevice_connection_t connection = NULL; |
| 74 | if (iphone_device_connect(device, port, &connection) != IPHONE_E_SUCCESS) { | 74 | if (idevice_connect(device, port, &connection) != IDEVICE_E_SUCCESS) { |
| 75 | return PROPERTY_LIST_SERVICE_E_MUX_ERROR; | 75 | return PROPERTY_LIST_SERVICE_E_MUX_ERROR; |
| 76 | } | 76 | } |
| 77 | 77 | ||
| @@ -98,7 +98,7 @@ property_list_service_error_t property_list_service_client_free(property_list_se | |||
| 98 | if (!client) | 98 | if (!client) |
| 99 | return PROPERTY_LIST_SERVICE_E_INVALID_ARG; | 99 | return PROPERTY_LIST_SERVICE_E_INVALID_ARG; |
| 100 | 100 | ||
| 101 | property_list_service_error_t err = iphone_to_property_list_service_error(iphone_device_disconnect(client->connection)); | 101 | property_list_service_error_t err = idevice_to_property_list_service_error(idevice_disconnect(client->connection)); |
| 102 | free(client); | 102 | free(client); |
| 103 | return err; | 103 | return err; |
| 104 | } | 104 | } |
| @@ -141,9 +141,9 @@ static property_list_service_error_t internal_plist_send(property_list_service_c | |||
| 141 | 141 | ||
| 142 | nlen = htonl(length); | 142 | nlen = htonl(length); |
| 143 | debug_info("sending %d bytes", length); | 143 | debug_info("sending %d bytes", length); |
| 144 | iphone_connection_send(client->connection, (const char*)&nlen, sizeof(nlen), (uint32_t*)&bytes); | 144 | idevice_connection_send(client->connection, (const char*)&nlen, sizeof(nlen), (uint32_t*)&bytes); |
| 145 | if (bytes == sizeof(nlen)) { | 145 | if (bytes == sizeof(nlen)) { |
| 146 | iphone_connection_send(client->connection, content, length, (uint32_t*)&bytes); | 146 | idevice_connection_send(client->connection, content, length, (uint32_t*)&bytes); |
| 147 | if (bytes > 0) { | 147 | if (bytes > 0) { |
| 148 | debug_info("sent %d bytes", bytes); | 148 | debug_info("sent %d bytes", bytes); |
| 149 | debug_plist(plist); | 149 | debug_plist(plist); |
| @@ -221,7 +221,7 @@ static property_list_service_error_t internal_plist_receive_timeout(property_lis | |||
| 221 | return PROPERTY_LIST_SERVICE_E_INVALID_ARG; | 221 | return PROPERTY_LIST_SERVICE_E_INVALID_ARG; |
| 222 | } | 222 | } |
| 223 | 223 | ||
| 224 | iphone_connection_receive_timeout(client->connection, (char*)&pktlen, sizeof(pktlen), &bytes, timeout); | 224 | idevice_connection_receive_timeout(client->connection, (char*)&pktlen, sizeof(pktlen), &bytes, timeout); |
| 225 | debug_info("initial read=%i", bytes); | 225 | debug_info("initial read=%i", bytes); |
| 226 | if (bytes < 4) { | 226 | if (bytes < 4) { |
| 227 | debug_info("initial read failed!"); | 227 | debug_info("initial read failed!"); |
| @@ -235,7 +235,7 @@ static property_list_service_error_t internal_plist_receive_timeout(property_lis | |||
| 235 | content = (char*)malloc(pktlen); | 235 | content = (char*)malloc(pktlen); |
| 236 | 236 | ||
| 237 | while (curlen < pktlen) { | 237 | while (curlen < pktlen) { |
| 238 | iphone_connection_receive(client->connection, content+curlen, pktlen-curlen, &bytes); | 238 | idevice_connection_receive(client->connection, content+curlen, pktlen-curlen, &bytes); |
| 239 | if (bytes <= 0) { | 239 | if (bytes <= 0) { |
| 240 | res = PROPERTY_LIST_SERVICE_E_MUX_ERROR; | 240 | res = PROPERTY_LIST_SERVICE_E_MUX_ERROR; |
| 241 | break; | 241 | break; |
| @@ -324,7 +324,7 @@ property_list_service_error_t property_list_service_enable_ssl(property_list_ser | |||
| 324 | { | 324 | { |
| 325 | if (!client || !client->connection) | 325 | if (!client || !client->connection) |
| 326 | return PROPERTY_LIST_SERVICE_E_INVALID_ARG; | 326 | return PROPERTY_LIST_SERVICE_E_INVALID_ARG; |
| 327 | return iphone_to_property_list_service_error(iphone_connection_enable_ssl(client->connection)); | 327 | return idevice_to_property_list_service_error(idevice_connection_enable_ssl(client->connection)); |
| 328 | } | 328 | } |
| 329 | 329 | ||
| 330 | /** | 330 | /** |
| @@ -341,6 +341,6 @@ property_list_service_error_t property_list_service_disable_ssl(property_list_se | |||
| 341 | { | 341 | { |
| 342 | if (!client || !client->connection) | 342 | if (!client || !client->connection) |
| 343 | return PROPERTY_LIST_SERVICE_E_INVALID_ARG; | 343 | return PROPERTY_LIST_SERVICE_E_INVALID_ARG; |
| 344 | return iphone_to_property_list_service_error(iphone_connection_disable_ssl(client->connection)); | 344 | return idevice_to_property_list_service_error(idevice_connection_disable_ssl(client->connection)); |
| 345 | } | 345 | } |
| 346 | 346 | ||
diff --git a/src/property_list_service.h b/src/property_list_service.h index bc3122b..70d8793 100644 --- a/src/property_list_service.h +++ b/src/property_list_service.h | |||
| @@ -21,7 +21,7 @@ | |||
| 21 | #ifndef PROPERTY_LIST_SERVICE_H | 21 | #ifndef PROPERTY_LIST_SERVICE_H |
| 22 | #define PROPERTY_LIST_SERVICE_H | 22 | #define PROPERTY_LIST_SERVICE_H |
| 23 | 23 | ||
| 24 | #include "iphone.h" | 24 | #include "idevice.h" |
| 25 | 25 | ||
| 26 | /* Error Codes */ | 26 | /* Error Codes */ |
| 27 | #define PROPERTY_LIST_SERVICE_E_SUCCESS 0 | 27 | #define PROPERTY_LIST_SERVICE_E_SUCCESS 0 |
| @@ -33,7 +33,7 @@ | |||
| 33 | #define PROPERTY_LIST_SERVICE_E_UNKNOWN_ERROR -256 | 33 | #define PROPERTY_LIST_SERVICE_E_UNKNOWN_ERROR -256 |
| 34 | 34 | ||
| 35 | struct property_list_service_client_int { | 35 | struct property_list_service_client_int { |
| 36 | iphone_connection_t connection; | 36 | idevice_connection_t connection; |
| 37 | }; | 37 | }; |
| 38 | 38 | ||
| 39 | typedef struct property_list_service_client_int *property_list_service_client_t; | 39 | 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; | |||
| 41 | typedef int16_t property_list_service_error_t; | 41 | typedef int16_t property_list_service_error_t; |
| 42 | 42 | ||
| 43 | /* creation and destruction */ | 43 | /* creation and destruction */ |
| 44 | property_list_service_error_t property_list_service_client_new(iphone_device_t device, uint16_t port, property_list_service_client_t *client); | 44 | property_list_service_error_t property_list_service_client_new(idevice_t device, uint16_t port, property_list_service_client_t *client); |
| 45 | property_list_service_error_t property_list_service_client_free(property_list_service_client_t client); | 45 | property_list_service_error_t property_list_service_client_free(property_list_service_client_t client); |
| 46 | 46 | ||
| 47 | /* sending */ | 47 | /* sending */ |
diff --git a/src/sbservices.c b/src/sbservices.c index 2254c64..8cf8b26 100644 --- a/src/sbservices.c +++ b/src/sbservices.c | |||
| @@ -86,7 +86,7 @@ static sbservices_error_t sbservices_error(property_list_service_error_t err) | |||
| 86 | * @return SBSERVICES_E_SUCCESS on success, SBSERVICES_E_INVALID_ARG when | 86 | * @return SBSERVICES_E_SUCCESS on success, SBSERVICES_E_INVALID_ARG when |
| 87 | * client is NULL, or an SBSERVICES_E_* error code otherwise. | 87 | * client is NULL, or an SBSERVICES_E_* error code otherwise. |
| 88 | */ | 88 | */ |
| 89 | sbservices_error_t sbservices_client_new(iphone_device_t device, uint16_t port, sbservices_client_t *client) | 89 | sbservices_error_t sbservices_client_new(idevice_t device, uint16_t port, sbservices_client_t *client) |
| 90 | { | 90 | { |
| 91 | /* makes sure thread environment is available */ | 91 | /* makes sure thread environment is available */ |
| 92 | if (!g_thread_supported()) | 92 | if (!g_thread_supported()) |
diff --git a/src/sbservices.h b/src/sbservices.h index 5c95eaf..4ade579 100644 --- a/src/sbservices.h +++ b/src/sbservices.h | |||
| @@ -23,7 +23,7 @@ | |||
| 23 | 23 | ||
| 24 | #include <glib.h> | 24 | #include <glib.h> |
| 25 | 25 | ||
| 26 | #include "libiphone/sbservices.h" | 26 | #include "libimobiledevice/sbservices.h" |
| 27 | #include "property_list_service.h" | 27 | #include "property_list_service.h" |
| 28 | 28 | ||
| 29 | struct sbservices_client_int { | 29 | 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 @@ | |||
| 33 | #include "userpref.h" | 33 | #include "userpref.h" |
| 34 | #include "debug.h" | 34 | #include "debug.h" |
| 35 | 35 | ||
| 36 | #define LIBIPHONE_CONF_DIR "libiphone" | 36 | #define LIBIMOBILEDEVICE_CONF_DIR "libimobiledevice" |
| 37 | #define LIBIPHONE_CONF_FILE "libiphonerc" | 37 | #define LIBIMOBILEDEVICE_CONF_FILE "libimobiledevicerc" |
| 38 | 38 | ||
| 39 | #define LIBIPHONE_ROOT_PRIVKEY "RootPrivateKey.pem" | 39 | #define LIBIMOBILEDEVICE_ROOT_PRIVKEY "RootPrivateKey.pem" |
| 40 | #define LIBIPHONE_HOST_PRIVKEY "HostPrivateKey.pem" | 40 | #define LIBIMOBILEDEVICE_HOST_PRIVKEY "HostPrivateKey.pem" |
| 41 | #define LIBIPHONE_ROOT_CERTIF "RootCertificate.pem" | 41 | #define LIBIMOBILEDEVICE_ROOT_CERTIF "RootCertificate.pem" |
| 42 | #define LIBIPHONE_HOST_CERTIF "HostCertificate.pem" | 42 | #define LIBIMOBILEDEVICE_HOST_CERTIF "HostCertificate.pem" |
| 43 | 43 | ||
| 44 | 44 | ||
| 45 | /** Creates a freedesktop compatible configuration directory for libiphone. | 45 | /** Creates a freedesktop compatible configuration directory. |
| 46 | */ | 46 | */ |
| 47 | static void userpref_create_config_dir(void) | 47 | static void userpref_create_config_dir(void) |
| 48 | { | 48 | { |
| 49 | gchar *config_dir = g_build_path(G_DIR_SEPARATOR_S, g_get_user_config_dir(), LIBIPHONE_CONF_DIR, NULL); | 49 | gchar *config_dir = g_build_path(G_DIR_SEPARATOR_S, g_get_user_config_dir(), LIBIMOBILEDEVICE_CONF_DIR, NULL); |
| 50 | 50 | ||
| 51 | if (!g_file_test(config_dir, (G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR))) | 51 | if (!g_file_test(config_dir, (G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR))) |
| 52 | g_mkdir_with_parents(config_dir, 0755); | 52 | g_mkdir_with_parents(config_dir, 0755); |
| @@ -112,7 +112,7 @@ static int userpref_set_host_id(const char *host_id) | |||
| 112 | /* Write config file on disk */ | 112 | /* Write config file on disk */ |
| 113 | buf = g_key_file_to_data(key_file, &length, NULL); | 113 | buf = g_key_file_to_data(key_file, &length, NULL); |
| 114 | config_file = | 114 | config_file = |
| 115 | g_build_path(G_DIR_SEPARATOR_S, g_get_user_config_dir(), LIBIPHONE_CONF_DIR, LIBIPHONE_CONF_FILE, NULL); | 115 | g_build_path(G_DIR_SEPARATOR_S, g_get_user_config_dir(), LIBIMOBILEDEVICE_CONF_DIR, LIBIMOBILEDEVICE_CONF_FILE, NULL); |
| 116 | file = g_io_channel_new_file(config_file, "w", NULL); | 116 | file = g_io_channel_new_file(config_file, "w", NULL); |
| 117 | g_free(config_file); | 117 | g_free(config_file); |
| 118 | g_io_channel_write_chars(file, buf, length, NULL, NULL); | 118 | g_io_channel_write_chars(file, buf, length, NULL, NULL); |
| @@ -136,7 +136,7 @@ void userpref_get_host_id(char **host_id) | |||
| 136 | gchar *loc_host_id; | 136 | gchar *loc_host_id; |
| 137 | 137 | ||
| 138 | config_file = | 138 | config_file = |
| 139 | g_build_path(G_DIR_SEPARATOR_S, g_get_user_config_dir(), LIBIPHONE_CONF_DIR, LIBIPHONE_CONF_FILE, NULL); | 139 | g_build_path(G_DIR_SEPARATOR_S, g_get_user_config_dir(), LIBIMOBILEDEVICE_CONF_DIR, LIBIMOBILEDEVICE_CONF_FILE, NULL); |
| 140 | 140 | ||
| 141 | /* now parse file to get the HostID */ | 141 | /* now parse file to get the HostID */ |
| 142 | key_file = g_key_file_new(); | 142 | key_file = g_key_file_new(); |
| @@ -158,11 +158,11 @@ void userpref_get_host_id(char **host_id) | |||
| 158 | debug_info("Using %s as HostID", *host_id); | 158 | debug_info("Using %s as HostID", *host_id); |
| 159 | } | 159 | } |
| 160 | 160 | ||
| 161 | /** Determines whether this iPhone has been connected to this system before. | 161 | /** Determines whether this device has been connected to this system before. |
| 162 | * | 162 | * |
| 163 | * @param uid The device uid as given by the iPhone. | 163 | * @param uid The device uid as given by the device. |
| 164 | * | 164 | * |
| 165 | * @return 1 if the iPhone has been connected previously to this configuration | 165 | * @return 1 if the device has been connected previously to this configuration |
| 166 | * or 0 otherwise. | 166 | * or 0 otherwise. |
| 167 | */ | 167 | */ |
| 168 | int userpref_has_device_public_key(const char *uuid) | 168 | int userpref_has_device_public_key(const char *uuid) |
| @@ -172,7 +172,7 @@ int userpref_has_device_public_key(const char *uuid) | |||
| 172 | 172 | ||
| 173 | /* first get config file */ | 173 | /* first get config file */ |
| 174 | gchar *device_file = g_strconcat(uuid, ".pem", NULL); | 174 | gchar *device_file = g_strconcat(uuid, ".pem", NULL); |
| 175 | config_file = g_build_path(G_DIR_SEPARATOR_S, g_get_user_config_dir(), LIBIPHONE_CONF_DIR, device_file, NULL); | 175 | config_file = g_build_path(G_DIR_SEPARATOR_S, g_get_user_config_dir(), LIBIMOBILEDEVICE_CONF_DIR, device_file, NULL); |
| 176 | if (g_file_test(config_file, (G_FILE_TEST_EXISTS | G_FILE_TEST_IS_REGULAR))) | 176 | if (g_file_test(config_file, (G_FILE_TEST_EXISTS | G_FILE_TEST_IS_REGULAR))) |
| 177 | ret = 1; | 177 | ret = 1; |
| 178 | g_free(config_file); | 178 | g_free(config_file); |
| @@ -180,10 +180,10 @@ int userpref_has_device_public_key(const char *uuid) | |||
| 180 | return ret; | 180 | return ret; |
| 181 | } | 181 | } |
| 182 | 182 | ||
| 183 | /** Mark the iPhone (as represented by the key) as having connected to this | 183 | /** Mark the device (as represented by the key) as having connected to this |
| 184 | * configuration. | 184 | * configuration. |
| 185 | * | 185 | * |
| 186 | * @param public_key The public key given by the iPhone | 186 | * @param public_key The public key given by the device |
| 187 | * | 187 | * |
| 188 | * @return 1 on success and 0 if no public key is given or if it has already | 188 | * @return 1 on success and 0 if no public key is given or if it has already |
| 189 | * been marked as connected previously. | 189 | * been marked as connected previously. |
| @@ -201,7 +201,7 @@ userpref_error_t userpref_set_device_public_key(const char *uuid, gnutls_datum_t | |||
| 201 | 201 | ||
| 202 | /* build file path */ | 202 | /* build file path */ |
| 203 | gchar *device_file = g_strconcat(uuid, ".pem", NULL); | 203 | gchar *device_file = g_strconcat(uuid, ".pem", NULL); |
| 204 | gchar *pem = g_build_path(G_DIR_SEPARATOR_S, g_get_user_config_dir(), LIBIPHONE_CONF_DIR, device_file, NULL); | 204 | gchar *pem = g_build_path(G_DIR_SEPARATOR_S, g_get_user_config_dir(), LIBIMOBILEDEVICE_CONF_DIR, device_file, NULL); |
| 205 | 205 | ||
| 206 | /* store file */ | 206 | /* store file */ |
| 207 | FILE *pFile = fopen(pem, "wb"); | 207 | FILE *pFile = fopen(pem, "wb"); |
| @@ -226,7 +226,7 @@ userpref_error_t userpref_remove_device_public_key(const char *uuid) | |||
| 226 | 226 | ||
| 227 | /* build file path */ | 227 | /* build file path */ |
| 228 | gchar *device_file = g_strconcat(uuid, ".pem", NULL); | 228 | gchar *device_file = g_strconcat(uuid, ".pem", NULL); |
| 229 | gchar *pem = g_build_path(G_DIR_SEPARATOR_S, g_get_user_config_dir(), LIBIPHONE_CONF_DIR, device_file, NULL); | 229 | gchar *pem = g_build_path(G_DIR_SEPARATOR_S, g_get_user_config_dir(), LIBIMOBILEDEVICE_CONF_DIR, device_file, NULL); |
| 230 | 230 | ||
| 231 | /* remove file */ | 231 | /* remove file */ |
| 232 | g_remove(pem); | 232 | g_remove(pem); |
| @@ -255,7 +255,7 @@ static int userpref_get_file_contents(const char *file, gnutls_datum_t * data) | |||
| 255 | return 0; | 255 | return 0; |
| 256 | 256 | ||
| 257 | /* Read file */ | 257 | /* Read file */ |
| 258 | filepath = g_build_path(G_DIR_SEPARATOR_S, g_get_user_config_dir(), LIBIPHONE_CONF_DIR, file, NULL); | 258 | filepath = g_build_path(G_DIR_SEPARATOR_S, g_get_user_config_dir(), LIBIMOBILEDEVICE_CONF_DIR, file, NULL); |
| 259 | success = g_file_get_contents(filepath, &content, &size, NULL); | 259 | success = g_file_get_contents(filepath, &content, &size, NULL); |
| 260 | g_free(filepath); | 260 | g_free(filepath); |
| 261 | 261 | ||
| @@ -392,7 +392,7 @@ static userpref_error_t userpref_import_key(const char* key_name, gnutls_x509_pr | |||
| 392 | * @param crt_name The filename of the certificate to import. | 392 | * @param crt_name The filename of the certificate to import. |
| 393 | * @param cert the gnutls certificate structure. | 393 | * @param cert the gnutls certificate structure. |
| 394 | * | 394 | * |
| 395 | * @return IPHONE_E_SUCCESS if the certificate was successfully imported. | 395 | * @return IDEVICE_E_SUCCESS if the certificate was successfully imported. |
| 396 | */ | 396 | */ |
| 397 | static userpref_error_t userpref_import_crt(const char* crt_name, gnutls_x509_crt_t cert) | 397 | static userpref_error_t userpref_import_crt(const char* crt_name, gnutls_x509_crt_t cert) |
| 398 | { | 398 | { |
| @@ -426,16 +426,16 @@ userpref_error_t userpref_get_keys_and_certs(gnutls_x509_privkey_t root_privkey, | |||
| 426 | userpref_error_t ret = USERPREF_E_SUCCESS; | 426 | userpref_error_t ret = USERPREF_E_SUCCESS; |
| 427 | 427 | ||
| 428 | if (ret == USERPREF_E_SUCCESS) | 428 | if (ret == USERPREF_E_SUCCESS) |
| 429 | ret = userpref_import_key(LIBIPHONE_ROOT_PRIVKEY, root_privkey); | 429 | ret = userpref_import_key(LIBIMOBILEDEVICE_ROOT_PRIVKEY, root_privkey); |
| 430 | 430 | ||
| 431 | if (ret == USERPREF_E_SUCCESS) | 431 | if (ret == USERPREF_E_SUCCESS) |
| 432 | ret = userpref_import_key(LIBIPHONE_HOST_PRIVKEY, host_privkey); | 432 | ret = userpref_import_key(LIBIMOBILEDEVICE_HOST_PRIVKEY, host_privkey); |
| 433 | 433 | ||
| 434 | if (ret == USERPREF_E_SUCCESS) | 434 | if (ret == USERPREF_E_SUCCESS) |
| 435 | ret = userpref_import_crt(LIBIPHONE_ROOT_CERTIF, root_crt); | 435 | ret = userpref_import_crt(LIBIMOBILEDEVICE_ROOT_CERTIF, root_crt); |
| 436 | 436 | ||
| 437 | if (ret == USERPREF_E_SUCCESS) | 437 | if (ret == USERPREF_E_SUCCESS) |
| 438 | ret = userpref_import_crt(LIBIPHONE_HOST_CERTIF, host_crt); | 438 | ret = userpref_import_crt(LIBIMOBILEDEVICE_HOST_CERTIF, host_crt); |
| 439 | 439 | ||
| 440 | 440 | ||
| 441 | if (USERPREF_E_SUCCESS != ret) { | 441 | if (USERPREF_E_SUCCESS != ret) { |
| @@ -444,16 +444,16 @@ userpref_error_t userpref_get_keys_and_certs(gnutls_x509_privkey_t root_privkey, | |||
| 444 | ret = userpref_gen_keys_and_cert(); | 444 | ret = userpref_gen_keys_and_cert(); |
| 445 | 445 | ||
| 446 | if (ret == USERPREF_E_SUCCESS) | 446 | if (ret == USERPREF_E_SUCCESS) |
| 447 | ret = userpref_import_key(LIBIPHONE_ROOT_PRIVKEY, root_privkey); | 447 | ret = userpref_import_key(LIBIMOBILEDEVICE_ROOT_PRIVKEY, root_privkey); |
| 448 | 448 | ||
| 449 | if (ret == USERPREF_E_SUCCESS) | 449 | if (ret == USERPREF_E_SUCCESS) |
| 450 | ret = userpref_import_key(LIBIPHONE_HOST_PRIVKEY, host_privkey); | 450 | ret = userpref_import_key(LIBIMOBILEDEVICE_HOST_PRIVKEY, host_privkey); |
| 451 | 451 | ||
| 452 | if (ret == USERPREF_E_SUCCESS) | 452 | if (ret == USERPREF_E_SUCCESS) |
| 453 | ret = userpref_import_crt(LIBIPHONE_ROOT_CERTIF, root_crt); | 453 | ret = userpref_import_crt(LIBIMOBILEDEVICE_ROOT_CERTIF, root_crt); |
| 454 | 454 | ||
| 455 | if (ret == USERPREF_E_SUCCESS) | 455 | if (ret == USERPREF_E_SUCCESS) |
| 456 | ret = userpref_import_crt(LIBIPHONE_HOST_CERTIF, host_crt); | 456 | ret = userpref_import_crt(LIBIMOBILEDEVICE_HOST_CERTIF, host_crt); |
| 457 | } | 457 | } |
| 458 | 458 | ||
| 459 | return ret; | 459 | return ret; |
| @@ -471,7 +471,7 @@ userpref_error_t userpref_get_certs_as_pem(gnutls_datum_t *pem_root_cert, gnutls | |||
| 471 | if (!pem_root_cert || !pem_host_cert) | 471 | if (!pem_root_cert || !pem_host_cert) |
| 472 | return USERPREF_E_INVALID_ARG; | 472 | return USERPREF_E_INVALID_ARG; |
| 473 | 473 | ||
| 474 | if (userpref_get_file_contents(LIBIPHONE_ROOT_CERTIF, pem_root_cert) && userpref_get_file_contents(LIBIPHONE_HOST_CERTIF, pem_host_cert)) | 474 | if (userpref_get_file_contents(LIBIMOBILEDEVICE_ROOT_CERTIF, pem_root_cert) && userpref_get_file_contents(LIBIMOBILEDEVICE_HOST_CERTIF, pem_host_cert)) |
| 475 | return USERPREF_E_SUCCESS; | 475 | return USERPREF_E_SUCCESS; |
| 476 | else { | 476 | else { |
| 477 | g_free(pem_root_cert->data); | 477 | g_free(pem_root_cert->data); |
| @@ -503,25 +503,25 @@ userpref_error_t userpref_set_keys_and_certs(gnutls_datum_t * root_key, gnutls_d | |||
| 503 | userpref_create_config_dir(); | 503 | userpref_create_config_dir(); |
| 504 | 504 | ||
| 505 | /* Now write keys and certificates to disk */ | 505 | /* Now write keys and certificates to disk */ |
| 506 | pem = g_build_path(G_DIR_SEPARATOR_S, g_get_user_config_dir(), LIBIPHONE_CONF_DIR, LIBIPHONE_ROOT_PRIVKEY, NULL); | 506 | pem = g_build_path(G_DIR_SEPARATOR_S, g_get_user_config_dir(), LIBIMOBILEDEVICE_CONF_DIR, LIBIMOBILEDEVICE_ROOT_PRIVKEY, NULL); |
| 507 | pFile = fopen(pem, "wb"); | 507 | pFile = fopen(pem, "wb"); |
| 508 | fwrite(root_key->data, 1, root_key->size, pFile); | 508 | fwrite(root_key->data, 1, root_key->size, pFile); |
| 509 | fclose(pFile); | 509 | fclose(pFile); |
| 510 | g_free(pem); | 510 | g_free(pem); |
| 511 | 511 | ||
| 512 | pem = g_build_path(G_DIR_SEPARATOR_S, g_get_user_config_dir(), LIBIPHONE_CONF_DIR, LIBIPHONE_HOST_PRIVKEY, NULL); | 512 | pem = g_build_path(G_DIR_SEPARATOR_S, g_get_user_config_dir(), LIBIMOBILEDEVICE_CONF_DIR, LIBIMOBILEDEVICE_HOST_PRIVKEY, NULL); |
| 513 | pFile = fopen(pem, "wb"); | 513 | pFile = fopen(pem, "wb"); |
| 514 | fwrite(host_key->data, 1, host_key->size, pFile); | 514 | fwrite(host_key->data, 1, host_key->size, pFile); |
| 515 | fclose(pFile); | 515 | fclose(pFile); |
| 516 | g_free(pem); | 516 | g_free(pem); |
| 517 | 517 | ||
| 518 | pem = g_build_path(G_DIR_SEPARATOR_S, g_get_user_config_dir(), LIBIPHONE_CONF_DIR, LIBIPHONE_ROOT_CERTIF, NULL); | 518 | pem = g_build_path(G_DIR_SEPARATOR_S, g_get_user_config_dir(), LIBIMOBILEDEVICE_CONF_DIR, LIBIMOBILEDEVICE_ROOT_CERTIF, NULL); |
| 519 | pFile = fopen(pem, "wb"); | 519 | pFile = fopen(pem, "wb"); |
| 520 | fwrite(root_cert->data, 1, root_cert->size, pFile); | 520 | fwrite(root_cert->data, 1, root_cert->size, pFile); |
| 521 | fclose(pFile); | 521 | fclose(pFile); |
| 522 | g_free(pem); | 522 | g_free(pem); |
| 523 | 523 | ||
| 524 | pem = g_build_path(G_DIR_SEPARATOR_S, g_get_user_config_dir(), LIBIPHONE_CONF_DIR, LIBIPHONE_HOST_CERTIF, NULL); | 524 | pem = g_build_path(G_DIR_SEPARATOR_S, g_get_user_config_dir(), LIBIMOBILEDEVICE_CONF_DIR, LIBIMOBILEDEVICE_HOST_CERTIF, NULL); |
| 525 | pFile = fopen(pem, "wb"); | 525 | pFile = fopen(pem, "wb"); |
| 526 | fwrite(host_cert->data, 1, host_cert->size, pFile); | 526 | fwrite(host_cert->data, 1, host_cert->size, pFile); |
| 527 | fclose(pFile); | 527 | fclose(pFile); |
