diff options
Diffstat (limited to 'src/AFC.h')
| -rw-r--r-- | src/AFC.h | 61 |
1 files changed, 31 insertions, 30 deletions
| @@ -26,6 +26,8 @@ | |||
| 26 | #include <glib.h> | 26 | #include <glib.h> |
| 27 | #include <stdint.h> | 27 | #include <stdint.h> |
| 28 | 28 | ||
| 29 | #include "libiphone/afc.h" | ||
| 30 | |||
| 29 | #define AFC_MAGIC "CFA6LPAA" | 31 | #define AFC_MAGIC "CFA6LPAA" |
| 30 | #define AFC_MAGIC_LEN (8) | 32 | #define AFC_MAGIC_LEN (8) |
| 31 | 33 | ||
| @@ -48,39 +50,38 @@ struct afc_client_int { | |||
| 48 | AFCPacket *afc_packet; | 50 | AFCPacket *afc_packet; |
| 49 | int file_handle; | 51 | int file_handle; |
| 50 | int lock; | 52 | int lock; |
| 51 | int afcerror; | ||
| 52 | GMutex *mutex; | 53 | GMutex *mutex; |
| 53 | }; | 54 | }; |
| 54 | 55 | ||
| 56 | /* AFC Operations */ | ||
| 55 | enum { | 57 | enum { |
| 56 | AFC_ERROR = 0x00000001, | 58 | AFC_OP_STATUS = 0x00000001, // Status |
| 57 | AFC_SUCCESS_RESPONSE = 0x00000002, | 59 | AFC_OP_DATA = 0x00000002, // Data |
| 58 | AFC_LIST_DIR = 0x00000003, // ReadDir | 60 | AFC_OP_READ_DIR = 0x00000003, // ReadDir |
| 59 | // 0x00000004 // ReadFile | 61 | AFC_OP_READ_FILE = 0x00000004, // ReadFile |
| 60 | // 0x00000005 // WriteFile | 62 | AFC_OP_WRITE_FILE = 0x00000005, // WriteFile |
| 61 | // 0x00000006 // WritePart | 63 | AFC_OP_WRITE_PART = 0x00000006, // WritePart |
| 62 | AFC_TRUNCATE = 0x00000007, // Truncate | 64 | AFC_OP_TRUNCATE = 0x00000007, // TruncateFile |
| 63 | AFC_DELETE = 0x00000008, // RemovePath | 65 | AFC_OP_REMOVE_PATH = 0x00000008, // RemovePath |
| 64 | AFC_MAKE_DIR = 0x00000009, // MakeDir | 66 | AFC_OP_MAKE_DIR = 0x00000009, // MakeDir |
| 65 | AFC_GET_INFO = 0x0000000a, // GetFileInfo | 67 | AFC_OP_GET_FILE_INFO = 0x0000000a, // GetFileInfo |
| 66 | AFC_GET_DEVINFO = 0x0000000b, // GetDeviceInfo | 68 | AFC_OP_GET_DEVINFO = 0x0000000b, // GetDeviceInfo |
| 67 | // 0x0000000c // same as 5, but writes to temp file, then renames it. | 69 | AFC_OP_WRITE_FILE_ATOM = 0x0000000c, // WriteFileAtomic (tmp file+rename) |
| 68 | AFC_FILE_OPEN = 0x0000000d, // FileRefOpen | 70 | AFC_OP_FILE_OPEN = 0x0000000d, // FileRefOpen |
| 69 | AFC_FILE_HANDLE = 0x0000000e, // _unknownPacket | 71 | AFC_OP_FILE_OPEN_RES = 0x0000000e, // FileRefOpenResult |
| 70 | AFC_READ = 0x0000000f, // FileRefRead | 72 | AFC_OP_READ = 0x0000000f, // FileRefRead |
| 71 | AFC_WRITE = 0x00000010, // FileRefWrite | 73 | AFC_OP_WRITE = 0x00000010, // FileRefWrite |
| 72 | AFC_FILE_SEEK = 0x00000011, // FileRefSeek | 74 | AFC_OP_FILE_SEEK = 0x00000011, // FileRefSeek |
| 73 | AFC_FILE_TELL = 0x00000012, // FileRefTell | 75 | AFC_OP_FILE_TELL = 0x00000012, // FileRefTell |
| 74 | // 0x00000013 // _unknownPacket | 76 | AFC_OP_FILE_TELL_RES = 0x00000013, // FileRefTellResult |
| 75 | AFC_FILE_CLOSE = 0x00000014, // FileRefClose | 77 | AFC_OP_FILE_CLOSE = 0x00000014, // FileRefClose |
| 76 | AFC_FILE_TRUNCATE = 0x00000015, // FileRefSetFileSize (ftruncate) | 78 | AFC_OP_FILE_SET_SIZE = 0x00000015, // FileRefSetFileSize (ftruncate) |
| 77 | // 0x00000016 // SetFatalError | 79 | AFC_OP_GET_CON_INFO = 0x00000016, // GetConnectionInfo |
| 78 | // 0x00000017 // SetConnectionOptions | 80 | AFC_OP_SET_CON_OPTIONS = 0x00000017, // SetConnectionOptions |
| 79 | AFC_RENAME = 0x00000018, // RenamePath | 81 | AFC_OP_RENAME_PATH = 0x00000018, // RenamePath |
| 80 | // 0x00000019 // SetFSBlockSize (0x800000) | 82 | AFC_OP_SET_FS_BS = 0x00000019, // SetFSBlockSize (0x800000) |
| 81 | // 0x0000001A // SetBlockSize (0x800000) | 83 | AFC_OP_SET_SOCKET_BS = 0x0000001A, // SetSocketBlockSize (0x800000) |
| 82 | AFC_FILE_LOCK = 0x0000001B, // FileRefLock | 84 | AFC_OP_FILE_LOCK = 0x0000001B, // FileRefLock |
| 83 | AFC_MAKE_LINK = 0x0000001C // MakeLink | 85 | AFC_OP_MAKE_LINK = 0x0000001C // MakeLink |
| 84 | }; | 86 | }; |
| 85 | 87 | ||
| 86 | static int afcerror_to_errno(int afcerror); | ||
