packio

view src/archive.h @ 1:a5728bc6a02f

moving along
author John Tsiombikas <nuclear@member.fsf.org>
date Fri, 09 Jan 2015 02:31:29 +0200
parents
children
line source
1 #ifndef ARCHIVE_H_
2 #define ARCHIVE_H_
4 typedef void AR_FILE;
6 struct archive;
8 struct archive_module {
9 char *name;
10 void *data;
12 struct archive *(*load_archive)(FILE *fp, void *data);
13 int (*close_archive)(struct archive *ar, void *data);
15 AR_FILE *(*open)(struct archive *ar, const char *path, void *data);
16 int (*close)(struct archive *ar, AR_FILE *fp, void *data);
17 int (*read)(struct archive *ar, AR_FILE *fp, void *buf, int sz, void *data);
18 int (*write)(struct archive *ar, AR_FILE *fp, void *buf, int sz, void *data);
19 int (*seek)(struct archive *ar, AR_FILE *fp, int offs, int whence, void *data);
21 struct archive_module *next;
22 };
24 struct archive {
25 FILE *fp;
26 struct archive_module *module;
27 };
29 int pkio_reg_archive_module(struct archive_module *m);
31 struct archive *pkio_load_archive(const char *fname);
32 struct archive *pkio_load_archive_file(FILE *fp);
33 void pkio_close_archive(struct archive *ar);
35 /* these map onto the function pointers used by the archive module */
36 AR_FILE *pkio_ar_open(struct archive *ar, const char *path);
37 int pkio_ar_close(struct archive *ar, AR_FILE *fp);
38 int pkio_ar_read(struct archive *ar, AR_FILE *fp, void *buf, int sz);
39 int pkio_ar_write(struct archive *ar, AR_FILE *fp, void *buf, int sz);
40 int pkio_ar_seek(struct archive *ar, AR_FILE *fp, int offs, int whence);
42 #endif /* ARCHIVE_H_ */