summaryrefslogtreecommitdiffstats
path: root/src/afc.c
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2010-01-28 22:18:41 +0100
committerGravatar Martin Szulecki2010-01-29 02:16:00 +0100
commit96101a1231a4ddfeb40fd738a24e108a3a904048 (patch)
tree65a8f54354d9acbbba93dac2c8602d07e469482c /src/afc.c
parent45b88ae3956de089fdc35605910f1359a1d3961c (diff)
downloadlibimobiledevice-96101a1231a4ddfeb40fd738a24e108a3a904048.tar.gz
libimobiledevice-96101a1231a4ddfeb40fd738a24e108a3a904048.tar.bz2
Global renames due to project rename to libimobiledevice
Diffstat (limited to 'src/afc.c')
-rw-r--r--src/afc.c34
1 files changed, 17 insertions, 17 deletions
diff --git a/src/afc.c b/src/afc.c
index 767e460..4367add 100644
--- a/src/afc.c
+++ b/src/afc.c
@@ -24,7 +24,7 @@
24#include <unistd.h> 24#include <unistd.h>
25 25
26#include "afc.h" 26#include "afc.h"
27#include "iphone.h" 27#include "idevice.h"
28#include "debug.h" 28#include "debug.h"
29 29
30// This is the maximum size an AFC data packet can be 30// This is the maximum size an AFC data packet can be
@@ -61,7 +61,7 @@ static void afc_unlock(afc_client_t client)
61 * is invalid, AFC_E_MUX_ERROR when the connection failed, or AFC_E_NO_MEM 61 * is invalid, AFC_E_MUX_ERROR when the connection failed, or AFC_E_NO_MEM
62 * when there's a memory allocation problem. 62 * when there's a memory allocation problem.
63 */ 63 */
64afc_error_t afc_client_new(iphone_device_t device, uint16_t port, afc_client_t * client) 64afc_error_t afc_client_new(idevice_t device, uint16_t port, afc_client_t * client)
65{ 65{
66 /* makes sure thread environment is available */ 66 /* makes sure thread environment is available */
67 if (!g_thread_supported()) 67 if (!g_thread_supported())
@@ -71,8 +71,8 @@ afc_error_t afc_client_new(iphone_device_t device, uint16_t port, afc_client_t *
71 return AFC_E_INVALID_ARGUMENT; 71 return AFC_E_INVALID_ARGUMENT;
72 72
73 /* attempt connection */ 73 /* attempt connection */
74 iphone_connection_t connection = NULL; 74 idevice_connection_t connection = NULL;
75 if (iphone_device_connect(device, port, &connection) != IPHONE_E_SUCCESS) { 75 if (idevice_connect(device, port, &connection) != IDEVICE_E_SUCCESS) {
76 return AFC_E_MUX_ERROR; 76 return AFC_E_MUX_ERROR;
77 } 77 }
78 78
@@ -82,7 +82,7 @@ afc_error_t afc_client_new(iphone_device_t device, uint16_t port, afc_client_t *
82 /* allocate a packet */ 82 /* allocate a packet */
83 client_loc->afc_packet = (AFCPacket *) malloc(sizeof(AFCPacket)); 83 client_loc->afc_packet = (AFCPacket *) malloc(sizeof(AFCPacket));
84 if (!client_loc->afc_packet) { 84 if (!client_loc->afc_packet) {
85 iphone_device_disconnect(client_loc->connection); 85 idevice_disconnect(client_loc->connection);
86 free(client_loc); 86 free(client_loc);
87 return AFC_E_NO_MEM; 87 return AFC_E_NO_MEM;
88 } 88 }
@@ -108,7 +108,7 @@ afc_error_t afc_client_free(afc_client_t client)
108 if (!client || !client->connection || !client->afc_packet) 108 if (!client || !client->connection || !client->afc_packet)
109 return AFC_E_INVALID_ARGUMENT; 109 return AFC_E_INVALID_ARGUMENT;
110 110
111 iphone_device_disconnect(client->connection); 111 idevice_disconnect(client->connection);
112 free(client->afc_packet); 112 free(client->afc_packet);
113 if (client->mutex) { 113 if (client->mutex) {
114 g_mutex_free(client->mutex); 114 g_mutex_free(client->mutex);
@@ -169,7 +169,7 @@ static afc_error_t afc_dispatch_packet(afc_client_t client, const char *data, ui
169 /* send AFC packet header */ 169 /* send AFC packet header */
170 AFCPacket_to_LE(client->afc_packet); 170 AFCPacket_to_LE(client->afc_packet);
171 sent = 0; 171 sent = 0;
172 iphone_connection_send(client->connection, (void*)client->afc_packet, sizeof(AFCPacket), &sent); 172 idevice_connection_send(client->connection, (void*)client->afc_packet, sizeof(AFCPacket), &sent);
173 if (sent == 0) { 173 if (sent == 0) {
174 /* FIXME: should this be handled as success?! */ 174 /* FIXME: should this be handled as success?! */
175 return AFC_E_SUCCESS; 175 return AFC_E_SUCCESS;
@@ -178,7 +178,7 @@ static afc_error_t afc_dispatch_packet(afc_client_t client, const char *data, ui
178 178
179 /* send AFC packet data */ 179 /* send AFC packet data */
180 sent = 0; 180 sent = 0;
181 iphone_connection_send(client->connection, data, offset, &sent); 181 idevice_connection_send(client->connection, data, offset, &sent);
182 if (sent == 0) { 182 if (sent == 0) {
183 return AFC_E_SUCCESS; 183 return AFC_E_SUCCESS;
184 } 184 }
@@ -190,7 +190,7 @@ static afc_error_t afc_dispatch_packet(afc_client_t client, const char *data, ui
190 debug_buffer(data + offset, length - offset); 190 debug_buffer(data + offset, length - offset);
191 191
192 sent = 0; 192 sent = 0;
193 iphone_connection_send(client->connection, data + offset, length - offset, &sent); 193 idevice_connection_send(client->connection, data + offset, length - offset, &sent);
194 194
195 *bytes_sent = sent; 195 *bytes_sent = sent;
196 return AFC_E_SUCCESS; 196 return AFC_E_SUCCESS;
@@ -203,7 +203,7 @@ static afc_error_t afc_dispatch_packet(afc_client_t client, const char *data, ui
203 /* send AFC packet header */ 203 /* send AFC packet header */
204 AFCPacket_to_LE(client->afc_packet); 204 AFCPacket_to_LE(client->afc_packet);
205 sent = 0; 205 sent = 0;
206 iphone_connection_send(client->connection, (void*)client->afc_packet, sizeof(AFCPacket), &sent); 206 idevice_connection_send(client->connection, (void*)client->afc_packet, sizeof(AFCPacket), &sent);
207 if (sent == 0) { 207 if (sent == 0) {
208 return AFC_E_SUCCESS; 208 return AFC_E_SUCCESS;
209 } 209 }
@@ -213,7 +213,7 @@ static afc_error_t afc_dispatch_packet(afc_client_t client, const char *data, ui
213 debug_info("packet data follows"); 213 debug_info("packet data follows");
214 214
215 debug_buffer(data, length); 215 debug_buffer(data, length);
216 iphone_connection_send(client->connection, data, length, &sent); 216 idevice_connection_send(client->connection, data, length, &sent);
217 *bytes_sent += sent; 217 *bytes_sent += sent;
218 } 218 }
219 return AFC_E_SUCCESS; 219 return AFC_E_SUCCESS;
@@ -241,7 +241,7 @@ static afc_error_t afc_receive_data(afc_client_t client, char **dump_here, uint3
241 *bytes_recv = 0; 241 *bytes_recv = 0;
242 242
243 /* first, read the AFC header */ 243 /* first, read the AFC header */
244 iphone_connection_receive(client->connection, (char*)&header, sizeof(AFCPacket), bytes_recv); 244 idevice_connection_receive(client->connection, (char*)&header, sizeof(AFCPacket), bytes_recv);
245 AFCPacket_from_LE(&header); 245 AFCPacket_from_LE(&header);
246 if (*bytes_recv == 0) { 246 if (*bytes_recv == 0) {
247 debug_info("Just didn't get enough."); 247 debug_info("Just didn't get enough.");
@@ -295,7 +295,7 @@ static afc_error_t afc_receive_data(afc_client_t client, char **dump_here, uint3
295 295
296 *dump_here = (char*)malloc(entire_len); 296 *dump_here = (char*)malloc(entire_len);
297 if (this_len > 0) { 297 if (this_len > 0) {
298 iphone_connection_receive(client->connection, *dump_here, this_len, bytes_recv); 298 idevice_connection_receive(client->connection, *dump_here, this_len, bytes_recv);
299 if (*bytes_recv <= 0) { 299 if (*bytes_recv <= 0) {
300 free(*dump_here); 300 free(*dump_here);
301 *dump_here = NULL; 301 *dump_here = NULL;
@@ -313,7 +313,7 @@ static afc_error_t afc_receive_data(afc_client_t client, char **dump_here, uint3
313 313
314 if (entire_len > this_len) { 314 if (entire_len > this_len) {
315 while (current_count < entire_len) { 315 while (current_count < entire_len) {
316 iphone_connection_receive(client->connection, (*dump_here)+current_count, entire_len - current_count, bytes_recv); 316 idevice_connection_receive(client->connection, (*dump_here)+current_count, entire_len - current_count, bytes_recv);
317 if (*bytes_recv <= 0) { 317 if (*bytes_recv <= 0) {
318 debug_info("Error receiving data (recv returned %d)", *bytes_recv); 318 debug_info("Error receiving data (recv returned %d)", *bytes_recv);
319 break; 319 break;
@@ -701,7 +701,7 @@ afc_error_t afc_get_file_info(afc_client_t client, const char *path, char ***inf
701 * 701 *
702 * @return AFC_E_SUCCESS on success or an AFC_E_* error on failure. 702 * @return AFC_E_SUCCESS on success or an AFC_E_* error on failure.
703 */ 703 */
704iphone_error_t 704idevice_error_t
705afc_file_open(afc_client_t client, const char *filename, 705afc_file_open(afc_client_t client, const char *filename,
706 afc_file_mode_t file_mode, uint64_t *handle) 706 afc_file_mode_t file_mode, uint64_t *handle)
707{ 707{
@@ -760,7 +760,7 @@ afc_file_open(afc_client_t client, const char *filename,
760 * 760 *
761 * @return AFC_E_SUCCESS on success or an AFC_E_* error value on error. 761 * @return AFC_E_SUCCESS on success or an AFC_E_* error value on error.
762 */ 762 */
763iphone_error_t 763idevice_error_t
764afc_file_read(afc_client_t client, uint64_t handle, char *data, uint32_t length, uint32_t *bytes_read) 764afc_file_read(afc_client_t client, uint64_t handle, char *data, uint32_t length, uint32_t *bytes_read)
765{ 765{
766 char *input = NULL; 766 char *input = NULL;
@@ -833,7 +833,7 @@ afc_file_read(afc_client_t client, uint64_t handle, char *data, uint32_t length,
833 * 833 *
834 * @return AFC_E_SUCCESS on success, or an AFC_E_* error value on error. 834 * @return AFC_E_SUCCESS on success, or an AFC_E_* error value on error.
835 */ 835 */
836iphone_error_t 836idevice_error_t
837afc_file_write(afc_client_t client, uint64_t handle, const char *data, uint32_t length, uint32_t *bytes_written) 837afc_file_write(afc_client_t client, uint64_t handle, const char *data, uint32_t length, uint32_t *bytes_written)
838{ 838{
839 char *acknowledgement = NULL; 839 char *acknowledgement = NULL;