Initial revision
[silc.git] / lib / zlib / contrib / minizip / zip.h
1 /* zip.h -- IO for compress .zip files using zlib 
2    Version 0.15 alpha, Mar 19th, 1998,
3
4    Copyright (C) 1998 Gilles Vollant
5
6    This unzip package allow creates .ZIP file, compatible with PKZip 2.04g
7      WinZip, InfoZip tools and compatible.
8    Encryption and multi volume ZipFile (span) are not supported.
9    Old compressions used by old PKZip 1.x are not supported
10
11   For uncompress .zip file, look at unzip.h
12
13    THIS IS AN ALPHA VERSION. AT THIS STAGE OF DEVELOPPEMENT, SOMES API OR STRUCTURE
14    CAN CHANGE IN FUTURE VERSION !!
15    I WAIT FEEDBACK at mail info@winimage.com
16    Visit also http://www.winimage.com/zLibDll/zip.htm for evolution
17
18    Condition of use and distribution are the same than zlib :
19
20   This software is provided 'as-is', without any express or implied
21   warranty.  In no event will the authors be held liable for any damages
22   arising from the use of this software.
23
24   Permission is granted to anyone to use this software for any purpose,
25   including commercial applications, and to alter it and redistribute it
26   freely, subject to the following restrictions:
27
28   1. The origin of this software must not be misrepresented; you must not
29      claim that you wrote the original software. If you use this software
30      in a product, an acknowledgment in the product documentation would be
31      appreciated but is not required.
32   2. Altered source versions must be plainly marked as such, and must not be
33      misrepresented as being the original software.
34   3. This notice may not be removed or altered from any source distribution.
35
36
37 */
38
39 /* for more info about .ZIP format, see 
40       ftp://ftp.cdrom.com/pub/infozip/doc/appnote-970311-iz.zip
41    PkWare has also a specification at :
42       ftp://ftp.pkware.com/probdesc.zip
43 */
44
45 #ifndef _zip_H
46 #define _zip_H
47
48 #ifdef __cplusplus
49 extern "C" {
50 #endif
51
52 #ifndef _ZLIB_H
53 #include "zlib.h"
54 #endif
55
56 #if defined(STRICTZIP) || defined(STRICTZIPUNZIP)
57 /* like the STRICT of WIN32, we define a pointer that cannot be converted
58     from (void*) without cast */
59 typedef struct TagzipFile__ { int unused; } zipFile__; 
60 typedef zipFile__ *zipFile;
61 #else
62 typedef voidp zipFile;
63 #endif
64
65 #define ZIP_OK                                  (0)
66 #define ZIP_ERRNO               (Z_ERRNO)
67 #define ZIP_PARAMERROR                  (-102)
68 #define ZIP_INTERNALERROR               (-104)
69
70 /* tm_zip contain date/time info */
71 typedef struct tm_zip_s 
72 {
73         uInt tm_sec;            /* seconds after the minute - [0,59] */
74         uInt tm_min;            /* minutes after the hour - [0,59] */
75         uInt tm_hour;           /* hours since midnight - [0,23] */
76         uInt tm_mday;           /* day of the month - [1,31] */
77         uInt tm_mon;            /* months since January - [0,11] */
78         uInt tm_year;           /* years - [1980..2044] */
79 } tm_zip;
80
81 typedef struct
82 {
83         tm_zip      tmz_date;       /* date in understandable format           */
84     uLong       dosDate;       /* if dos_date == 0, tmu_date is used      */
85 /*    uLong       flag;        */   /* general purpose bit flag        2 bytes */
86
87     uLong       internal_fa;    /* internal file attributes        2 bytes */
88     uLong       external_fa;    /* external file attributes        4 bytes */
89 } zip_fileinfo;
90
91 extern zipFile ZEXPORT zipOpen OF((const char *pathname, int append));
92 /*
93   Create a zipfile.
94          pathname contain on Windows NT a filename like "c:\\zlib\\zlib111.zip" or on
95            an Unix computer "zlib/zlib111.zip".
96          if the file pathname exist and append=1, the zip will be created at the end
97            of the file. (useful if the file contain a self extractor code)
98          If the zipfile cannot be opened, the return value is NULL.
99      Else, the return value is a zipFile Handle, usable with other function
100            of this zip package.
101
102
103 */
104
105 extern int ZEXPORT zipOpenNewFileInZip OF((zipFile file,
106                                            const char* filename,
107                                            const zip_fileinfo* zipfi,
108                                            const void* extrafield_local,
109                                            uInt size_extrafield_local,
110                                            const void* extrafield_global,
111                                            uInt size_extrafield_global,
112                                            const char* comment,
113                                            int method,
114                                            int level));
115 /*
116   Open a file in the ZIP for writing.
117   filename : the filename in zip (if NULL, '-' without quote will be used
118   *zipfi contain supplemental information
119   if extrafield_local!=NULL and size_extrafield_local>0, extrafield_local
120     contains the extrafield data the the local header
121   if extrafield_global!=NULL and size_extrafield_global>0, extrafield_global
122     contains the extrafield data the the local header
123   if comment != NULL, comment contain the comment string
124   method contain the compression method (0 for store, Z_DEFLATED for deflate)
125   level contain the level of compression (can be Z_DEFAULT_COMPRESSION)
126 */
127
128 extern int ZEXPORT zipWriteInFileInZip OF((zipFile file,
129                                            const voidp buf,
130                                            unsigned len));
131 /*
132   Write data in the zipfile
133 */
134
135 extern int ZEXPORT zipCloseFileInZip OF((zipFile file));
136 /*
137   Close the current file in the zipfile
138 */
139
140 extern int ZEXPORT zipClose OF((zipFile file,
141                                 const char* global_comment));
142 /*
143   Close the zipfile
144 */
145
146 #ifdef __cplusplus
147 }
148 #endif
149
150 #endif /* _zip_H */