summaryrefslogtreecommitdiffstats
path: root/src/metainfo.h
blob: 774b91aff6bf8c6caf91a9503619d07316848a25 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
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);