diff options
| -rw-r--r-- | include/libiphone/afc.h | 2 | ||||
| -rw-r--r-- | src/AFC.c | 17 |
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; | |||
| 87 | typedef struct afc_client_int *afc_client_t; | 87 | typedef struct afc_client_int *afc_client_t; |
| 88 | 88 | ||
| 89 | /* Interface */ | 89 | /* Interface */ |
| 90 | afc_error_t afc_client_new(iphone_device_t device, int dst_port, afc_client_t *client); | 90 | afc_error_t afc_client_new(iphone_device_t device, uint16_t port, afc_client_t *client); |
| 91 | afc_error_t afc_client_free(afc_client_t client); | 91 | afc_error_t afc_client_free(afc_client_t client); |
| 92 | afc_error_t afc_get_device_info(afc_client_t client, char ***infos); | 92 | afc_error_t afc_get_device_info(afc_client_t client, char ***infos); |
| 93 | afc_error_t afc_read_directory(afc_client_t client, const char *dir, char ***list); | 93 | afc_error_t afc_read_directory(afc_client_t client, const char *dir, char ***list); |
| @@ -52,24 +52,27 @@ static void afc_unlock(afc_client_t client) | |||
| 52 | 52 | ||
| 53 | /** Makes a connection to the AFC service on the phone. | 53 | /** Makes a connection to the AFC service on the phone. |
| 54 | * | 54 | * |
| 55 | * @param phone The iPhone to connect on. | 55 | * @param device The device to connect to. |
| 56 | * @param s_port The source port. | 56 | * @param port The destination port. |
| 57 | * @param d_port The destination port. | 57 | * @param client Pointer that will be set to a newly allocated afc_client_t |
| 58 | * upon successful return. | ||
| 58 | * | 59 | * |
| 59 | * @return A handle to the newly-connected client or NULL upon error. | 60 | * @return AFC_E_SUCCESS on success, AFC_E_INVALID_ARGUMENT when device or port |
| 61 | * is invalid, AFC_E_MUX_ERROR when the connection failed, or AFC_E_NO_MEM | ||
| 62 | * when there's a memory allocation problem. | ||
| 60 | */ | 63 | */ |
| 61 | afc_error_t afc_client_new(iphone_device_t device, int dst_port, afc_client_t * client) | 64 | afc_error_t afc_client_new(iphone_device_t device, uint16_t port, afc_client_t * client) |
| 62 | { | 65 | { |
| 63 | /* makes sure thread environment is available */ | 66 | /* makes sure thread environment is available */ |
| 64 | if (!g_thread_supported()) | 67 | if (!g_thread_supported()) |
| 65 | g_thread_init(NULL); | 68 | g_thread_init(NULL); |
| 66 | 69 | ||
| 67 | if (!device) | 70 | if (!device || port==0) |
| 68 | return AFC_E_INVALID_ARGUMENT; | 71 | return AFC_E_INVALID_ARGUMENT; |
| 69 | 72 | ||
| 70 | /* attempt connection */ | 73 | /* attempt connection */ |
| 71 | iphone_connection_t connection = NULL; | 74 | iphone_connection_t connection = NULL; |
| 72 | if (iphone_device_connect(device, dst_port, &connection) != IPHONE_E_SUCCESS) { | 75 | if (iphone_device_connect(device, port, &connection) != IPHONE_E_SUCCESS) { |
| 73 | return AFC_E_MUX_ERROR; | 76 | return AFC_E_MUX_ERROR; |
| 74 | } | 77 | } |
| 75 | 78 | ||
