summaryrefslogtreecommitdiff
path: root/src/table.h
diff options
context:
space:
mode:
authorjakob <jakob@memeware.net>2017-03-01 19:03:20 -0500
committerjakob <jakob@memeware.net>2017-03-01 19:03:20 -0500
commit0e67a05edcc3ba01221a6bfd14750b5b8090887f (patch)
tree94729dcef273244164d6b84d72d17481818baa7f /src/table.h
parentd65a3ae8790ae28a90f0ebcf0bc4dc078c67dc35 (diff)
First working commit of the rewrite.
Diffstat (limited to 'src/table.h')
-rw-r--r--src/table.h16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/table.h b/src/table.h
index c7c85bb..50124fe 100644
--- a/src/table.h
+++ b/src/table.h
@@ -35,20 +35,18 @@ struct segment {
/* Structure representing an entry in the archive's table section. */
struct table_entry {
- bool encrypted; /* Whether or not it's encrypted. */
- bool compressed; /* Whether or not it's compressed. */
- char *filename; /* String containing file's name. */
uint32_t key; /* File-specific key for encryption. */
uint64_t ctime; /* Timestamp of creation time. */
uint64_t segment_count; /* Number of segments. */
struct segment **segments; /* Array of associated segments. */
+ char *filename; /* String containing file's name. */
struct table_entry *next; /* Pointer to the next entry. */
};
/* Returns the root of a linked list containing all of the files listed
in the archive's table section. */
-struct table_entry *parse_table(struct stream *s);
+struct table_entry *read_table(struct stream *s);
/* Reads the contents of an eliF chunk. If there is an entry with a
matching key in the linked list specified by `root`, that structure
@@ -56,6 +54,16 @@ struct table_entry *parse_table(struct stream *s);
to the linked list. */
void read_elif(struct stream *s, struct table_entry *root);
+/* Reads the contents of a File chunk. If there is an entry with a
+ matching key in the linked list specified by `root`, that structure
+ will be modified. Otherwise, a new entry will be created and appended
+ to the linked list. */
+void read_file(struct stream *s, struct table_entry *root);
+
+/* Traverses `root` for a node with the given key. If the linked list
+ lacks a node with the key, a new node is created and appended. */
+struct table_entry *get_node(struct table_entry *root, uint32_t key);
+
/* Inserts `e` to the end of the linked list specified by `root`. */
void entry_append(struct table_entry *root, struct table_entry *e);