3 * Guido Draheim <guidod@gmx.de>
4 * Tomi Ollila <Tomi.Ollila@iki.fi>
6 * Copyright (c) 1999,2000,2001,2002,2003 Guido Draheim
8 * use under the restrictions of the
9 * Lesser GNU General Public License
10 * or alternatively the restrictions
11 * of the Mozilla Public License 1.1
13 * This is the private header containing definitions that are not
14 * use by a libzzip user application. Writing an extension lib that
15 * uses libzzip will still want to include this. The extension
16 * write should make way to have the ISO C9X integer types defined.
18 #ifndef _ZZIP_LIB_H /* zzip.h */
21 #include <zzip/zzip.h>
22 #include <zzip/plugin.h>
23 #include <zzip/stdint.h>
26 * this structure cannot be wildly enlarged... (see zzip-zip.c)
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 */
39 #define _ZZIP_DIRENT_HAVE_D_NAMLEN
40 #define _ZZIP_DIRENT_HAVE_D_OFF
41 #define _ZZIP_DIRENT_HAVE_D_RECLEN
44 * you shall not use this struct anywhere else than in zziplib sources.
49 int errcode; /* zzip_error_t */
52 struct zzip_file * fp; /* reduce a lot of alloc/deallocations by */
53 char * buf32k; /* caching one entry of these data structures */
55 struct zzip_dir_hdr * hdr0; /* zfi; */
56 struct zzip_dir_hdr * hdr; /* zdp; directory pointer, for dirent stuff */
57 struct zzip_file * currentfp; /* last fp used... */
58 struct zzip_dirent dirent;
59 void* realdir; /* e.g. DIR* from posix dirent.h */
61 zzip_strings_t* fileext; /* list of fileext to test for */
62 zzip_plugin_io_t io; /* vtable for io routines */
65 #define ZZIP_32K 32768
67 /* try to open a zip-basename with default_fileext */
68 int __zzip_try_open (zzip_char_t* filename, int filemode,
69 zzip_strings_t* ext, zzip_plugin_io_t io);
72 zzip_dir_fdopen(int fd, zzip_error_t * errcode_p);
75 zzip_dir_fdopen_ext_io(int fd, zzip_error_t * errorcode_p,
76 zzip_strings_t* ext, const zzip_plugin_io_t io);
78 ZZIP_DIR* /*depracated*/
79 zzip_dir_alloc_ext_io (zzip_strings_t* ext, const zzip_plugin_io_t io);
81 /* get 16/32 bits from little-endian zip-file to host byteorder */
82 uint32_t __zzip_get32(unsigned char * s);
83 uint16_t __zzip_get16(unsigned char * s);
86 #define ZZIP_GET32(x) (*(uint32_t*)(x))
87 #define ZZIP_GET16(x) (*(uint16_t*)(x))
89 #define ZZIP_GET32(x) (__zzip_get32(x))
90 #define ZZIP_GET16(x) (__zzip_get16(x))