summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/libiphone/libiphone.h10
-rw-r--r--src/afc.c16
-rw-r--r--src/iphone.c10
-rw-r--r--src/property_list_service.c8
-rw-r--r--tools/iphonesyslog.c4
5 files changed, 25 insertions, 23 deletions
diff --git a/include/libiphone/libiphone.h b/include/libiphone/libiphone.h
index b67fcd4..efe9a63 100644
--- a/include/libiphone/libiphone.h
+++ b/include/libiphone/libiphone.h
@@ -81,12 +81,14 @@ iphone_error_t iphone_device_list_free(char **devices);
iphone_error_t iphone_device_new(iphone_device_t *device, const char *uuid);
iphone_error_t iphone_device_free(iphone_device_t device);
-/* connection/disconnection and communication */
+/* connection/disconnection */
iphone_error_t iphone_device_connect(iphone_device_t device, uint16_t port, iphone_connection_t *connection);
iphone_error_t iphone_device_disconnect(iphone_connection_t connection);
-iphone_error_t iphone_device_send(iphone_connection_t connection, const char *data, uint32_t len, uint32_t *sent_bytes);
-iphone_error_t iphone_device_recv_timeout(iphone_connection_t connection, char *data, uint32_t len, uint32_t *recv_bytes, unsigned int timeout);
-iphone_error_t iphone_device_recv(iphone_connection_t connection, char *data, uint32_t len, uint32_t *recv_bytes);
+
+/* communication */
+iphone_error_t iphone_connection_send(iphone_connection_t connection, const char *data, uint32_t len, uint32_t *sent_bytes);
+iphone_error_t iphone_connection_receive_timeout(iphone_connection_t connection, char *data, uint32_t len, uint32_t *recv_bytes, unsigned int timeout);
+iphone_error_t iphone_connection_receive(iphone_connection_t connection, char *data, uint32_t len, uint32_t *recv_bytes);
/* misc */
iphone_error_t iphone_device_get_handle(iphone_device_t device, uint32_t *handle);
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
/* send AFC packet header */
AFCPacket_to_LE(client->afc_packet);
sent = 0;
- iphone_device_send(client->connection, (void*)client->afc_packet, sizeof(AFCPacket), &sent);
+ iphone_connection_send(client->connection, (void*)client->afc_packet, sizeof(AFCPacket), &sent);
if (sent == 0) {
/* FIXME: should this be handled as success?! */
return AFC_E_SUCCESS;
@@ -178,7 +178,7 @@ static afc_error_t afc_dispatch_packet(afc_client_t client, const char *data, ui
/* send AFC packet data */
sent = 0;
- iphone_device_send(client->connection, data, offset, &sent);
+ iphone_connection_send(client->connection, data, offset, &sent);
if (sent == 0) {
return AFC_E_SUCCESS;
}
@@ -190,7 +190,7 @@ static afc_error_t afc_dispatch_packet(afc_client_t client, const char *data, ui
debug_buffer(data + offset, length - offset);
sent = 0;
- iphone_device_send(client->connection, data + offset, length - offset, &sent);
+ iphone_connection_send(client->connection, data + offset, length - offset, &sent);
*bytes_sent = sent;
return AFC_E_SUCCESS;
@@ -203,7 +203,7 @@ static afc_error_t afc_dispatch_packet(afc_client_t client, const char *data, ui
/* send AFC packet header */
AFCPacket_to_LE(client->afc_packet);
sent = 0;
- iphone_device_send(client->connection, (void*)client->afc_packet, sizeof(AFCPacket), &sent);
+ iphone_connection_send(client->connection, (void*)client->afc_packet, sizeof(AFCPacket), &sent);
if (sent == 0) {
return AFC_E_SUCCESS;
}
@@ -213,7 +213,7 @@ static afc_error_t afc_dispatch_packet(afc_client_t client, const char *data, ui
debug_info("packet data follows");
debug_buffer(data, length);
- iphone_device_send(client->connection, data, length, &sent);
+ iphone_connection_send(client->connection, data, length, &sent);
*bytes_sent += sent;
}
return AFC_E_SUCCESS;
@@ -241,7 +241,7 @@ static afc_error_t afc_receive_data(afc_client_t client, char **dump_here, uint3
*bytes_recv = 0;
/* first, read the AFC header */
- iphone_device_recv(client->connection, (char*)&header, sizeof(AFCPacket), bytes_recv);
+ iphone_connection_receive(client->connection, (char*)&header, sizeof(AFCPacket), bytes_recv);
AFCPacket_from_LE(&header);
if (*bytes_recv == 0) {
debug_info("Just didn't get enough.");
@@ -295,7 +295,7 @@ static afc_error_t afc_receive_data(afc_client_t client, char **dump_here, uint3
*dump_here = (char*)malloc(entire_len);
if (this_len > 0) {
- iphone_device_recv(client->connection, *dump_here, this_len, bytes_recv);
+ iphone_connection_receive(client->connection, *dump_here, this_len, bytes_recv);
if (*bytes_recv <= 0) {
free(*dump_here);
*dump_here = NULL;
@@ -313,7 +313,7 @@ static afc_error_t afc_receive_data(afc_client_t client, char **dump_here, uint3
if (entire_len > this_len) {
while (current_count < entire_len) {
- iphone_device_recv(client->connection, (*dump_here)+current_count, entire_len - current_count, bytes_recv);
+ iphone_connection_receive(client->connection, (*dump_here)+current_count, entire_len - current_count, bytes_recv);
if (*bytes_recv <= 0) {
debug_info("Error receiving data (recv returned %d)", *bytes_recv);
break;
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
*
* @return IPHONE_E_SUCCESS if ok, otherwise an error code.
*/
-iphone_error_t iphone_device_send(iphone_connection_t connection, const char *data, uint32_t len, uint32_t *sent_bytes)
+iphone_error_t iphone_connection_send(iphone_connection_t connection, const char *data, uint32_t len, uint32_t *sent_bytes)
{
if (!connection || !data || (connection->ssl_data && !connection->ssl_data->session)) {
return IPHONE_E_INVALID_ARG;
@@ -350,7 +350,7 @@ static iphone_error_t internal_connection_recv_timeout(iphone_connection_t conne
*
* @return IPHONE_E_SUCCESS if ok, otherwise an error code.
*/
-iphone_error_t iphone_device_recv_timeout(iphone_connection_t connection, char *data, uint32_t len, uint32_t *recv_bytes, unsigned int timeout)
+iphone_error_t iphone_connection_receive_timeout(iphone_connection_t connection, char *data, uint32_t len, uint32_t *recv_bytes, unsigned int timeout)
{
if (!connection || (connection->ssl_data && !connection->ssl_data->session)) {
return IPHONE_E_INVALID_ARG;
@@ -393,7 +393,7 @@ static iphone_error_t internal_connection_recv(iphone_connection_t connection, c
/**
* Receive data from a device via the given connection.
- * This function is like iphone_device_recv_timeout, but with a predefined
+ * This function is like iphone_connection_receive_timeout, but with a predefined
* reasonable timeout.
*
* @param connection The connection to receive data from.
@@ -404,7 +404,7 @@ static iphone_error_t internal_connection_recv(iphone_connection_t connection, c
*
* @return IPHONE_E_SUCCESS if ok, otherwise an error code.
*/
-iphone_error_t iphone_device_recv(iphone_connection_t connection, char *data, uint32_t len, uint32_t *recv_bytes)
+iphone_error_t iphone_connection_receive(iphone_connection_t connection, char *data, uint32_t len, uint32_t *recv_bytes)
{
if (!connection || (connection->ssl_data && !connection->ssl_data->session)) {
return IPHONE_E_INVALID_ARG;
@@ -464,7 +464,7 @@ static ssize_t internal_ssl_read(gnutls_transport_ptr_t transport, char *buffer,
/* repeat until we have the full data or an error occurs */
do {
if ((res = internal_connection_recv(connection, recv_buffer, this_len, (uint32_t*)&bytes)) != IPHONE_E_SUCCESS) {
- debug_info("ERROR: iphone_device_recv returned %d", res);
+ debug_info("ERROR: iphone_connection_receive returned %d", res);
return res;
}
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
nlen = htonl(length);
debug_info("sending %d bytes", length);
- iphone_device_send(client->connection, (const char*)&nlen, sizeof(nlen), (uint32_t*)&bytes);
+ iphone_connection_send(client->connection, (const char*)&nlen, sizeof(nlen), (uint32_t*)&bytes);
if (bytes == sizeof(nlen)) {
- iphone_device_send(client->connection, content, length, (uint32_t*)&bytes);
+ iphone_connection_send(client->connection, content, length, (uint32_t*)&bytes);
if (bytes > 0) {
debug_info("sent %d bytes", bytes);
debug_plist(plist);
@@ -221,7 +221,7 @@ static property_list_service_error_t internal_plist_recv_timeout(property_list_s
return PROPERTY_LIST_SERVICE_E_INVALID_ARG;
}
- iphone_device_recv_timeout(client->connection, (char*)&pktlen, sizeof(pktlen), &bytes, timeout);
+ iphone_connection_receive_timeout(client->connection, (char*)&pktlen, sizeof(pktlen), &bytes, timeout);
debug_info("initial read=%i", bytes);
if (bytes < 4) {
debug_info("initial read failed!");
@@ -235,7 +235,7 @@ static property_list_service_error_t internal_plist_recv_timeout(property_list_s
content = (char*)malloc(pktlen);
while (curlen < pktlen) {
- iphone_device_recv(client->connection, content+curlen, pktlen-curlen, &bytes);
+ iphone_connection_receive(client->connection, content+curlen, pktlen-curlen, &bytes);
if (bytes <= 0) {
res = PROPERTY_LIST_SERVICE_E_MUX_ERROR;
break;
diff --git a/tools/iphonesyslog.c b/tools/iphonesyslog.c
index 017956e..41e490f 100644
--- a/tools/iphonesyslog.c
+++ b/tools/iphonesyslog.c
@@ -117,7 +117,7 @@ int main(int argc, char *argv[])
char *receive = NULL;
uint32_t datalen = 0, bytes = 0, recv_bytes = 0;
- ret = iphone_device_recv(conn, (char *) &datalen, sizeof(datalen), &bytes);
+ ret = iphone_connection_receive(conn, (char *) &datalen, sizeof(datalen), &bytes);
datalen = ntohl(datalen);
if (datalen == 0)
@@ -127,7 +127,7 @@ int main(int argc, char *argv[])
receive = (char *) malloc(sizeof(char) * datalen);
while (!quit_flag && (recv_bytes <= datalen)) {
- ret = iphone_device_recv(conn, receive, datalen, &bytes);
+ ret = iphone_connection_receive(conn, receive, datalen, &bytes);
if (bytes == 0)
break;