added assfile
[raydungeon] / libs / assfile / assfile_impl.h
1 /*
2 assfile - library for accessing assets with an fopen/fread-like interface
3 Copyright (C) 2018  John Tsiombikas <nuclear@member.fsf.org>
4
5 This program is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 GNU Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public License
16 along with this program.  If not, see <https://www.gnu.org/licenses/>.
17 */
18 #ifndef ASSFILE_IMPL_H_
19 #define ASSFILE_IMPL_H_
20
21 typedef struct ass_file ass_file;
22
23 #include "assfile.h"
24
25 struct ass_file {
26         void *file;
27         struct ass_fileops *fop;
28 };
29
30 struct mount {
31         char *prefix;
32         struct ass_fileops *fop;
33         int type;
34
35         struct mount *next;
36 };
37
38 enum {
39         MOD_PATH,
40         MOD_ARCHIVE,
41         MOD_URL,
42         MOD_USER
43 };
44
45 /* implemented in mod_*.c files */
46 struct ass_fileops *ass_alloc_path(const char *path);
47 void ass_free_path(struct ass_fileops *fop);
48 struct ass_fileops *ass_alloc_archive(const char *fname);
49 void ass_free_archive(struct ass_fileops *fop);
50 struct ass_fileops *ass_alloc_url(const char *url);
51 void ass_free_url(struct ass_fileops *fop);
52
53 extern int ass_mod_url_max_threads;
54 extern char ass_mod_url_cachedir[512];
55
56 extern int ass_verbose;
57
58 #endif  /* ASSFILE_IMPL_H_ */