summaryrefslogtreecommitdiffstats
path: root/src/ftab.h
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2019-09-25 02:26:19 +0200
committerGravatar Nikias Bassen2019-09-25 02:26:19 +0200
commit214d9984c33a5a0eac1d890d917a054268b98879 (patch)
treedd48ea84fb0858a0eeebc28087d0bec43d293a8c /src/ftab.h
parent3b746b8d0741a93aee5cd1242b6fae6a2e439a96 (diff)
downloadidevicerestore-214d9984c33a5a0eac1d890d917a054268b98879.tar.gz
idevicerestore-214d9984c33a5a0eac1d890d917a054268b98879.tar.bz2
Add support for 'ftab' file format
Diffstat (limited to 'src/ftab.h')
-rw-r--r--src/ftab.h69
1 files changed, 69 insertions, 0 deletions
diff --git a/src/ftab.h b/src/ftab.h
new file mode 100644
index 0000000..2efdac3
--- /dev/null
+++ b/src/ftab.h
@@ -0,0 +1,69 @@
+/*
+ * ftab.h
+ * Functions for handling the ftab format
+ *
+ * Copyright (c) 2019 Nikias Bassen. All Rights Reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef IDEVICERESTORE_FTAB_H
+#define IDEVICERESTORE_FTAB_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct ftab_header {
+ uint32_t always_01; // 1
+ uint32_t always_ff; // 0xFFFFFFFF
+ uint32_t unk_0x08; // 0
+ uint32_t unk_0x0C; // 0
+ uint32_t unk_0x10; // 0
+ uint32_t unk_0x14; // 0
+ uint32_t unk_0x18; // 0
+ uint32_t unk_0x1C; // 0
+ uint32_t tag; // e.g. 'rkos'
+ uint32_t magic; // 'ftab' magic
+ uint32_t num_entries;
+ uint32_t pad_0x2C;
+};
+
+struct ftab_entry {
+ uint32_t tag;
+ uint32_t offset;
+ uint32_t size;
+ uint32_t pad_0x0C;
+};
+
+struct ftab_fmt {
+ struct ftab_header header;
+ struct ftab_entry *entries;
+ unsigned char **storage;
+};
+
+typedef struct ftab_fmt *ftab_t;
+
+int ftab_parse(unsigned char *data, unsigned int data_size, ftab_t *ftab, uint32_t *tag);
+int ftab_get_entry_ptr(ftab_t ftab, uint32_t tag, unsigned char **data, unsigned int *data_size);
+int ftab_add_entry(ftab_t ftab, uint32_t tag, unsigned char *data, unsigned int data_size);
+int ftab_write(ftab_t ftab, unsigned char **data, unsigned int *data_size);
+int ftab_free(ftab_t ftab);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif