reposerve server half way done
[reposerve] / src / proto.h
diff --git a/src/proto.h b/src/proto.h
new file mode 100644 (file)
index 0000000..e7a043a
--- /dev/null
@@ -0,0 +1,34 @@
+#ifndef PROTO_H_
+#define PROTO_H_
+
+#include <stdint.h>
+
+struct proto_file_entry {
+       uint32_t csum[4];
+       uint32_t mtime;
+       uint32_t size;
+       uint32_t nameoffs;
+       uint32_t namelen;
+};
+
+struct proto_flist {
+       uint32_t num_files;
+       struct proto_file_entry files[1];
+};
+
+struct flist {
+       struct proto_flist *flist;
+       int max_files;
+       char *data;
+       int data_sz, max_data_sz;
+
+       int final_size;
+};
+
+struct flist *flist_create(void);
+void flist_destroy(struct flist *flist);
+
+int flist_add(struct flist *flist, const char *fname, int contents);
+int flist_finalize(struct flist *flist);
+
+#endif /* PROTO_H_ */