summaryrefslogtreecommitdiffstats
path: root/include/libiphone
diff options
context:
space:
mode:
authorGravatar Martin Szulecki2009-07-25 03:26:39 +0200
committerGravatar Martin Szulecki2009-07-25 03:26:39 +0200
commit50be30047dbb0d38fd8d61763c13ec75d2b52543 (patch)
tree87e021b478c6db6197294e4ef56c47cdad0f5992 /include/libiphone
parent1cfc2748d38eb97100cabced3b282108898099c2 (diff)
downloadlibimobiledevice-50be30047dbb0d38fd8d61763c13ec75d2b52543.tar.gz
libimobiledevice-50be30047dbb0d38fd8d61763c13ec75d2b52543.tar.bz2
Update AFC API and use error codes from the STATUS operation response
Diffstat (limited to 'include/libiphone')
-rw-r--r--include/libiphone/afc.h72
-rw-r--r--include/libiphone/libiphone.h8
2 files changed, 54 insertions, 26 deletions
diff --git a/include/libiphone/afc.h b/include/libiphone/afc.h
index af801b1..4b024a1 100644
--- a/include/libiphone/afc.h
+++ b/include/libiphone/afc.h
@@ -27,6 +27,39 @@ extern "C" {
27 27
28#include <libiphone/libiphone.h> 28#include <libiphone/libiphone.h>
29 29
30/* Error Codes */
31#define AFC_E_SUCCESS 0
32#define AFC_E_UNKNOWN_ERROR 1
33#define AFC_E_OP_HEADER_INVALID 2
34#define AFC_E_NO_RESOURCES 3
35#define AFC_E_READ_ERROR 4
36#define AFC_E_WRITE_ERROR 5
37#define AFC_E_UNKNOWN_PACKET_TYPE 6
38#define AFC_E_INVALID_ARGUMENT 7
39#define AFC_E_OBJECT_NOT_FOUND 8
40#define AFC_E_OBJECT_IS_DIR 9
41#define AFC_E_PERM_DENIED 10
42#define AFC_E_SERVICE_NOT_CONNECTED 11
43#define AFC_E_OP_TIMEOUT 12
44#define AFC_E_TOO_MUCH_DATA 13
45#define AFC_E_END_OF_DATA 14
46#define AFC_E_OP_NOT_SUPPORTED 15
47#define AFC_E_OBJECT_EXISTS 16
48#define AFC_E_OBJECT_BUSY 17
49#define AFC_E_NO_SPACE_LEFT 18
50#define AFC_E_OP_WOULD_BLOCK 19
51#define AFC_E_IO_ERROR 20
52#define AFC_E_OP_INTERRUPTED 21
53#define AFC_E_OP_IN_PROGRESS 22
54#define AFC_E_INTERNAL_ERROR 23
55
56#define AFC_E_MUX_ERROR 30
57#define AFC_E_NO_MEM 31
58#define AFC_E_NOT_ENOUGH_DATA 32
59
60typedef int16_t afc_error_t;
61
62/* Flags */
30typedef enum { 63typedef enum {
31 AFC_FOPEN_RDONLY = 0x00000001, // r O_RDONLY 64 AFC_FOPEN_RDONLY = 0x00000001, // r O_RDONLY
32 AFC_FOPEN_RW = 0x00000002, // r+ O_RDWR | O_CREAT 65 AFC_FOPEN_RW = 0x00000002, // r+ O_RDWR | O_CREAT
@@ -50,28 +83,27 @@ typedef enum {
50struct afc_client_int; 83struct afc_client_int;
51typedef struct afc_client_int *afc_client_t; 84typedef struct afc_client_int *afc_client_t;
52 85
53//afc related functions 86/* Interface */
54iphone_error_t afc_new_client ( iphone_device_t device, int dst_port, afc_client_t *client ); 87afc_error_t afc_client_new(iphone_device_t device, int dst_port, afc_client_t *client);
55iphone_error_t afc_free_client ( afc_client_t client ); 88afc_error_t afc_client_free(afc_client_t client);
56int afc_get_afcerror ( afc_client_t client ); 89int afc_get_afcerror ( afc_client_t client );
57int afc_get_errno ( afc_client_t client ); 90int afc_get_errno ( afc_client_t client );
58 91afc_error_t afc_get_device_info(afc_client_t client, char ***infos);
59iphone_error_t afc_get_devinfo ( afc_client_t client, char ***infos ); 92afc_error_t afc_read_directory(afc_client_t client, const char *dir, char ***list);
60iphone_error_t afc_get_dir_list ( afc_client_t client, const char *dir, char ***list); 93afc_error_t afc_get_file_info(afc_client_t client, const char *filename, char ***infolist);
61 94afc_error_t afc_get_connection_info(afc_client_t client, char ***infolist);
62iphone_error_t afc_get_file_info ( afc_client_t client, const char *filename, char ***infolist ); 95afc_error_t afc_file_open(afc_client_t client, const char *filename, afc_file_mode_t file_mode, uint64_t *handle);
63iphone_error_t afc_open_file ( afc_client_t client, const char *filename, afc_file_mode_t file_mode, uint64_t *handle ); 96afc_error_t afc_file_close(afc_client_t client, uint64_t handle);
64iphone_error_t afc_close_file ( afc_client_t client, uint64_t handle); 97afc_error_t afc_file_lock(afc_client_t client, uint64_t handle, afc_lock_op_t operation);
65iphone_error_t afc_lock_file ( afc_client_t client, uint64_t handle, afc_lock_op_t operation); 98afc_error_t afc_file_read(afc_client_t client, uint64_t handle, char *data, int length, uint32_t *bytes);
66iphone_error_t afc_read_file ( afc_client_t client, uint64_t handle, char *data, int length, uint32_t *bytes); 99afc_error_t afc_file_write(afc_client_t client, uint64_t handle, const char *data, int length, uint32_t *bytes);
67iphone_error_t afc_write_file ( afc_client_t client, uint64_t handle, const char *data, int length, uint32_t *bytes); 100afc_error_t afc_file_seek(afc_client_t client, uint64_t handle, int64_t offset, int whence);
68iphone_error_t afc_seek_file ( afc_client_t client, uint64_t handle, int64_t offset, int whence); 101afc_error_t afc_file_truncate(afc_client_t client, uint64_t handle, uint64_t newsize);
69iphone_error_t afc_truncate_file ( afc_client_t client, uint64_t handle, uint64_t newsize); 102afc_error_t afc_remove_path(afc_client_t client, const char *path);
70iphone_error_t afc_delete_file ( afc_client_t client, const char *path); 103afc_error_t afc_rename_path(afc_client_t client, const char *from, const char *to);
71iphone_error_t afc_rename_file ( afc_client_t client, const char *from, const char *to); 104afc_error_t afc_make_directory(afc_client_t client, const char *dir);
72iphone_error_t afc_mkdir ( afc_client_t client, const char *dir); 105afc_error_t afc_truncate(afc_client_t client, const char *path, off_t newsize);
73iphone_error_t afc_truncate ( afc_client_t client, const char *path, off_t newsize); 106afc_error_t afc_make_link(afc_client_t client, afc_link_type_t linktype, const char *target, const char *linkname);
74iphone_error_t afc_make_link ( afc_client_t client, afc_link_type_t linktype, const char *target, const char *linkname);
75 107
76#ifdef __cplusplus 108#ifdef __cplusplus
77} 109}
diff --git a/include/libiphone/libiphone.h b/include/libiphone/libiphone.h
index 61820e0..014c8bf 100644
--- a/include/libiphone/libiphone.h
+++ b/include/libiphone/libiphone.h
@@ -37,12 +37,8 @@ extern "C" {
37#define IPHONE_E_INVALID_ARG -1 37#define IPHONE_E_INVALID_ARG -1
38#define IPHONE_E_UNKNOWN_ERROR -2 38#define IPHONE_E_UNKNOWN_ERROR -2
39#define IPHONE_E_NO_DEVICE -3 39#define IPHONE_E_NO_DEVICE -3
40#define IPHONE_E_TIMEOUT -4 40#define IPHONE_E_NOT_ENOUGH_DATA -4
41#define IPHONE_E_NOT_ENOUGH_DATA -5 41#define IPHONE_E_BAD_HEADER -5
42#define IPHONE_E_BAD_HEADER -6
43
44//afc specific error
45#define IPHONE_E_AFC_ERROR -13
46 42
47typedef int16_t iphone_error_t; 43typedef int16_t iphone_error_t;
48 44