summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/afc.c7
-rw-r--r--src/afc.h73
2 files changed, 48 insertions, 32 deletions
diff --git a/src/afc.c b/src/afc.c
index 4a50131..ae5e245 100644
--- a/src/afc.c
+++ b/src/afc.c
@@ -2,6 +2,7 @@
* afc.c
* Contains functions for the built-in AFC client.
*
+ * Copyright (c) 2014 Martin Szulecki All Rights Reserved.
* Copyright (c) 2009-2014 Nikias Bassen. All Rights Reserved.
* Copyright (c) 2008 Zach C. All Rights Reserved.
*
@@ -679,7 +680,7 @@ afc_error_t afc_file_read(afc_client_t client, uint64_t handle, char *data, uint
} readinfo;
readinfo.handle = handle;
readinfo.size = htole64(length);
- ret = afc_dispatch_packet(client, AFC_OP_READ, (const char*)&readinfo, sizeof(readinfo), NULL, 0, &bytes_loc);
+ ret = afc_dispatch_packet(client, AFC_OP_FILE_READ, (const char*)&readinfo, sizeof(readinfo), NULL, 0, &bytes_loc);
if (ret != AFC_E_SUCCESS) {
afc_unlock(client);
@@ -726,7 +727,7 @@ afc_error_t afc_file_write(afc_client_t client, uint64_t handle, const char *dat
debug_info("Write length: %i", length);
- ret = afc_dispatch_packet(client, AFC_OP_WRITE, (const char*)&handle, 8, data, length, &bytes_loc);
+ ret = afc_dispatch_packet(client, AFC_OP_FILE_WRITE, (const char*)&handle, 8, data, length, &bytes_loc);
current_count += bytes_loc - (sizeof(AFCPacket) + 8);
@@ -983,7 +984,7 @@ afc_error_t afc_set_file_time(afc_client_t client, const char *path, uint64_t mt
/* Send command */
memcpy(buffer, &mtime_loc, 8);
memcpy(buffer + 8, path, strlen(path) + 1);
- ret = afc_dispatch_packet(client, AFC_OP_SET_FILE_TIME, buffer, 8 + strlen(path) + 1, NULL, 0, &bytes);
+ ret = afc_dispatch_packet(client, AFC_OP_SET_FILE_MOD_TIME, buffer, 8 + strlen(path) + 1, NULL, 0, &bytes);
free(buffer);
if (ret != AFC_E_SUCCESS) {
afc_unlock(client);
diff --git a/src/afc.h b/src/afc.h
index 54b07a5..15bd354 100644
--- a/src/afc.h
+++ b/src/afc.h
@@ -2,6 +2,7 @@
* afc.h
* Defines and structs and the like for the built-in AFC client
*
+ * Copyright (c) 2014 Martin Szulecki All Rights Reserved.
* Copyright (c) 2008 Zach C. All Rights Reserved.
*
* This library is free software; you can redistribute it and/or
@@ -60,35 +61,49 @@ struct afc_client_private {
/* AFC Operations */
enum {
- AFC_OP_STATUS = 0x00000001, /* Status */
- AFC_OP_DATA = 0x00000002, /* Data */
- AFC_OP_READ_DIR = 0x00000003, /* ReadDir */
- AFC_OP_READ_FILE = 0x00000004, /* ReadFile */
- AFC_OP_WRITE_FILE = 0x00000005, /* WriteFile */
- AFC_OP_WRITE_PART = 0x00000006, /* WritePart */
- AFC_OP_TRUNCATE = 0x00000007, /* TruncateFile */
- AFC_OP_REMOVE_PATH = 0x00000008, /* RemovePath */
- AFC_OP_MAKE_DIR = 0x00000009, /* MakeDir */
- AFC_OP_GET_FILE_INFO = 0x0000000a, /* GetFileInfo */
- AFC_OP_GET_DEVINFO = 0x0000000b, /* GetDeviceInfo */
- AFC_OP_WRITE_FILE_ATOM = 0x0000000c, /* WriteFileAtomic (tmp file+rename) */
- AFC_OP_FILE_OPEN = 0x0000000d, /* FileRefOpen */
- AFC_OP_FILE_OPEN_RES = 0x0000000e, /* FileRefOpenResult */
- AFC_OP_READ = 0x0000000f, /* FileRefRead */
- AFC_OP_WRITE = 0x00000010, /* FileRefWrite */
- AFC_OP_FILE_SEEK = 0x00000011, /* FileRefSeek */
- AFC_OP_FILE_TELL = 0x00000012, /* FileRefTell */
- AFC_OP_FILE_TELL_RES = 0x00000013, /* FileRefTellResult */
- AFC_OP_FILE_CLOSE = 0x00000014, /* FileRefClose */
- AFC_OP_FILE_SET_SIZE = 0x00000015, /* FileRefSetFileSize (ftruncate) */
- AFC_OP_GET_CON_INFO = 0x00000016, /* GetConnectionInfo */
- AFC_OP_SET_CON_OPTIONS = 0x00000017, /* SetConnectionOptions */
- AFC_OP_RENAME_PATH = 0x00000018, /* RenamePath */
- AFC_OP_SET_FS_BS = 0x00000019, /* SetFSBlockSize (0x800000) */
- AFC_OP_SET_SOCKET_BS = 0x0000001A, /* SetSocketBlockSize (0x800000) */
- AFC_OP_FILE_LOCK = 0x0000001B, /* FileRefLock */
- AFC_OP_MAKE_LINK = 0x0000001C, /* MakeLink */
- AFC_OP_SET_FILE_TIME = 0x0000001E /* set st_mtime */
+ AFC_OP_INVALID = 0x00000000, /* Invalid */
+ AFC_OP_STATUS = 0x00000001, /* Status */
+ AFC_OP_DATA = 0x00000002, /* Data */
+ AFC_OP_READ_DIR = 0x00000003, /* ReadDir */
+ AFC_OP_READ_FILE = 0x00000004, /* ReadFile */
+ AFC_OP_WRITE_FILE = 0x00000005, /* WriteFile */
+ AFC_OP_WRITE_PART = 0x00000006, /* WritePart */
+ AFC_OP_TRUNCATE = 0x00000007, /* TruncateFile */
+ AFC_OP_REMOVE_PATH = 0x00000008, /* RemovePath */
+ AFC_OP_MAKE_DIR = 0x00000009, /* MakeDir */
+ AFC_OP_GET_FILE_INFO = 0x0000000A, /* GetFileInfo */
+ AFC_OP_GET_DEVINFO = 0x0000000B, /* GetDeviceInfo */
+ AFC_OP_WRITE_FILE_ATOM = 0x0000000C, /* WriteFileAtomic (tmp file+rename) */
+ AFC_OP_FILE_OPEN = 0x0000000D, /* FileRefOpen */
+ AFC_OP_FILE_OPEN_RES = 0x0000000E, /* FileRefOpenResult */
+ AFC_OP_FILE_READ = 0x0000000F, /* FileRefRead */
+ AFC_OP_FILE_WRITE = 0x00000010, /* FileRefWrite */
+ AFC_OP_FILE_SEEK = 0x00000011, /* FileRefSeek */
+ AFC_OP_FILE_TELL = 0x00000012, /* FileRefTell */
+ AFC_OP_FILE_TELL_RES = 0x00000013, /* FileRefTellResult */
+ AFC_OP_FILE_CLOSE = 0x00000014, /* FileRefClose */
+ AFC_OP_FILE_SET_SIZE = 0x00000015, /* FileRefSetFileSize (ftruncate) */
+ AFC_OP_GET_CON_INFO = 0x00000016, /* GetConnectionInfo */
+ AFC_OP_SET_CON_OPTIONS = 0x00000017, /* SetConnectionOptions */
+ AFC_OP_RENAME_PATH = 0x00000018, /* RenamePath */
+ AFC_OP_SET_FS_BS = 0x00000019, /* SetFSBlockSize (0x800000) */
+ AFC_OP_SET_SOCKET_BS = 0x0000001A, /* SetSocketBlockSize (0x800000) */
+ AFC_OP_FILE_LOCK = 0x0000001B, /* FileRefLock */
+ AFC_OP_MAKE_LINK = 0x0000001C, /* MakeLink */
+ AFC_OP_GET_FILE_HASH = 0x0000001D, /* GetFileHash */
+ AFC_OP_SET_FILE_MOD_TIME = 0x0000001E, /* SetModTime */
+ AFC_OP_GET_FILE_HASH_RANGE = 0x0000001F, /* GetFileHashWithRange */
+ /* iOS 6+ */
+ AFC_OP_FILE_SET_IMMUTABLE_HINT = 0x00000020, /* FileRefSetImmutableHint */
+ AFC_OP_GET_SIZE_OF_PATH_CONTENTS = 0x00000021, /* GetSizeOfPathContents */
+ AFC_OP_REMOVE_PATH_AND_CONTENTS = 0x00000022, /* RemovePathAndContents */
+ AFC_OP_DIR_OPEN = 0x00000023, /* DirectoryEnumeratorRefOpen */
+ AFC_OP_DIR_OPEN_RESULT = 0x00000024, /* DirectoryEnumeratorRefOpenResult */
+ AFC_OP_DIR_READ = 0x00000025, /* DirectoryEnumeratorRefRead */
+ AFC_OP_DIR_CLOSE = 0x00000026, /* DirectoryEnumeratorRefClose */
+ /* iOS 7+ */
+ AFC_OP_FILE_READ_OFFSET = 0x00000027, /* FileRefReadWithOffset */
+ AFC_OP_FILE_WRITE_OFFSET = 0x00000028 /* FileRefWriteWithOffset */
};
afc_error_t afc_client_new_with_service_client(service_client_t service_client, afc_client_t *client);