summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGravatar Martin Szulecki2010-01-22 14:54:40 +0100
committerGravatar Martin Szulecki2010-01-22 14:54:40 +0100
commit3183e7c96e7f66d9f0b215d549912411b146dd77 (patch)
tree557d251fe890fe0ef947a041131bad5fa7204f18 /src
parent1d10605fbffd2be498afdd4621f46842b831c23f (diff)
downloadlibimobiledevice-3183e7c96e7f66d9f0b215d549912411b146dd77.tar.gz
libimobiledevice-3183e7c96e7f66d9f0b215d549912411b146dd77.tar.bz2
Rename iphone_device_recv/_send functions to use iphone_connection_* domain
These communication functions operate on an iphone_connection_t, thus their function name should reflect that.
Diffstat (limited to 'src')
-rw-r--r--src/afc.c16
-rw-r--r--src/iphone.c10
-rw-r--r--src/property_list_service.c8
3 files changed, 17 insertions, 17 deletions
diff --git a/src/afc.c b/src/afc.c
index fc09287..767e460 100644
--- a/src/afc.c
+++ b/src/afc.c
@@ -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_device_send(client->connection, (void*)client->afc_packet, sizeof(AFCPacket), &sent); 172 iphone_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_device_send(client->connection, data, offset, &sent); 181 iphone_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_device_send(client->connection, data + offset, length - offset, &sent); 193 iphone_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_device_send(client->connection, (void*)client->afc_packet, sizeof(AFCPacket), &sent); 206 iphone_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_device_send(client->connection, data, length, &sent); 216 iphone_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_device_recv(client->connection, (char*)&header, sizeof(AFCPacket), bytes_recv); 244 iphone_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_device_recv(client->connection, *dump_here, this_len, bytes_recv); 298 iphone_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_device_recv(client->connection, (*dump_here)+current_count, entire_len - current_count, bytes_recv); 316 iphone_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;
diff --git a/src/iphone.c b/src/iphone.c
index 6d95c45..85d136c 100644
--- a/src/iphone.c
+++ b/src/iphone.c
@@ -294,7 +294,7 @@ static iphone_error_t internal_connection_send(iphone_connection_t connection, c
294 * 294 *
295 * @return IPHONE_E_SUCCESS if ok, otherwise an error code. 295 * @return IPHONE_E_SUCCESS if ok, otherwise an error code.
296 */ 296 */
297iphone_error_t iphone_device_send(iphone_connection_t connection, const char *data, uint32_t len, uint32_t *sent_bytes) 297iphone_error_t iphone_connection_send(iphone_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 IPHONE_E_INVALID_ARG;
@@ -350,7 +350,7 @@ static iphone_error_t internal_connection_recv_timeout(iphone_connection_t conne
350 * 350 *
351 * @return IPHONE_E_SUCCESS if ok, otherwise an error code. 351 * @return IPHONE_E_SUCCESS if ok, otherwise an error code.
352 */ 352 */
353iphone_error_t iphone_device_recv_timeout(iphone_connection_t connection, char *data, uint32_t len, uint32_t *recv_bytes, unsigned int timeout) 353iphone_error_t iphone_connection_receive_timeout(iphone_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 IPHONE_E_INVALID_ARG;
@@ -393,7 +393,7 @@ static iphone_error_t internal_connection_recv(iphone_connection_t connection, c
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_device_recv_timeout, but with a predefined 396 * This function is like iphone_connection_receive_timeout, but with a predefined
397 * reasonable timeout. 397 * reasonable timeout.
398 * 398 *
399 * @param connection The connection to receive data from. 399 * @param connection The connection to receive data from.
@@ -404,7 +404,7 @@ static iphone_error_t internal_connection_recv(iphone_connection_t connection, c
404 * 404 *
405 * @return IPHONE_E_SUCCESS if ok, otherwise an error code. 405 * @return IPHONE_E_SUCCESS if ok, otherwise an error code.
406 */ 406 */
407iphone_error_t iphone_device_recv(iphone_connection_t connection, char *data, uint32_t len, uint32_t *recv_bytes) 407iphone_error_t iphone_connection_receive(iphone_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 IPHONE_E_INVALID_ARG;
@@ -464,7 +464,7 @@ static ssize_t internal_ssl_read(gnutls_transport_ptr_t transport, char *buffer,
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_recv(connection, recv_buffer, this_len, (uint32_t*)&bytes)) != IPHONE_E_SUCCESS) { 466 if ((res = internal_connection_recv(connection, recv_buffer, this_len, (uint32_t*)&bytes)) != IPHONE_E_SUCCESS) {
467 debug_info("ERROR: iphone_device_recv returned %d", res); 467 debug_info("ERROR: iphone_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);
diff --git a/src/property_list_service.c b/src/property_list_service.c
index 852ed9c..39483c2 100644
--- a/src/property_list_service.c
+++ b/src/property_list_service.c
@@ -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_device_send(client->connection, (const char*)&nlen, sizeof(nlen), (uint32_t*)&bytes); 144 iphone_connection_send(client->connection, (const char*)&nlen, sizeof(nlen), (uint32_t*)&bytes);
145 if (bytes == sizeof(nlen)) { 145 if (bytes == sizeof(nlen)) {
146 iphone_device_send(client->connection, content, length, (uint32_t*)&bytes); 146 iphone_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_recv_timeout(property_list_s
221 return PROPERTY_LIST_SERVICE_E_INVALID_ARG; 221 return PROPERTY_LIST_SERVICE_E_INVALID_ARG;
222 } 222 }
223 223
224 iphone_device_recv_timeout(client->connection, (char*)&pktlen, sizeof(pktlen), &bytes, timeout); 224 iphone_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_recv_timeout(property_list_s
235 content = (char*)malloc(pktlen); 235 content = (char*)malloc(pktlen);
236 236
237 while (curlen < pktlen) { 237 while (curlen < pktlen) {
238 iphone_device_recv(client->connection, content+curlen, pktlen-curlen, &bytes); 238 iphone_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;