summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/libiphone/afc.h2
-rw-r--r--src/AFC.c17
2 files changed, 11 insertions, 8 deletions
diff --git a/include/libiphone/afc.h b/include/libiphone/afc.h
index 7eff678..5d09b40 100644
--- a/include/libiphone/afc.h
+++ b/include/libiphone/afc.h
@@ -87,7 +87,7 @@ struct afc_client_int;
typedef struct afc_client_int *afc_client_t;
/* Interface */
-afc_error_t afc_client_new(iphone_device_t device, int dst_port, afc_client_t *client);
+afc_error_t afc_client_new(iphone_device_t device, uint16_t port, afc_client_t *client);
afc_error_t afc_client_free(afc_client_t client);
afc_error_t afc_get_device_info(afc_client_t client, char ***infos);
afc_error_t afc_read_directory(afc_client_t client, const char *dir, char ***list);
diff --git a/src/AFC.c b/src/AFC.c
index d430e08..db00735 100644
--- a/src/AFC.c
+++ b/src/AFC.c
@@ -52,24 +52,27 @@ static void afc_unlock(afc_client_t client)
/** Makes a connection to the AFC service on the phone.
*
- * @param phone The iPhone to connect on.
- * @param s_port The source port.
- * @param d_port The destination port.
+ * @param device The device to connect to.
+ * @param port The destination port.
+ * @param client Pointer that will be set to a newly allocated afc_client_t
+ * upon successful return.
*
- * @return A handle to the newly-connected client or NULL upon error.
+ * @return AFC_E_SUCCESS on success, AFC_E_INVALID_ARGUMENT when device or port
+ * is invalid, AFC_E_MUX_ERROR when the connection failed, or AFC_E_NO_MEM
+ * when there's a memory allocation problem.
*/
-afc_error_t afc_client_new(iphone_device_t device, int dst_port, afc_client_t * client)
+afc_error_t afc_client_new(iphone_device_t device, uint16_t port, afc_client_t * client)
{
/* makes sure thread environment is available */
if (!g_thread_supported())
g_thread_init(NULL);
- if (!device)
+ if (!device || port==0)
return AFC_E_INVALID_ARGUMENT;
/* attempt connection */
iphone_connection_t connection = NULL;
- if (iphone_device_connect(device, dst_port, &connection) != IPHONE_E_SUCCESS) {
+ if (iphone_device_connect(device, port, &connection) != IPHONE_E_SUCCESS) {
return AFC_E_MUX_ERROR;
}