PageRenderTime 9ms CodeModel.GetById 2ms app.highlight 4ms RepoModel.GetById 1ms app.codeStats 0ms

/src/zziplib/zzip/lib.h

https://bitbucket.org/cabalistic/ogredeps/
C++ Header | 91 lines | 56 code | 11 blank | 24 comment | 0 complexity | 31f49efb3d33a4da252c1d74b227bbd6 MD5 | raw file
 1/*
 2 * Author: 
 3 *      Guido Draheim <guidod@gmx.de>
 4 *      Tomi Ollila <Tomi.Ollila@iki.fi>
 5 *
 6 * Copyright (c) 1999,2000,2001,2002,2003 Guido Draheim
 7 *          All rights reserved
 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
12 *
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.
17 */
18#ifndef _ZZIP_LIB_H /* zzip.h */
19#define _ZZIP_LIB_H
20
21#include <zzip/zzip.h>
22#include <zzip/plugin.h>
23#include <zzip/stdint.h>
24#include <zzip/zzip32.h>
25
26#ifdef __cplusplus
27extern "C" {
28#endif
29
30/*
31 * this structure cannot be wildly enlarged... (see zzip-zip.c)
32 */
33struct zzip_dir_hdr
34{
35    uint32_t    d_usize;        /* uncompressed size */
36    uint32_t    d_csize;        /* compressed size */
37    uint32_t    d_crc32;        /* the adler32-checksum */
38    uint32_t    d_off;          /* offset of file in zipfile */
39    uint16_t    d_reclen;       /* next dir_hdr structure offset */
40    uint16_t    d_namlen;       /* explicit namelen of d_name */
41    uint8_t     d_compr;        /* the compression type, 0 = store, 8 = inflate */
42    char        d_name[1];      /* the actual name of the entry, may contain DIRSEPs */
43};
44#define _ZZIP_DIRENT_HAVE_D_NAMLEN
45#define _ZZIP_DIRENT_HAVE_D_OFF
46#define _ZZIP_DIRENT_HAVE_D_RECLEN
47
48/*
49 * you shall not use this struct anywhere else than in zziplib sources.
50 */
51struct zzip_dir
52{
53    int fd;
54    int errcode; /* zzip_error_t */
55    long refcount;
56    struct { /* reduce a lot of alloc/deallocations by caching these: */
57	int * volatile locked;
58        struct zzip_file * volatile fp;  
59        char * volatile buf32k; 
60    } cache;
61    struct zzip_dir_hdr * hdr0;  /* zfi; */
62    struct zzip_dir_hdr * hdr;   /* zdp; directory pointer, for dirent stuff */
63    struct zzip_file * currentfp; /* last fp used... */
64    struct zzip_dirent dirent;
65    void*  realdir;               /* e.g. DIR* from posix dirent.h */
66    char*  realname;
67    zzip_strings_t* fileext;      /* list of fileext to test for */
68    zzip_plugin_io_t io;          /* vtable for io routines */
69}; 
70
71#define ZZIP_32K 32768
72
73/* try to open a zip-basename with default_fileext */
74int      __zzip_try_open (zzip_char_t* filename, int filemode,
75                          zzip_strings_t* ext, zzip_plugin_io_t io);
76
77ZZIP_DIR * 
78zzip_dir_fdopen(int fd, zzip_error_t * errcode_p);
79
80ZZIP_DIR* 
81zzip_dir_fdopen_ext_io(int fd, zzip_error_t * errorcode_p,
82                       zzip_strings_t* ext, const zzip_plugin_io_t io);
83
84ZZIP_DIR* /*depracated*/
85zzip_dir_alloc_ext_io (zzip_strings_t* ext, const zzip_plugin_io_t io);
86
87#ifdef __cplusplus
88}
89#endif
90#endif /* _ZZIP_H */
91