diff options
| author | 2014-10-02 03:52:05 +0200 | |
|---|---|---|
| committer | 2014-10-02 03:52:05 +0200 | |
| commit | 4540d0ed1dde2ed7ea69f4abb911359db675c038 (patch) | |
| tree | 8ee1bb694d60d1c838aa97892a303460d691848c | |
| parent | 52708cbb04b5b00aeff68e731abb5ced8fe09afb (diff) | |
| download | libimobiledevice-4540d0ed1dde2ed7ea69f4abb911359db675c038.tar.gz libimobiledevice-4540d0ed1dde2ed7ea69f4abb911359db675c038.tar.bz2 | |
afc: Update all currently known AFC operations in enum
| -rw-r--r-- | src/afc.c | 7 | ||||
| -rw-r--r-- | src/afc.h | 73 |
2 files changed, 48 insertions, 32 deletions
| @@ -2,6 +2,7 @@ | |||
| 2 | * afc.c | 2 | * afc.c |
| 3 | * Contains functions for the built-in AFC client. | 3 | * Contains functions for the built-in AFC client. |
| 4 | * | 4 | * |
| 5 | * Copyright (c) 2014 Martin Szulecki All Rights Reserved. | ||
| 5 | * Copyright (c) 2009-2014 Nikias Bassen. All Rights Reserved. | 6 | * Copyright (c) 2009-2014 Nikias Bassen. All Rights Reserved. |
| 6 | * Copyright (c) 2008 Zach C. All Rights Reserved. | 7 | * Copyright (c) 2008 Zach C. All Rights Reserved. |
| 7 | * | 8 | * |
| @@ -679,7 +680,7 @@ afc_error_t afc_file_read(afc_client_t client, uint64_t handle, char *data, uint | |||
| 679 | } readinfo; | 680 | } readinfo; |
| 680 | readinfo.handle = handle; | 681 | readinfo.handle = handle; |
| 681 | readinfo.size = htole64(length); | 682 | readinfo.size = htole64(length); |
| 682 | ret = afc_dispatch_packet(client, AFC_OP_READ, (const char*)&readinfo, sizeof(readinfo), NULL, 0, &bytes_loc); | 683 | ret = afc_dispatch_packet(client, AFC_OP_FILE_READ, (const char*)&readinfo, sizeof(readinfo), NULL, 0, &bytes_loc); |
| 683 | 684 | ||
| 684 | if (ret != AFC_E_SUCCESS) { | 685 | if (ret != AFC_E_SUCCESS) { |
| 685 | afc_unlock(client); | 686 | afc_unlock(client); |
| @@ -726,7 +727,7 @@ afc_error_t afc_file_write(afc_client_t client, uint64_t handle, const char *dat | |||
| 726 | 727 | ||
| 727 | debug_info("Write length: %i", length); | 728 | debug_info("Write length: %i", length); |
| 728 | 729 | ||
| 729 | ret = afc_dispatch_packet(client, AFC_OP_WRITE, (const char*)&handle, 8, data, length, &bytes_loc); | 730 | ret = afc_dispatch_packet(client, AFC_OP_FILE_WRITE, (const char*)&handle, 8, data, length, &bytes_loc); |
| 730 | 731 | ||
| 731 | current_count += bytes_loc - (sizeof(AFCPacket) + 8); | 732 | current_count += bytes_loc - (sizeof(AFCPacket) + 8); |
| 732 | 733 | ||
| @@ -983,7 +984,7 @@ afc_error_t afc_set_file_time(afc_client_t client, const char *path, uint64_t mt | |||
| 983 | /* Send command */ | 984 | /* Send command */ |
| 984 | memcpy(buffer, &mtime_loc, 8); | 985 | memcpy(buffer, &mtime_loc, 8); |
| 985 | memcpy(buffer + 8, path, strlen(path) + 1); | 986 | memcpy(buffer + 8, path, strlen(path) + 1); |
| 986 | ret = afc_dispatch_packet(client, AFC_OP_SET_FILE_TIME, buffer, 8 + strlen(path) + 1, NULL, 0, &bytes); | 987 | ret = afc_dispatch_packet(client, AFC_OP_SET_FILE_MOD_TIME, buffer, 8 + strlen(path) + 1, NULL, 0, &bytes); |
| 987 | free(buffer); | 988 | free(buffer); |
| 988 | if (ret != AFC_E_SUCCESS) { | 989 | if (ret != AFC_E_SUCCESS) { |
| 989 | afc_unlock(client); | 990 | afc_unlock(client); |
| @@ -2,6 +2,7 @@ | |||
| 2 | * afc.h | 2 | * afc.h |
| 3 | * Defines and structs and the like for the built-in AFC client | 3 | * Defines and structs and the like for the built-in AFC client |
| 4 | * | 4 | * |
| 5 | * Copyright (c) 2014 Martin Szulecki All Rights Reserved. | ||
| 5 | * Copyright (c) 2008 Zach C. All Rights Reserved. | 6 | * Copyright (c) 2008 Zach C. All Rights Reserved. |
| 6 | * | 7 | * |
| 7 | * This library is free software; you can redistribute it and/or | 8 | * This library is free software; you can redistribute it and/or |
| @@ -60,35 +61,49 @@ struct afc_client_private { | |||
| 60 | 61 | ||
| 61 | /* AFC Operations */ | 62 | /* AFC Operations */ |
| 62 | enum { | 63 | enum { |
| 63 | AFC_OP_STATUS = 0x00000001, /* Status */ | 64 | AFC_OP_INVALID = 0x00000000, /* Invalid */ |
| 64 | AFC_OP_DATA = 0x00000002, /* Data */ | 65 | AFC_OP_STATUS = 0x00000001, /* Status */ |
| 65 | AFC_OP_READ_DIR = 0x00000003, /* ReadDir */ | 66 | AFC_OP_DATA = 0x00000002, /* Data */ |
| 66 | AFC_OP_READ_FILE = 0x00000004, /* ReadFile */ | 67 | AFC_OP_READ_DIR = 0x00000003, /* ReadDir */ |
| 67 | AFC_OP_WRITE_FILE = 0x00000005, /* WriteFile */ | 68 | AFC_OP_READ_FILE = 0x00000004, /* ReadFile */ |
| 68 | AFC_OP_WRITE_PART = 0x00000006, /* WritePart */ | 69 | AFC_OP_WRITE_FILE = 0x00000005, /* WriteFile */ |
| 69 | AFC_OP_TRUNCATE = 0x00000007, /* TruncateFile */ | 70 | AFC_OP_WRITE_PART = 0x00000006, /* WritePart */ |
| 70 | AFC_OP_REMOVE_PATH = 0x00000008, /* RemovePath */ | 71 | AFC_OP_TRUNCATE = 0x00000007, /* TruncateFile */ |
| 71 | AFC_OP_MAKE_DIR = 0x00000009, /* MakeDir */ | 72 | AFC_OP_REMOVE_PATH = 0x00000008, /* RemovePath */ |
| 72 | AFC_OP_GET_FILE_INFO = 0x0000000a, /* GetFileInfo */ | 73 | AFC_OP_MAKE_DIR = 0x00000009, /* MakeDir */ |
| 73 | AFC_OP_GET_DEVINFO = 0x0000000b, /* GetDeviceInfo */ | 74 | AFC_OP_GET_FILE_INFO = 0x0000000A, /* GetFileInfo */ |
| 74 | AFC_OP_WRITE_FILE_ATOM = 0x0000000c, /* WriteFileAtomic (tmp file+rename) */ | 75 | AFC_OP_GET_DEVINFO = 0x0000000B, /* GetDeviceInfo */ |
| 75 | AFC_OP_FILE_OPEN = 0x0000000d, /* FileRefOpen */ | 76 | AFC_OP_WRITE_FILE_ATOM = 0x0000000C, /* WriteFileAtomic (tmp file+rename) */ |
| 76 | AFC_OP_FILE_OPEN_RES = 0x0000000e, /* FileRefOpenResult */ | 77 | AFC_OP_FILE_OPEN = 0x0000000D, /* FileRefOpen */ |
| 77 | AFC_OP_READ = 0x0000000f, /* FileRefRead */ | 78 | AFC_OP_FILE_OPEN_RES = 0x0000000E, /* FileRefOpenResult */ |
| 78 | AFC_OP_WRITE = 0x00000010, /* FileRefWrite */ | 79 | AFC_OP_FILE_READ = 0x0000000F, /* FileRefRead */ |
| 79 | AFC_OP_FILE_SEEK = 0x00000011, /* FileRefSeek */ | 80 | AFC_OP_FILE_WRITE = 0x00000010, /* FileRefWrite */ |
| 80 | AFC_OP_FILE_TELL = 0x00000012, /* FileRefTell */ | 81 | AFC_OP_FILE_SEEK = 0x00000011, /* FileRefSeek */ |
| 81 | AFC_OP_FILE_TELL_RES = 0x00000013, /* FileRefTellResult */ | 82 | AFC_OP_FILE_TELL = 0x00000012, /* FileRefTell */ |
| 82 | AFC_OP_FILE_CLOSE = 0x00000014, /* FileRefClose */ | 83 | AFC_OP_FILE_TELL_RES = 0x00000013, /* FileRefTellResult */ |
| 83 | AFC_OP_FILE_SET_SIZE = 0x00000015, /* FileRefSetFileSize (ftruncate) */ | 84 | AFC_OP_FILE_CLOSE = 0x00000014, /* FileRefClose */ |
| 84 | AFC_OP_GET_CON_INFO = 0x00000016, /* GetConnectionInfo */ | 85 | AFC_OP_FILE_SET_SIZE = 0x00000015, /* FileRefSetFileSize (ftruncate) */ |
| 85 | AFC_OP_SET_CON_OPTIONS = 0x00000017, /* SetConnectionOptions */ | 86 | AFC_OP_GET_CON_INFO = 0x00000016, /* GetConnectionInfo */ |
| 86 | AFC_OP_RENAME_PATH = 0x00000018, /* RenamePath */ | 87 | AFC_OP_SET_CON_OPTIONS = 0x00000017, /* SetConnectionOptions */ |
| 87 | AFC_OP_SET_FS_BS = 0x00000019, /* SetFSBlockSize (0x800000) */ | 88 | AFC_OP_RENAME_PATH = 0x00000018, /* RenamePath */ |
| 88 | AFC_OP_SET_SOCKET_BS = 0x0000001A, /* SetSocketBlockSize (0x800000) */ | 89 | AFC_OP_SET_FS_BS = 0x00000019, /* SetFSBlockSize (0x800000) */ |
| 89 | AFC_OP_FILE_LOCK = 0x0000001B, /* FileRefLock */ | 90 | AFC_OP_SET_SOCKET_BS = 0x0000001A, /* SetSocketBlockSize (0x800000) */ |
| 90 | AFC_OP_MAKE_LINK = 0x0000001C, /* MakeLink */ | 91 | AFC_OP_FILE_LOCK = 0x0000001B, /* FileRefLock */ |
| 91 | AFC_OP_SET_FILE_TIME = 0x0000001E /* set st_mtime */ | 92 | AFC_OP_MAKE_LINK = 0x0000001C, /* MakeLink */ |
| 93 | AFC_OP_GET_FILE_HASH = 0x0000001D, /* GetFileHash */ | ||
| 94 | AFC_OP_SET_FILE_MOD_TIME = 0x0000001E, /* SetModTime */ | ||
| 95 | AFC_OP_GET_FILE_HASH_RANGE = 0x0000001F, /* GetFileHashWithRange */ | ||
| 96 | /* iOS 6+ */ | ||
| 97 | AFC_OP_FILE_SET_IMMUTABLE_HINT = 0x00000020, /* FileRefSetImmutableHint */ | ||
| 98 | AFC_OP_GET_SIZE_OF_PATH_CONTENTS = 0x00000021, /* GetSizeOfPathContents */ | ||
| 99 | AFC_OP_REMOVE_PATH_AND_CONTENTS = 0x00000022, /* RemovePathAndContents */ | ||
| 100 | AFC_OP_DIR_OPEN = 0x00000023, /* DirectoryEnumeratorRefOpen */ | ||
| 101 | AFC_OP_DIR_OPEN_RESULT = 0x00000024, /* DirectoryEnumeratorRefOpenResult */ | ||
| 102 | AFC_OP_DIR_READ = 0x00000025, /* DirectoryEnumeratorRefRead */ | ||
| 103 | AFC_OP_DIR_CLOSE = 0x00000026, /* DirectoryEnumeratorRefClose */ | ||
| 104 | /* iOS 7+ */ | ||
| 105 | AFC_OP_FILE_READ_OFFSET = 0x00000027, /* FileRefReadWithOffset */ | ||
| 106 | AFC_OP_FILE_WRITE_OFFSET = 0x00000028 /* FileRefWriteWithOffset */ | ||
| 92 | }; | 107 | }; |
| 93 | 108 | ||
| 94 | afc_error_t afc_client_new_with_service_client(service_client_t service_client, afc_client_t *client); | 109 | afc_error_t afc_client_new_with_service_client(service_client_t service_client, afc_client_t *client); |
