Debian Codegraph @

libs/zziplib/zziplib-src/zzip/lib.h

raw
1 /*
2 * Author:
3 * Guido Draheim <[email protected]>
4 * Tomi Ollila <[email protected]>
5 *
6 * Copyright (c) Guido Draheim, use under copyleft (LGPL,MPL)
7 *
8 * This is the private header containing definitions that are not
9 * use by a libzzip user application. Writing an extension lib that
10 * uses libzzip will still want to include this. The extension
11 * write should make way to have the ISO C9X integer types defined.
12 */
13 #ifndef _ZZIP_LIB_H /* zzip.h */
14 #define _ZZIP_LIB_H
15
16 #include <zzip/zzip.h>
17 #include <zzip/plugin.h>
18 #include <zzip/stdint.h>
19 #include <zzip/zzip32.h>
20
21 #ifdef __cplusplus
22 extern "C" {
23 #endif
24
25 /*
26 * this structure cannot be wildly enlarged... (see zzip-zip.c)
27 */
28 struct zzip_dir_hdr
29 {
30 uint32_t d_usize; /* uncompressed size */
31 uint32_t d_csize; /* compressed size */
32 uint32_t d_crc32; /* the adler32-checksum */
33 uint32_t d_off; /* offset of file in zipfile */
34 uint16_t d_reclen; /* next dir_hdr structure offset */
35 uint16_t d_namlen; /* explicit namelen of d_name */
36 uint8_t d_compr; /* the compression type, 0 = store, 8 = inflate */
37 char d_name[1]; /* the actual name of the entry, may contain DIRSEPs */
38 };
39 #define _ZZIP_DIRENT_HAVE_D_NAMLEN
40 #define _ZZIP_DIRENT_HAVE_D_OFF
41 #define _ZZIP_DIRENT_HAVE_D_RECLEN
42
43 /*
44 * you shall not use this struct anywhere else than in zziplib sources.
45 */
46 struct zzip_dir
47 {
48 int fd;
49 int errcode; /* zzip_error_t */
50 long refcount;
51 struct { /* reduce a lot of alloc/deallocations by caching these: */
52 int * volatile locked;
53 struct zzip_file * volatile fp;
54 char * volatile buf32k;
55 } cache;
56 struct zzip_dir_hdr * hdr0; /* zfi; */
57 struct zzip_dir_hdr * hdr; /* zdp; directory pointer, for dirent stuff */
58 struct zzip_file * currentfp; /* last fp used... */
59 struct zzip_dirent dirent;
60 void* realdir; /* e.g. DIR* from posix dirent.h */
61 char* realname;
62 zzip_strings_t* fileext; /* list of fileext to test for */
63 zzip_plugin_io_t io; /* vtable for io routines */
64 };
65
66 #define ZZIP_32K 32768
67
68 /* try to open a zip-basename with default_fileext */
69 int __zzip_try_open (zzip_char_t* filename, int filemode,
70 zzip_strings_t* ext, zzip_plugin_io_t io);
71
72 ZZIP_DIR *
73 zzip_dir_fdopen(int fd, zzip_error_t * errcode_p);
74
75 ZZIP_DIR*
76 zzip_dir_fdopen_ext_io(int fd, zzip_error_t * errorcode_p,
77 zzip_strings_t* ext, const zzip_plugin_io_t io);
78
79 ZZIP_DIR* /*deprecated*/
80 zzip_dir_alloc_ext_io (zzip_strings_t* ext, const zzip_plugin_io_t io);
81
82 #ifdef __cplusplus
83 }
84 #endif
85 #endif /* _ZZIP_H */
86