summaryrefslogtreecommitdiffstats
path: root/src/metainfo.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/metainfo.h')
-rw-r--r--src/metainfo.h37
1 files changed, 37 insertions, 0 deletions
diff --git a/src/metainfo.h b/src/metainfo.h
new file mode 100644
index 0000000..774b91a
--- /dev/null
+++ b/src/metainfo.h
@@ -0,0 +1,37 @@
+typedef unsigned inode_length_t;
+struct inode {
+ char * name;
+ size_t length;
+ struct inode * next;
+ struct inode * child;
+ struct inode * parent;
+};
+const struct inode * next_file (const struct inode * inode);
+const struct inode * next_inode (const struct inode * inode, int * paths);
+enum type {
+ UNSPEC = 0,
+ V1 = 1,
+ V2 = 2,
+ HYBRID = 1 | 2
+};
+char * type_str[] = { "UNSPEC", "V1", "V2", "HYBRID" };
+struct metainfo {
+ struct inode * files;
+ struct sockaddr_in6 ip;
+ time_t retrieved;
+ time_t created;
+ enum type type;
+ unsigned char sha1[20];
+ unsigned char sha256[32];
+ char * name;
+ char * client;
+ char * source;
+ char * publisher;
+ char * publisher_url;
+ char * comment;
+ unsigned filecount;
+ inode_length_t length;
+};
+void metainfo_free (struct metainfo * metainfo);
+struct metainfo * parse (const char * data, off_t size);
+int directory (const char * path, struct metainfo *** out);