flist request
[reposerve] / src / proto.h
1 #ifndef PROTO_H_
2 #define PROTO_H_
3
4 #include <stdint.h>
5
6 struct proto_file_entry {
7         uint32_t csum[4];
8         uint32_t mtime;
9         uint32_t size;
10         uint32_t nameoffs;
11         uint32_t namelen;
12 };
13
14 struct proto_flist {
15         uint32_t num_files;
16         struct proto_file_entry files[1];
17 };
18
19 struct flist {
20         struct proto_flist *flist;
21         int max_files;
22         char *data;
23         int data_sz, max_data_sz;
24
25         int final_size;
26 };
27
28 struct flist *flist_create(void);
29 void flist_destroy(struct flist *flist);
30
31 int flist_add(struct flist *flist, const char *fname, int contents);
32 int flist_finalize(struct flist *flist);
33
34 int read_line(int s, char *buf, int bufsz);
35 int read_resp(int s);
36
37 #endif  /* PROTO_H_ */