summaryrefslogtreecommitdiffstats
path: root/include/libimobiledevice/afc.h
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2010-01-28 22:18:41 +0100
committerGravatar Martin Szulecki2010-01-29 02:16:00 +0100
commit96101a1231a4ddfeb40fd738a24e108a3a904048 (patch)
tree65a8f54354d9acbbba93dac2c8602d07e469482c /include/libimobiledevice/afc.h
parent45b88ae3956de089fdc35605910f1359a1d3961c (diff)
downloadlibimobiledevice-96101a1231a4ddfeb40fd738a24e108a3a904048.tar.gz
libimobiledevice-96101a1231a4ddfeb40fd738a24e108a3a904048.tar.bz2
Global renames due to project rename to libimobiledevice
Diffstat (limited to 'include/libimobiledevice/afc.h')
-rw-r--r--include/libimobiledevice/afc.h117
1 files changed, 117 insertions, 0 deletions
diff --git a/include/libimobiledevice/afc.h b/include/libimobiledevice/afc.h
new file mode 100644
index 0000000..5b61499
--- /dev/null
+++ b/include/libimobiledevice/afc.h
@@ -0,0 +1,117 @@
1/**
2 * @file libimobiledevice/afc.h
3 * @brief AFC Implementation
4 * \internal
5 *
6 * Copyright (c) 2009 Nikias Bassen All Rights Reserved.
7 *
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
12 *
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 */
22
23#ifndef AFC_H
24#define AFC_H
25
26#ifdef __cplusplus
27extern "C" {
28#endif
29
30#include <libimobiledevice/libimobiledevice.h>
31
32/* Error Codes */
33#define AFC_E_SUCCESS 0
34#define AFC_E_UNKNOWN_ERROR 1
35#define AFC_E_OP_HEADER_INVALID 2
36#define AFC_E_NO_RESOURCES 3
37#define AFC_E_READ_ERROR 4
38#define AFC_E_WRITE_ERROR 5
39#define AFC_E_UNKNOWN_PACKET_TYPE 6
40#define AFC_E_INVALID_ARGUMENT 7
41#define AFC_E_OBJECT_NOT_FOUND 8
42#define AFC_E_OBJECT_IS_DIR 9
43#define AFC_E_PERM_DENIED 10
44#define AFC_E_SERVICE_NOT_CONNECTED 11
45#define AFC_E_OP_TIMEOUT 12
46#define AFC_E_TOO_MUCH_DATA 13
47#define AFC_E_END_OF_DATA 14
48#define AFC_E_OP_NOT_SUPPORTED 15
49#define AFC_E_OBJECT_EXISTS 16
50#define AFC_E_OBJECT_BUSY 17
51#define AFC_E_NO_SPACE_LEFT 18
52#define AFC_E_OP_WOULD_BLOCK 19
53#define AFC_E_IO_ERROR 20
54#define AFC_E_OP_INTERRUPTED 21
55#define AFC_E_OP_IN_PROGRESS 22
56#define AFC_E_INTERNAL_ERROR 23
57
58#define AFC_E_MUX_ERROR 30
59#define AFC_E_NO_MEM 31
60#define AFC_E_NOT_ENOUGH_DATA 32
61#define AFC_E_DIR_NOT_EMPTY 33
62
63typedef int16_t afc_error_t;
64
65/* Flags */
66typedef enum {
67 AFC_FOPEN_RDONLY = 0x00000001, // r O_RDONLY
68 AFC_FOPEN_RW = 0x00000002, // r+ O_RDWR | O_CREAT
69 AFC_FOPEN_WRONLY = 0x00000003, // w O_WRONLY | O_CREAT | O_TRUNC
70 AFC_FOPEN_WR = 0x00000004, // w+ O_RDWR | O_CREAT | O_TRUNC
71 AFC_FOPEN_APPEND = 0x00000005, // a O_WRONLY | O_APPEND | O_CREAT
72 AFC_FOPEN_RDAPPEND = 0x00000006 // a+ O_RDWR | O_APPEND | O_CREAT
73} afc_file_mode_t;
74
75typedef enum {
76 AFC_HARDLINK = 1,
77 AFC_SYMLINK = 2
78} afc_link_type_t;
79
80typedef enum {
81 AFC_LOCK_SH = 1 | 4, // shared lock
82 AFC_LOCK_EX = 2 | 4, // exclusive lock
83 AFC_LOCK_UN = 8 | 4 // unlock
84} afc_lock_op_t;
85
86struct afc_client_int;
87typedef struct afc_client_int *afc_client_t;
88
89/* Interface */
90afc_error_t afc_client_new(idevice_t device, uint16_t port, afc_client_t *client);
91afc_error_t afc_client_free(afc_client_t client);
92afc_error_t afc_get_device_info(afc_client_t client, char ***infos);
93afc_error_t afc_read_directory(afc_client_t client, const char *dir, char ***list);
94afc_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);
96afc_error_t afc_file_close(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);
98afc_error_t afc_file_read(afc_client_t client, uint64_t handle, char *data, uint32_t length, uint32_t *bytes_read);
99afc_error_t afc_file_write(afc_client_t client, uint64_t handle, const char *data, uint32_t length, uint32_t *bytes_written);
100afc_error_t afc_file_seek(afc_client_t client, uint64_t handle, int64_t offset, int whence);
101afc_error_t afc_file_tell(afc_client_t client, uint64_t handle, uint64_t *position);
102afc_error_t afc_file_truncate(afc_client_t client, uint64_t handle, uint64_t newsize);
103afc_error_t afc_remove_path(afc_client_t client, const char *path);
104afc_error_t afc_rename_path(afc_client_t client, const char *from, const char *to);
105afc_error_t afc_make_directory(afc_client_t client, const char *dir);
106afc_error_t afc_truncate(afc_client_t client, const char *path, uint64_t newsize);
107afc_error_t afc_make_link(afc_client_t client, afc_link_type_t linktype, const char *target, const char *linkname);
108afc_error_t afc_set_file_time(afc_client_t client, const char *path, uint64_t mtime);
109
110/* Helper functions */
111afc_error_t afc_get_device_info_key(afc_client_t client, const char *key, char **value);
112
113#ifdef __cplusplus
114}
115#endif
116
117#endif