Dieter Baron | 2d6db59 | 1999-07-25 18:26:20 +0000 | [diff] [blame] | 1 | #ifndef _HAD_ZIP_H |
| 2 | #define _HAD_ZIP_H |
| 3 | |
Dieter Baron | bbb6369 | 1999-07-26 22:04:20 +0000 | [diff] [blame] | 4 | /* |
| 5 | zip.h -- exported declarations. |
Thomas Klausner | 123a758 | 2012-02-20 01:42:13 +0100 | [diff] [blame^] | 6 | Copyright (C) 1999-2012 Dieter Baron and Thomas Klausner |
Dieter Baron | bbb6369 | 1999-07-26 22:04:20 +0000 | [diff] [blame] | 7 | |
Dieter Baron | dd9afca | 2003-10-02 14:13:37 +0000 | [diff] [blame] | 8 | This file is part of libzip, a library to manipulate ZIP archives. |
Dieter Baron | b86c433 | 2007-11-07 14:35:13 +0100 | [diff] [blame] | 9 | The authors can be contacted at <libzip@nih.at> |
Dieter Baron | bbb6369 | 1999-07-26 22:04:20 +0000 | [diff] [blame] | 10 | |
Dieter Baron | dd9afca | 2003-10-02 14:13:37 +0000 | [diff] [blame] | 11 | Redistribution and use in source and binary forms, with or without |
| 12 | modification, are permitted provided that the following conditions |
| 13 | are met: |
| 14 | 1. Redistributions of source code must retain the above copyright |
| 15 | notice, this list of conditions and the following disclaimer. |
| 16 | 2. Redistributions in binary form must reproduce the above copyright |
| 17 | notice, this list of conditions and the following disclaimer in |
| 18 | the documentation and/or other materials provided with the |
| 19 | distribution. |
| 20 | 3. The names of the authors may not be used to endorse or promote |
| 21 | products derived from this software without specific prior |
| 22 | written permission. |
| 23 | |
| 24 | THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS |
| 25 | OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
| 26 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| 27 | ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY |
| 28 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
| 29 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE |
| 30 | GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
| 31 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER |
| 32 | IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR |
| 33 | OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN |
| 34 | IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
Dieter Baron | bbb6369 | 1999-07-26 22:04:20 +0000 | [diff] [blame] | 35 | */ |
| 36 | |
| 37 | |
| 38 | |
Dieter Baron | 8bc1276 | 2007-08-22 13:39:13 +0200 | [diff] [blame] | 39 | #ifndef ZIP_EXTERN |
Dieter Baron | f528838 | 2010-02-09 12:25:45 +0100 | [diff] [blame] | 40 | #ifdef _WIN32 |
Dieter Baron | 3c56034 | 2010-02-09 12:22:01 +0100 | [diff] [blame] | 41 | #define ZIP_EXTERN __declspec(dllimport) |
Thomas Klausner | 20b8b58 | 2012-02-13 22:55:23 +0100 | [diff] [blame] | 42 | #elif defined(__GNUC__) && __GNUC__ >= 4 |
| 43 | #define ZIP_EXTERN __attribute__ ((visibility ("default"))) |
Thomas Klausner | 16aa4ff | 2010-02-05 22:18:20 +0100 | [diff] [blame] | 44 | #else |
| 45 | #define ZIP_EXTERN |
| 46 | #endif |
Dieter Baron | 8bc1276 | 2007-08-22 13:39:13 +0200 | [diff] [blame] | 47 | #endif |
| 48 | |
Dieter Baron | 08f2851 | 2005-07-14 14:08:11 +0000 | [diff] [blame] | 49 | #ifdef __cplusplus |
| 50 | extern "C" { |
| 51 | #endif |
| 52 | |
Dieter Baron | c65abed | 2008-08-01 17:04:17 +0200 | [diff] [blame] | 53 | #include <zipconf.h> |
| 54 | |
Dieter Baron | 2d6db59 | 1999-07-25 18:26:20 +0000 | [diff] [blame] | 55 | #include <sys/types.h> |
| 56 | #include <stdio.h> |
Thomas Klausner | 01b2a3c | 1999-07-27 20:35:58 +0000 | [diff] [blame] | 57 | #include <time.h> |
Dieter Baron | 2d6db59 | 1999-07-25 18:26:20 +0000 | [diff] [blame] | 58 | |
Dieter Baron | 2d6db59 | 1999-07-25 18:26:20 +0000 | [diff] [blame] | 59 | /* flags for zip_open */ |
Dieter Baron | b2ed74d | 2004-04-14 14:01:31 +0000 | [diff] [blame] | 60 | |
Dieter Baron | 2d6db59 | 1999-07-25 18:26:20 +0000 | [diff] [blame] | 61 | #define ZIP_CREATE 1 |
| 62 | #define ZIP_EXCL 2 |
| 63 | #define ZIP_CHECKCONS 4 |
Dieter Baron | 6c0681b | 2012-02-13 22:51:05 +0100 | [diff] [blame] | 64 | #define ZIP_TRUNCATE 8 |
Dieter Baron | 2d6db59 | 1999-07-25 18:26:20 +0000 | [diff] [blame] | 65 | |
Dieter Baron | e3f91ef | 2003-10-06 02:50:14 +0000 | [diff] [blame] | 66 | |
Dieter Baron | b2ed74d | 2004-04-14 14:01:31 +0000 | [diff] [blame] | 67 | /* flags for zip_name_locate, zip_fopen, zip_stat, ... */ |
| 68 | |
| 69 | #define ZIP_FL_NOCASE 1 /* ignore case on name lookup */ |
| 70 | #define ZIP_FL_NODIR 2 /* ignore directory component */ |
Thomas Klausner | d0147e9 | 2004-11-17 21:55:17 +0000 | [diff] [blame] | 71 | #define ZIP_FL_COMPRESSED 4 /* read compressed data */ |
Dieter Baron | b2ed74d | 2004-04-14 14:01:31 +0000 | [diff] [blame] | 72 | #define ZIP_FL_UNCHANGED 8 /* use original data, ignoring changes */ |
Dieter Baron | 28ee020 | 2008-05-30 12:58:53 +0200 | [diff] [blame] | 73 | #define ZIP_FL_RECOMPRESS 16 /* force recompression of data */ |
Dieter Baron | ae53a57 | 2009-01-26 23:03:31 +0100 | [diff] [blame] | 74 | #define ZIP_FL_ENCRYPTED 32 /* read encrypted data |
| 75 | (implies ZIP_FL_COMPRESSED) */ |
Thomas Klausner | dc3b5bc | 2012-02-18 00:10:34 +0100 | [diff] [blame] | 76 | #define ZIP_FL_NAME_RAW 64 /* get unmodified name */ |
| 77 | #define ZIP_FL_NAME_GUESS 128 /* guess name encoding */ |
| 78 | #define ZIP_FL_NAME_STRICT 256 /* follow specification strictly */ |
Dieter Baron | b2ed74d | 2004-04-14 14:01:31 +0000 | [diff] [blame] | 79 | |
Dieter Baron | 416df86 | 2008-05-14 14:56:13 +0200 | [diff] [blame] | 80 | /* archive global flags flags */ |
| 81 | |
| 82 | #define ZIP_AFL_TORRENT 1 /* torrent zipped */ |
Dieter Baron | ae53a57 | 2009-01-26 23:03:31 +0100 | [diff] [blame] | 83 | #define ZIP_AFL_RDONLY 2 /* read only -- cannot be cleared */ |
Dieter Baron | 416df86 | 2008-05-14 14:56:13 +0200 | [diff] [blame] | 84 | |
Dieter Baron | 2f3f11c | 2009-02-14 18:58:01 +0100 | [diff] [blame] | 85 | |
| 86 | /* flags for compression and encryption sources */ |
| 87 | |
Dieter Baron | 16d2e63 | 2012-01-16 15:02:32 +0100 | [diff] [blame] | 88 | #define ZIP_CODEC_DECODE 0 /* decompress/decrypt (encode flag not set) */ |
Dieter Baron | 2f3f11c | 2009-02-14 18:58:01 +0100 | [diff] [blame] | 89 | #define ZIP_CODEC_ENCODE 1 /* compress/encrypt */ |
| 90 | |
| 91 | |
Dieter Baron | b2ed74d | 2004-04-14 14:01:31 +0000 | [diff] [blame] | 92 | /* libzip error codes */ |
Dieter Baron | 2d6db59 | 1999-07-25 18:26:20 +0000 | [diff] [blame] | 93 | |
Thomas Klausner | d0147e9 | 2004-11-17 21:55:17 +0000 | [diff] [blame] | 94 | #define ZIP_ER_OK 0 /* N No error */ |
| 95 | #define ZIP_ER_MULTIDISK 1 /* N Multi-disk zip archives not supported */ |
| 96 | #define ZIP_ER_RENAME 2 /* S Renaming temporary file failed */ |
| 97 | #define ZIP_ER_CLOSE 3 /* S Closing zip archive failed */ |
| 98 | #define ZIP_ER_SEEK 4 /* S Seek error */ |
| 99 | #define ZIP_ER_READ 5 /* S Read error */ |
| 100 | #define ZIP_ER_WRITE 6 /* S Write error */ |
| 101 | #define ZIP_ER_CRC 7 /* N CRC error */ |
| 102 | #define ZIP_ER_ZIPCLOSED 8 /* N Containing zip archive was closed */ |
| 103 | #define ZIP_ER_NOENT 9 /* N No such file */ |
| 104 | #define ZIP_ER_EXISTS 10 /* N File already exists */ |
| 105 | #define ZIP_ER_OPEN 11 /* S Can't open file */ |
| 106 | #define ZIP_ER_TMPOPEN 12 /* S Failure to create temporary file */ |
| 107 | #define ZIP_ER_ZLIB 13 /* Z Zlib error */ |
| 108 | #define ZIP_ER_MEMORY 14 /* N Malloc failure */ |
| 109 | #define ZIP_ER_CHANGED 15 /* N Entry has been changed */ |
| 110 | #define ZIP_ER_COMPNOTSUPP 16 /* N Compression method not supported */ |
| 111 | #define ZIP_ER_EOF 17 /* N Premature EOF */ |
| 112 | #define ZIP_ER_INVAL 18 /* N Invalid argument */ |
| 113 | #define ZIP_ER_NOZIP 19 /* N Not a zip archive */ |
| 114 | #define ZIP_ER_INTERNAL 20 /* N Internal error */ |
| 115 | #define ZIP_ER_INCONS 21 /* N Zip archive inconsistent */ |
| 116 | #define ZIP_ER_REMOVE 22 /* S Can't remove file */ |
Dieter Baron | ca7d39a | 2005-01-20 21:00:29 +0000 | [diff] [blame] | 117 | #define ZIP_ER_DELETED 23 /* N Entry has been deleted */ |
Dieter Baron | 63e12d1 | 2009-01-25 23:26:36 +0100 | [diff] [blame] | 118 | #define ZIP_ER_ENCRNOTSUPP 24 /* N Encryption method not supported */ |
Dieter Baron | ae53a57 | 2009-01-26 23:03:31 +0100 | [diff] [blame] | 119 | #define ZIP_ER_RDONLY 25 /* N Read-only archive */ |
| 120 | #define ZIP_ER_NOPASSWD 26 /* N No password provided */ |
Dieter Baron | 2f3f11c | 2009-02-14 18:58:01 +0100 | [diff] [blame] | 121 | #define ZIP_ER_WRONGPASSWD 27 /* N Wrong password provided */ |
Thomas Klausner | 123a758 | 2012-02-20 01:42:13 +0100 | [diff] [blame^] | 122 | #define ZIP_ER_ENCMISMATCH 28 /* N Encoding of name and comment do not match */ |
Dieter Baron | b2ed74d | 2004-04-14 14:01:31 +0000 | [diff] [blame] | 123 | |
| 124 | /* type of system error value */ |
| 125 | |
Dieter Baron | e3f91ef | 2003-10-06 02:50:14 +0000 | [diff] [blame] | 126 | #define ZIP_ET_NONE 0 /* sys_err unused */ |
| 127 | #define ZIP_ET_SYS 1 /* sys_err is errno */ |
Thomas Klausner | d0147e9 | 2004-11-17 21:55:17 +0000 | [diff] [blame] | 128 | #define ZIP_ET_ZLIB 2 /* sys_err is zlib error code */ |
Dieter Baron | 2d6db59 | 1999-07-25 18:26:20 +0000 | [diff] [blame] | 129 | |
Dieter Baron | b2ed74d | 2004-04-14 14:01:31 +0000 | [diff] [blame] | 130 | /* compression methods */ |
Dieter Baron | 2d6db59 | 1999-07-25 18:26:20 +0000 | [diff] [blame] | 131 | |
Dieter Baron | b2ed74d | 2004-04-14 14:01:31 +0000 | [diff] [blame] | 132 | #define ZIP_CM_DEFAULT -1 /* better of deflate or store */ |
| 133 | #define ZIP_CM_STORE 0 /* stored (uncompressed) */ |
| 134 | #define ZIP_CM_SHRINK 1 /* shrunk */ |
| 135 | #define ZIP_CM_REDUCE_1 2 /* reduced with factor 1 */ |
| 136 | #define ZIP_CM_REDUCE_2 3 /* reduced with factor 2 */ |
| 137 | #define ZIP_CM_REDUCE_3 4 /* reduced with factor 3 */ |
| 138 | #define ZIP_CM_REDUCE_4 5 /* reduced with factor 4 */ |
| 139 | #define ZIP_CM_IMPLODE 6 /* imploded */ |
Thomas Klausner | e21b065 | 2004-11-17 21:59:00 +0000 | [diff] [blame] | 140 | /* 7 - Reserved for Tokenizing compression algorithm */ |
Dieter Baron | b2ed74d | 2004-04-14 14:01:31 +0000 | [diff] [blame] | 141 | #define ZIP_CM_DEFLATE 8 /* deflated */ |
| 142 | #define ZIP_CM_DEFLATE64 9 /* deflate64 */ |
| 143 | #define ZIP_CM_PKWARE_IMPLODE 10 /* PKWARE imploding */ |
Thomas Klausner | c3ed804 | 2005-09-06 23:44:25 +0000 | [diff] [blame] | 144 | /* 11 - Reserved by PKWARE */ |
| 145 | #define ZIP_CM_BZIP2 12 /* compressed using BZIP2 algorithm */ |
Dieter Baron | 62e54ee | 2007-11-08 16:00:25 +0100 | [diff] [blame] | 146 | /* 13 - Reserved by PKWARE */ |
| 147 | #define ZIP_CM_LZMA 14 /* LZMA (EFS) */ |
| 148 | /* 15-17 - Reserved by PKWARE */ |
| 149 | #define ZIP_CM_TERSE 18 /* compressed using IBM TERSE (new) */ |
| 150 | #define ZIP_CM_LZ77 19 /* IBM LZ77 z Architecture (PFS) */ |
| 151 | #define ZIP_CM_WAVPACK 97 /* WavPack compressed data */ |
| 152 | #define ZIP_CM_PPMD 98 /* PPMd version I, Rev 1 */ |
Thomas Klausner | 42dd7b7 | 1999-07-25 20:32:18 +0000 | [diff] [blame] | 153 | |
Dieter Baron | 45b1075 | 2006-04-24 14:04:19 +0000 | [diff] [blame] | 154 | /* encryption methods */ |
| 155 | |
| 156 | #define ZIP_EM_NONE 0 /* not encrypted */ |
| 157 | #define ZIP_EM_TRAD_PKWARE 1 /* traditional PKWARE encryption */ |
| 158 | #if 0 /* Strong Encryption Header not parsed yet */ |
| 159 | #define ZIP_EM_DES 0x6601 /* strong encryption: DES */ |
| 160 | #define ZIP_EM_RC2_OLD 0x6602 /* strong encryption: RC2, version < 5.2 */ |
| 161 | #define ZIP_EM_3DES_168 0x6603 |
| 162 | #define ZIP_EM_3DES_112 0x6609 |
| 163 | #define ZIP_EM_AES_128 0x660e |
| 164 | #define ZIP_EM_AES_192 0x660f |
| 165 | #define ZIP_EM_AES_256 0x6610 |
| 166 | #define ZIP_EM_RC2 0x6702 /* strong encryption: RC2, version >= 5.2 */ |
| 167 | #define ZIP_EM_RC4 0x6801 |
| 168 | #endif |
| 169 | #define ZIP_EM_UNKNOWN 0xffff /* unknown algorithm */ |
| 170 | |
Dieter Baron | b2ed74d | 2004-04-14 14:01:31 +0000 | [diff] [blame] | 171 | |
| 172 | |
Thomas Klausner | a70ca5d | 2011-04-09 00:34:27 +0200 | [diff] [blame] | 173 | /* encoding type */ |
| 174 | enum zip_encoding_type { |
Thomas Klausner | dc3b5bc | 2012-02-18 00:10:34 +0100 | [diff] [blame] | 175 | ZIP_ENCODING_UNKNOWN, /* not yet analyzed */ |
Thomas Klausner | a70ca5d | 2011-04-09 00:34:27 +0200 | [diff] [blame] | 176 | ZIP_ENCODING_ASCII, /* plain ASCII */ |
| 177 | ZIP_ENCODING_UTF8, /* possibly UTF-8 */ |
| 178 | ZIP_ENCODING_CP437 /* Code Page 437 */ |
| 179 | }; |
| 180 | |
| 181 | |
| 182 | |
Dieter Baron | 35bf0fd | 2004-12-22 16:32:01 +0000 | [diff] [blame] | 183 | enum zip_source_cmd { |
| 184 | ZIP_SOURCE_OPEN, /* prepare for reading */ |
| 185 | ZIP_SOURCE_READ, /* read data */ |
| 186 | ZIP_SOURCE_CLOSE, /* reading is done */ |
| 187 | ZIP_SOURCE_STAT, /* get meta information */ |
| 188 | ZIP_SOURCE_ERROR, /* get error information */ |
Thomas Klausner | d6f56ce | 2011-03-08 13:53:04 +0100 | [diff] [blame] | 189 | ZIP_SOURCE_FREE /* cleanup and free resources */ |
Dieter Baron | 2d6db59 | 1999-07-25 18:26:20 +0000 | [diff] [blame] | 190 | }; |
| 191 | |
Dieter Baron | ba98df0 | 2009-03-30 00:03:53 +0200 | [diff] [blame] | 192 | #define ZIP_SOURCE_ERR_LOWER -2 |
| 193 | |
Dieter Baron | dc094e2 | 2009-03-12 11:49:05 +0100 | [diff] [blame] | 194 | #define ZIP_STAT_NAME 0x0001 |
| 195 | #define ZIP_STAT_INDEX 0x0002 |
| 196 | #define ZIP_STAT_SIZE 0x0004 |
| 197 | #define ZIP_STAT_COMP_SIZE 0x0008 |
| 198 | #define ZIP_STAT_MTIME 0x0010 |
| 199 | #define ZIP_STAT_CRC 0x0020 |
| 200 | #define ZIP_STAT_COMP_METHOD 0x0040 |
| 201 | #define ZIP_STAT_ENCRYPTION_METHOD 0x0080 |
Dieter Baron | e00b1b8 | 2009-10-28 15:39:02 +0100 | [diff] [blame] | 202 | #define ZIP_STAT_FLAGS 0x0100 |
Dieter Baron | dc094e2 | 2009-03-12 11:49:05 +0100 | [diff] [blame] | 203 | |
Dieter Baron | e3f91ef | 2003-10-06 02:50:14 +0000 | [diff] [blame] | 204 | struct zip_stat { |
Dieter Baron | dc094e2 | 2009-03-12 11:49:05 +0100 | [diff] [blame] | 205 | zip_uint64_t valid; /* which fields have valid values */ |
Dieter Baron | e3f91ef | 2003-10-06 02:50:14 +0000 | [diff] [blame] | 206 | const char *name; /* name of the file */ |
Dieter Baron | cb1379d | 2009-03-10 14:46:51 +0100 | [diff] [blame] | 207 | zip_uint64_t index; /* index within archive */ |
Dieter Baron | c65abed | 2008-08-01 17:04:17 +0200 | [diff] [blame] | 208 | zip_uint64_t size; /* size of file (uncompressed) */ |
| 209 | zip_uint64_t comp_size; /* size of file (compressed) */ |
Dieter Baron | dc094e2 | 2009-03-12 11:49:05 +0100 | [diff] [blame] | 210 | time_t mtime; /* modification time */ |
| 211 | zip_uint32_t crc; /* crc of file data */ |
Dieter Baron | c65abed | 2008-08-01 17:04:17 +0200 | [diff] [blame] | 212 | zip_uint16_t comp_method; /* compression method used */ |
| 213 | zip_uint16_t encryption_method; /* encryption method used */ |
Dieter Baron | e00b1b8 | 2009-10-28 15:39:02 +0100 | [diff] [blame] | 214 | zip_uint32_t flags; /* reserved for future use */ |
Dieter Baron | e3f91ef | 2003-10-06 02:50:14 +0000 | [diff] [blame] | 215 | }; |
| 216 | |
| 217 | struct zip; |
| 218 | struct zip_file; |
Thomas Klausner | ef9a02f | 2004-11-18 15:06:20 +0000 | [diff] [blame] | 219 | struct zip_source; |
Dieter Baron | e3f91ef | 2003-10-06 02:50:14 +0000 | [diff] [blame] | 220 | |
Dieter Baron | cb1379d | 2009-03-10 14:46:51 +0100 | [diff] [blame] | 221 | typedef zip_int64_t (*zip_source_callback)(void *, void *, zip_uint64_t, |
| 222 | enum zip_source_cmd); |
Dieter Baron | 2f3f11c | 2009-02-14 18:58:01 +0100 | [diff] [blame] | 223 | |
Dieter Baron | 2d6db59 | 1999-07-25 18:26:20 +0000 | [diff] [blame] | 224 | |
| 225 | |
Dieter Baron | cb1379d | 2009-03-10 14:46:51 +0100 | [diff] [blame] | 226 | ZIP_EXTERN zip_int64_t zip_add(struct zip *, const char *, struct zip_source *); |
| 227 | ZIP_EXTERN zip_int64_t zip_add_dir(struct zip *, const char *); |
Dieter Baron | 8bc1276 | 2007-08-22 13:39:13 +0200 | [diff] [blame] | 228 | ZIP_EXTERN int zip_close(struct zip *); |
Thomas Klausner | dd4cf74 | 2012-02-13 22:15:37 +0100 | [diff] [blame] | 229 | ZIP_EXTERN void zip_discard(struct zip *); |
Dieter Baron | cb1379d | 2009-03-10 14:46:51 +0100 | [diff] [blame] | 230 | ZIP_EXTERN int zip_delete(struct zip *, zip_uint64_t); |
Dieter Baron | 8bc1276 | 2007-08-22 13:39:13 +0200 | [diff] [blame] | 231 | ZIP_EXTERN void zip_error_clear(struct zip *); |
| 232 | ZIP_EXTERN void zip_error_get(struct zip *, int *, int *); |
| 233 | ZIP_EXTERN int zip_error_get_sys_type(int); |
Dieter Baron | cb1379d | 2009-03-10 14:46:51 +0100 | [diff] [blame] | 234 | ZIP_EXTERN int zip_error_to_str(char *, zip_uint64_t, int, int); |
Dieter Baron | 8bc1276 | 2007-08-22 13:39:13 +0200 | [diff] [blame] | 235 | ZIP_EXTERN int zip_fclose(struct zip_file *); |
Dieter Baron | ae53a57 | 2009-01-26 23:03:31 +0100 | [diff] [blame] | 236 | ZIP_EXTERN struct zip *zip_fdopen(int, int, int *); |
Dieter Baron | 8bc1276 | 2007-08-22 13:39:13 +0200 | [diff] [blame] | 237 | ZIP_EXTERN void zip_file_error_clear(struct zip_file *); |
| 238 | ZIP_EXTERN void zip_file_error_get(struct zip_file *, int *, int *); |
| 239 | ZIP_EXTERN const char *zip_file_strerror(struct zip_file *); |
| 240 | ZIP_EXTERN struct zip_file *zip_fopen(struct zip *, const char *, int); |
Dieter Baron | 2f3f11c | 2009-02-14 18:58:01 +0100 | [diff] [blame] | 241 | ZIP_EXTERN struct zip_file *zip_fopen_encrypted(struct zip *, const char *, |
| 242 | int, const char *); |
Dieter Baron | cb1379d | 2009-03-10 14:46:51 +0100 | [diff] [blame] | 243 | ZIP_EXTERN struct zip_file *zip_fopen_index(struct zip *, zip_uint64_t, int); |
| 244 | ZIP_EXTERN struct zip_file *zip_fopen_index_encrypted(struct zip *, |
| 245 | zip_uint64_t, int, |
Dieter Baron | 2f3f11c | 2009-02-14 18:58:01 +0100 | [diff] [blame] | 246 | const char *); |
Dieter Baron | cb1379d | 2009-03-10 14:46:51 +0100 | [diff] [blame] | 247 | ZIP_EXTERN zip_int64_t zip_fread(struct zip_file *, void *, zip_uint64_t); |
Dieter Baron | 8bc1276 | 2007-08-22 13:39:13 +0200 | [diff] [blame] | 248 | ZIP_EXTERN const char *zip_get_archive_comment(struct zip *, int *, int); |
Dieter Baron | 416df86 | 2008-05-14 14:56:13 +0200 | [diff] [blame] | 249 | ZIP_EXTERN int zip_get_archive_flag(struct zip *, int, int); |
Dieter Baron | cb1379d | 2009-03-10 14:46:51 +0100 | [diff] [blame] | 250 | ZIP_EXTERN const char *zip_get_file_comment(struct zip *, zip_uint64_t, |
| 251 | int *, int); |
Thomas Klausner | 16b2701 | 2011-02-13 16:05:08 +0100 | [diff] [blame] | 252 | ZIP_EXTERN const char *zip_get_file_extra(struct zip *, zip_uint64_t, |
| 253 | int *, int); |
Dieter Baron | cb1379d | 2009-03-10 14:46:51 +0100 | [diff] [blame] | 254 | ZIP_EXTERN const char *zip_get_name(struct zip *, zip_uint64_t, int); |
Dieter Baron | 7cb4ace | 2011-02-14 12:46:55 +0100 | [diff] [blame] | 255 | ZIP_EXTERN zip_uint64_t zip_get_num_entries(struct zip *, int); |
| 256 | ZIP_EXTERN int zip_get_num_files(struct zip *); /* deprecated, use zip_get_num_entries instead */ |
Dieter Baron | 8bc1276 | 2007-08-22 13:39:13 +0200 | [diff] [blame] | 257 | ZIP_EXTERN int zip_name_locate(struct zip *, const char *, int); |
| 258 | ZIP_EXTERN struct zip *zip_open(const char *, int, int *); |
Dieter Baron | cb1379d | 2009-03-10 14:46:51 +0100 | [diff] [blame] | 259 | ZIP_EXTERN int zip_rename(struct zip *, zip_uint64_t, const char *); |
| 260 | ZIP_EXTERN int zip_replace(struct zip *, zip_uint64_t, struct zip_source *); |
Dieter Baron | 8bc1276 | 2007-08-22 13:39:13 +0200 | [diff] [blame] | 261 | ZIP_EXTERN int zip_set_archive_comment(struct zip *, const char *, int); |
Dieter Baron | 416df86 | 2008-05-14 14:56:13 +0200 | [diff] [blame] | 262 | ZIP_EXTERN int zip_set_archive_flag(struct zip *, int, int); |
Dieter Baron | 1015593 | 2009-03-11 18:07:55 +0100 | [diff] [blame] | 263 | ZIP_EXTERN int zip_set_default_password(struct zip *, const char *); |
Dieter Baron | cb1379d | 2009-03-10 14:46:51 +0100 | [diff] [blame] | 264 | ZIP_EXTERN int zip_set_file_comment(struct zip *, zip_uint64_t, |
| 265 | const char *, int); |
Dieter Baron | 16d2e63 | 2012-01-16 15:02:32 +0100 | [diff] [blame] | 266 | ZIP_EXTERN int zip_set_file_compression(struct zip *, zip_uint64_t, |
| 267 | zip_uint16_t, zip_uint32_t); |
Thomas Klausner | 16b2701 | 2011-02-13 16:05:08 +0100 | [diff] [blame] | 268 | ZIP_EXTERN int zip_set_file_extra(struct zip *, zip_uint64_t, |
| 269 | const char *, int); |
Dieter Baron | 8bc1276 | 2007-08-22 13:39:13 +0200 | [diff] [blame] | 270 | ZIP_EXTERN struct zip_source *zip_source_buffer(struct zip *, const void *, |
Dieter Baron | c65abed | 2008-08-01 17:04:17 +0200 | [diff] [blame] | 271 | zip_uint64_t, int); |
Dieter Baron | 8bc1276 | 2007-08-22 13:39:13 +0200 | [diff] [blame] | 272 | ZIP_EXTERN struct zip_source *zip_source_file(struct zip *, const char *, |
Dieter Baron | c65abed | 2008-08-01 17:04:17 +0200 | [diff] [blame] | 273 | zip_uint64_t, zip_int64_t); |
Dieter Baron | 8bc1276 | 2007-08-22 13:39:13 +0200 | [diff] [blame] | 274 | ZIP_EXTERN struct zip_source *zip_source_filep(struct zip *, FILE *, |
Dieter Baron | c65abed | 2008-08-01 17:04:17 +0200 | [diff] [blame] | 275 | zip_uint64_t, zip_int64_t); |
Dieter Baron | 8bc1276 | 2007-08-22 13:39:13 +0200 | [diff] [blame] | 276 | ZIP_EXTERN void zip_source_free(struct zip_source *); |
| 277 | ZIP_EXTERN struct zip_source *zip_source_function(struct zip *, |
| 278 | zip_source_callback, void *); |
| 279 | ZIP_EXTERN struct zip_source *zip_source_zip(struct zip *, struct zip *, |
Dieter Baron | cb1379d | 2009-03-10 14:46:51 +0100 | [diff] [blame] | 280 | zip_uint64_t, int, |
| 281 | zip_uint64_t, zip_int64_t); |
Dieter Baron | 8bc1276 | 2007-08-22 13:39:13 +0200 | [diff] [blame] | 282 | ZIP_EXTERN int zip_stat(struct zip *, const char *, int, struct zip_stat *); |
Dieter Baron | cb1379d | 2009-03-10 14:46:51 +0100 | [diff] [blame] | 283 | ZIP_EXTERN int zip_stat_index(struct zip *, zip_uint64_t, int, |
| 284 | struct zip_stat *); |
Dieter Baron | 8bc1276 | 2007-08-22 13:39:13 +0200 | [diff] [blame] | 285 | ZIP_EXTERN void zip_stat_init(struct zip_stat *); |
| 286 | ZIP_EXTERN const char *zip_strerror(struct zip *); |
Dieter Baron | cb1379d | 2009-03-10 14:46:51 +0100 | [diff] [blame] | 287 | ZIP_EXTERN int zip_unchange(struct zip *, zip_uint64_t); |
Dieter Baron | 8bc1276 | 2007-08-22 13:39:13 +0200 | [diff] [blame] | 288 | ZIP_EXTERN int zip_unchange_all(struct zip *); |
| 289 | ZIP_EXTERN int zip_unchange_archive(struct zip *); |
Dieter Baron | 2d6db59 | 1999-07-25 18:26:20 +0000 | [diff] [blame] | 290 | |
Dieter Baron | 08f2851 | 2005-07-14 14:08:11 +0000 | [diff] [blame] | 291 | #ifdef __cplusplus |
| 292 | } |
| 293 | #endif |
| 294 | |
Dieter Baron | 2d6db59 | 1999-07-25 18:26:20 +0000 | [diff] [blame] | 295 | #endif /* _HAD_ZIP_H */ |