1 module deimos.zip; 2 3 /* 4 zip.h -- exported declarations. 5 Copyright (C) 1999-2021 Dieter Baron and Thomas Klausner 6 7 This file is part of libzip, a library to manipulate ZIP archives. 8 The authors can be contacted at <info@libzip.org> 9 10 Redistribution and use in source and binary forms, with or without 11 modification, are permitted provided that the following conditions 12 are met: 13 1. Redistributions of source code must retain the above copyright 14 notice, this list of conditions and the following disclaimer. 15 2. Redistributions in binary form must reproduce the above copyright 16 notice, this list of conditions and the following disclaimer in 17 the documentation and/or other materials provided with the 18 distribution. 19 3. The names of the authors may not be used to endorse or promote 20 products derived from this software without specific prior 21 written permission. 22 23 THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS 24 OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 26 ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY 27 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 28 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 29 GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 30 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 31 IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 32 OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 33 IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 */ 35 36 // Added here to make available usage of FILE and time_t 37 public import core.stdc.time; 38 public import core.stdc.stdio; 39 40 /* Notes 41 42 Following definitions relaced by standard d types. 43 Possibly it have sense to revert this change, and use aliases instead. 44 ZIP_UINT16_MAX = ushort.max 45 zip_int64_t = long 46 zip_uint64_t = ulong 47 zip_uint32_t = uint 48 zip_uint16_t = ushort 49 zip_uint8_t = ubyte 50 */ 51 52 extern (C): 53 @nogc nothrow: 54 55 /* flags for zip_open */ 56 57 enum ZIP_CREATE = 1; 58 enum ZIP_EXCL = 2; 59 enum ZIP_CHECKCONS = 4; 60 enum ZIP_TRUNCATE = 8; 61 enum ZIP_RDONLY = 16; 62 63 64 /* flags for zip_name_locate, zip_fopen, zip_stat, ... */ 65 66 enum ZIP_FL_NOCASE = 1u /* ignore case on name lookup */; 67 enum ZIP_FL_NODIR = 2u /* ignore directory component */; 68 enum ZIP_FL_COMPRESSED = 4u /* read compressed data */; 69 enum ZIP_FL_UNCHANGED = 8u /* use original data, ignoring changes */; 70 enum ZIP_FL_RECOMPRESS = 16u /* force recompression of data */; 71 enum ZIP_FL_ENCRYPTED = 32u /* read encrypted data (implies ZIP_FL_COMPRESSED) */; 72 enum ZIP_FL_ENC_GUESS = 0u /* guess string encoding (is default) */; 73 enum ZIP_FL_ENC_RAW = 64u /* get unmodified string */; 74 enum ZIP_FL_ENC_STRICT = 128u /* follow specification strictly */; 75 enum ZIP_FL_LOCAL = 256u /* in local header */; 76 enum ZIP_FL_CENTRAL = 512u /* in central directory */; 77 /* 1024u reserved for internal use */ 78 enum ZIP_FL_ENC_UTF_8 = 2048u /* string is UTF-8 encoded */; 79 enum ZIP_FL_ENC_CP437 = 4096u /* string is CP437 encoded */; 80 enum ZIP_FL_OVERWRITE = 8192u /* zip_file_add: if file with name exists, overwrite (replace) it */; 81 82 /* archive global flags flags */ 83 84 enum ZIP_AFL_RDONLY = 2u /* read only -- cannot be cleared */; 85 86 87 /* create a new extra field */ 88 89 enum ZIP_EXTRA_FIELD_ALL = ushort.max; //ZIP_UINT16_MAX; 90 enum ZIP_EXTRA_FIELD_NEW = ushort.max; //ZIP_UINT16_MAX; 91 92 93 /* libzip error codes */ 94 95 enum ZIP_ER_OK = 0 /* N No error */; 96 enum ZIP_ER_MULTIDISK = 1 /* N Multi-disk zip archives not supported */; 97 enum ZIP_ER_RENAME = 2 /* S Renaming temporary file failed */; 98 enum ZIP_ER_CLOSE = 3 /* S Closing zip archive failed */; 99 enum ZIP_ER_SEEK = 4 /* S Seek error */; 100 enum ZIP_ER_READ = 5 /* S Read error */; 101 enum ZIP_ER_WRITE = 6 /* S Write error */; 102 enum ZIP_ER_CRC = 7 /* N CRC error */; 103 enum ZIP_ER_ZIPCLOSED = 8 /* N Containing zip archive was closed */; 104 enum ZIP_ER_NOENT = 9 /* N No such file */; 105 enum ZIP_ER_EXISTS = 10 /* N File already exists */; 106 enum ZIP_ER_OPEN = 11 /* S Can't open file */; 107 enum ZIP_ER_TMPOPEN = 12 /* S Failure to create temporary file */; 108 enum ZIP_ER_ZLIB = 13 /* Z Zlib error */; 109 enum ZIP_ER_MEMORY = 14 /* N Malloc failure */; 110 enum ZIP_ER_CHANGED = 15 /* N Entry has been changed */; 111 enum ZIP_ER_COMPNOTSUPP = 16 /* N Compression method not supported */; 112 enum ZIP_ER_EOF = 17 /* N Premature end of file */; 113 enum ZIP_ER_INVAL = 18 /* N Invalid argument */; 114 enum ZIP_ER_NOZIP = 19 /* N Not a zip archive */; 115 enum ZIP_ER_INTERNAL = 20 /* N Internal error */; 116 enum ZIP_ER_INCONS = 21 /* L Zip archive inconsistent */; 117 enum ZIP_ER_REMOVE = 22 /* S Can't remove file */; 118 enum ZIP_ER_DELETED = 23 /* N Entry has been deleted */; 119 enum ZIP_ER_ENCRNOTSUPP = 24 /* N Encryption method not supported */; 120 enum ZIP_ER_RDONLY = 25 /* N Read-only archive */; 121 enum ZIP_ER_NOPASSWD = 26 /* N No password provided */; 122 enum ZIP_ER_WRONGPASSWD = 27 /* N Wrong password provided */; 123 enum ZIP_ER_OPNOTSUPP = 28 /* N Operation not supported */; 124 enum ZIP_ER_INUSE = 29 /* N Resource still in use */; 125 enum ZIP_ER_TELL = 30 /* S Tell error */; 126 enum ZIP_ER_COMPRESSED_DATA = 31 /* N Compressed data invalid */; 127 enum ZIP_ER_CANCELLED = 32 /* N Operation cancelled */; 128 129 /* type of system error value */ 130 131 enum ZIP_ET_NONE = 0 /* sys_err unused */; 132 enum ZIP_ET_SYS = 1 /* sys_err is errno */; 133 enum ZIP_ET_ZLIB = 2 /* sys_err is zlib error code */; 134 enum ZIP_ET_LIBZIP = 3 /* sys_err is libzip error code */; 135 136 /* compression methods */ 137 138 enum ZIP_CM_DEFAULT = -1 /* better of deflate or store */; 139 enum ZIP_CM_STORE = 0 /* stored (uncompressed) */; 140 enum ZIP_CM_SHRINK = 1 /* shrunk */; 141 enum ZIP_CM_REDUCE_1 = 2 /* reduced with factor 1 */; 142 enum ZIP_CM_REDUCE_2 = 3 /* reduced with factor 2 */; 143 enum ZIP_CM_REDUCE_3 = 4 /* reduced with factor 3 */; 144 enum ZIP_CM_REDUCE_4 = 5 /* reduced with factor 4 */; 145 enum ZIP_CM_IMPLODE = 6 /* imploded */; 146 /* 7 - Reserved for Tokenizing compression algorithm */ 147 enum ZIP_CM_DEFLATE = 8 /* deflated */; 148 enum ZIP_CM_DEFLATE64 = 9 /* deflate64 */; 149 enum ZIP_CM_PKWARE_IMPLODE = 10 /* PKWARE imploding */; 150 /* 11 - Reserved by PKWARE */ 151 enum ZIP_CM_BZIP2 = 12 /* compressed using BZIP2 algorithm */; 152 /* 13 - Reserved by PKWARE */ 153 enum ZIP_CM_LZMA = 14 /* LZMA (EFS) */; 154 /* 15-17 - Reserved by PKWARE */ 155 enum ZIP_CM_TERSE = 18 /* compressed using IBM TERSE (new) */; 156 enum ZIP_CM_LZ77 = 19 /* IBM LZ77 z Architecture (PFS) */; 157 /* 20 - old value for Zstandard */ 158 enum ZIP_CM_LZMA2 = 33; 159 enum ZIP_CM_ZSTD = 93 /* Zstandard compressed data */; 160 enum ZIP_CM_XZ = 95 /* XZ compressed data */; 161 enum ZIP_CM_JPEG = 96 /* Compressed Jpeg data */; 162 enum ZIP_CM_WAVPACK = 97 /* WavPack compressed data */; 163 enum ZIP_CM_PPMD = 98 /* PPMd version I, Rev 1 */; 164 165 /* encryption methods */ 166 167 enum ZIP_EM_NONE = 0 /* not encrypted */; 168 enum ZIP_EM_TRAD_PKWARE = 1 /* traditional PKWARE encryption */; 169 // #if 0 /* Strong Encryption Header not parsed yet */ 170 // #define ZIP_EM_DES 0x6601 /* strong encryption: DES */ 171 // #define ZIP_EM_RC2_OLD 0x6602 /* strong encryption: RC2, version < 5.2 */ 172 // #define ZIP_EM_3DES_168 0x6603 173 // #define ZIP_EM_3DES_112 0x6609 174 // #define ZIP_EM_PKZIP_AES_128 0x660e 175 // #define ZIP_EM_PKZIP_AES_192 0x660f 176 // #define ZIP_EM_PKZIP_AES_256 0x6610 177 // #define ZIP_EM_RC2 0x6702 /* strong encryption: RC2, version >= 5.2 */ 178 // #define ZIP_EM_RC4 0x6801 179 // #endif 180 enum ZIP_EM_AES_128 = 0x0101 /* Winzip AES encryption */; 181 enum ZIP_EM_AES_192 = 0x0102; 182 enum ZIP_EM_AES_256 = 0x0103; 183 enum ZIP_EM_UNKNOWN = 0xffff /* unknown algorithm */; 184 185 enum ZIP_OPSYS_DOS = 0x00u; 186 enum ZIP_OPSYS_AMIGA = 0x01u; 187 enum ZIP_OPSYS_OPENVMS = 0x02u; 188 enum ZIP_OPSYS_UNIX = 0x03u; 189 enum ZIP_OPSYS_VM_CMS = 0x04u; 190 enum ZIP_OPSYS_ATARI_ST = 0x05u; 191 enum ZIP_OPSYS_OS_2 = 0x06u; 192 enum ZIP_OPSYS_MACINTOSH = 0x07u; 193 enum ZIP_OPSYS_Z_SYSTEM = 0x08u; 194 enum ZIP_OPSYS_CPM = 0x09u; 195 enum ZIP_OPSYS_WINDOWS_NTFS = 0x0au; 196 enum ZIP_OPSYS_MVS = 0x0bu; 197 enum ZIP_OPSYS_VSE = 0x0cu; 198 enum ZIP_OPSYS_ACORN_RISC = 0x0du; 199 enum ZIP_OPSYS_VFAT = 0x0eu; 200 enum ZIP_OPSYS_ALTERNATE_MVS = 0x0fu; 201 enum ZIP_OPSYS_BEOS = 0x10u; 202 enum ZIP_OPSYS_TANDEM = 0x11u; 203 enum ZIP_OPSYS_OS_400 = 0x12u; 204 enum ZIP_OPSYS_OS_X = 0x13u; 205 206 enum ZIP_OPSYS_DEFAULT = ZIP_OPSYS_UNIX; 207 // end 208 209 enum zip_source_cmd { 210 ZIP_SOURCE_OPEN, /* prepare for reading */ 211 ZIP_SOURCE_READ, /* read data */ 212 ZIP_SOURCE_CLOSE, /* reading is done */ 213 ZIP_SOURCE_STAT, /* get meta information */ 214 ZIP_SOURCE_ERROR, /* get error information */ 215 ZIP_SOURCE_FREE, /* cleanup and free resources */ 216 ZIP_SOURCE_SEEK, /* set position for reading */ 217 ZIP_SOURCE_TELL, /* get read position */ 218 ZIP_SOURCE_BEGIN_WRITE, /* prepare for writing */ 219 ZIP_SOURCE_COMMIT_WRITE, /* writing is done */ 220 ZIP_SOURCE_ROLLBACK_WRITE, /* discard written changes */ 221 ZIP_SOURCE_WRITE, /* write data */ 222 ZIP_SOURCE_SEEK_WRITE, /* set position for writing */ 223 ZIP_SOURCE_TELL_WRITE, /* get write position */ 224 ZIP_SOURCE_SUPPORTS, /* check whether source supports command */ 225 ZIP_SOURCE_REMOVE, /* remove file */ 226 ZIP_SOURCE_RESERVED_1, /* previously used internally */ 227 ZIP_SOURCE_BEGIN_WRITE_CLONING, /* like ZIP_SOURCE_BEGIN_WRITE, but keep part of original file */ 228 ZIP_SOURCE_ACCEPT_EMPTY, /* whether empty files are valid archives */ 229 ZIP_SOURCE_GET_FILE_ATTRIBUTES /* get additional file attributes */ 230 }; 231 alias zip_source_cmd_t = zip_source_cmd; 232 233 extern (D) auto ZIP_SOURCE_MAKE_COMMAND_BITMASK(T)(auto ref T cmd) 234 { 235 return (cast(long) 1) << cmd; 236 } 237 238 extern (D) auto ZIP_SOURCE_CHECK_SUPPORTED(T0, T1)(auto ref T0 supported, auto ref T1 cmd) 239 { 240 return (supported & ZIP_SOURCE_MAKE_COMMAND_BITMASK(cmd)) != 0; 241 } 242 243 /* clang-format off */ 244 245 enum ZIP_SOURCE_SUPPORTS_READABLE = ZIP_SOURCE_MAKE_COMMAND_BITMASK(zip_source_cmd_t.ZIP_SOURCE_OPEN) | ZIP_SOURCE_MAKE_COMMAND_BITMASK(zip_source_cmd_t.ZIP_SOURCE_READ) | ZIP_SOURCE_MAKE_COMMAND_BITMASK(zip_source_cmd_t.ZIP_SOURCE_CLOSE) | ZIP_SOURCE_MAKE_COMMAND_BITMASK(zip_source_cmd_t.ZIP_SOURCE_STAT) | ZIP_SOURCE_MAKE_COMMAND_BITMASK(zip_source_cmd_t.ZIP_SOURCE_ERROR) | ZIP_SOURCE_MAKE_COMMAND_BITMASK(zip_source_cmd_t.ZIP_SOURCE_FREE); 246 247 enum ZIP_SOURCE_SUPPORTS_SEEKABLE = ZIP_SOURCE_SUPPORTS_READABLE | ZIP_SOURCE_MAKE_COMMAND_BITMASK(zip_source_cmd_t.ZIP_SOURCE_SEEK) | ZIP_SOURCE_MAKE_COMMAND_BITMASK(zip_source_cmd_t.ZIP_SOURCE_TELL) | ZIP_SOURCE_MAKE_COMMAND_BITMASK(zip_source_cmd_t.ZIP_SOURCE_SUPPORTS); 248 249 enum ZIP_SOURCE_SUPPORTS_WRITABLE = ZIP_SOURCE_SUPPORTS_SEEKABLE | ZIP_SOURCE_MAKE_COMMAND_BITMASK(zip_source_cmd_t.ZIP_SOURCE_BEGIN_WRITE) | ZIP_SOURCE_MAKE_COMMAND_BITMASK(zip_source_cmd_t.ZIP_SOURCE_COMMIT_WRITE) | ZIP_SOURCE_MAKE_COMMAND_BITMASK(zip_source_cmd_t.ZIP_SOURCE_ROLLBACK_WRITE) | ZIP_SOURCE_MAKE_COMMAND_BITMASK(zip_source_cmd_t.ZIP_SOURCE_WRITE) | ZIP_SOURCE_MAKE_COMMAND_BITMASK(zip_source_cmd_t.ZIP_SOURCE_SEEK_WRITE) | ZIP_SOURCE_MAKE_COMMAND_BITMASK(zip_source_cmd_t.ZIP_SOURCE_TELL_WRITE) | ZIP_SOURCE_MAKE_COMMAND_BITMASK(zip_source_cmd_t.ZIP_SOURCE_REMOVE); 250 251 /* clang-format on */ 252 253 /* for use by sources */ 254 struct zip_source_args_seek { 255 long offset; 256 int whence; 257 }; 258 259 alias zip_source_args_seek_t = zip_source_args_seek; 260 261 /* error information */ 262 /* use zip_error_*() to access */ 263 struct zip_error { 264 int zip_err; /* libzip error code (ZIP_ER_*) */ 265 int sys_err; /* copy of errno (E*) or zlib error code */ 266 char* str; /* string representation or NULL */ 267 }; 268 269 enum ZIP_STAT_NAME = 0x0001u; 270 enum ZIP_STAT_INDEX = 0x0002u; 271 enum ZIP_STAT_SIZE = 0x0004u; 272 enum ZIP_STAT_COMP_SIZE = 0x0008u; 273 enum ZIP_STAT_MTIME = 0x0010u; 274 enum ZIP_STAT_CRC = 0x0020u; 275 enum ZIP_STAT_COMP_METHOD = 0x0040u; 276 enum ZIP_STAT_ENCRYPTION_METHOD = 0x0080u; 277 enum ZIP_STAT_FLAGS = 0x0100u; 278 279 // Port note: Renamed because of conflic with zip_stat func. 280 struct zip_stat_t { 281 ulong valid; /* which fields have valid values */ 282 const char* name; /* name of the file */ 283 ulong index; /* index within archive */ 284 ulong size; /* size of file (uncompressed) */ 285 ulong comp_size; /* size of file (compressed) */ 286 time_t mtime; /* modification time */ 287 uint crc; /* crc of file data */ 288 ushort comp_method; /* compression method used */ 289 ushort encryption_method; /* encryption method used */ 290 uint flags; /* reserved for future use */ 291 }; 292 293 struct zip_buffer_fragment { 294 ubyte * data; 295 ulong length; 296 }; 297 298 struct zip_file_attributes { 299 ulong valid; /* which fields have valid values */ 300 ubyte _version; /* version of this struct, currently 1 */ 301 ubyte host_system; /* host system on which file was created */ 302 ubyte ascii; /* flag whether file is ASCII text */ 303 ubyte version_needed; /* minimum version needed to extract file */ 304 uint external_file_attributes; /* external file attributes (host-system specific) */ 305 ushort general_purpose_bit_flags; /* general purpose big flags, only some bits are honored */ 306 ushort general_purpose_bit_mask; /* which bits in general_purpose_bit_flags are valid */ 307 }; 308 309 310 enum ZIP_FILE_ATTRIBUTES_HOST_SYSTEM = 0x0001u; 311 enum ZIP_FILE_ATTRIBUTES_ASCII = 0x0002u; 312 enum ZIP_FILE_ATTRIBUTES_VERSION_NEEDED = 0x0004u; 313 enum ZIP_FILE_ATTRIBUTES_EXTERNAL_FILE_ATTRIBUTES = 0x0008u; 314 enum ZIP_FILE_ATTRIBUTES_GENERAL_PURPOSE_BIT_FLAGS = 0x0010u; 315 316 struct zip; 317 struct zip_file; 318 struct zip_source; 319 320 alias zip_t = zip; 321 alias zip_error_t = zip_error; 322 alias zip_file_t = zip_file; 323 alias zip_file_attributes_t = zip_file_attributes; 324 alias zip_source_t = zip_source; 325 alias zip_buffer_fragment_t = zip_buffer_fragment; 326 327 alias zip_flags_t = uint; 328 329 alias zip_source_callback = long function(void*, void*, ulong, zip_source_cmd_t); 330 alias zip_progress_callback = void function(zip_t*, double, void*); 331 alias zip_cancel_callback = int function(zip_t*, void*); 332 333 // Disabis deprecated functions. Currently they are just commented. Possibly it have sense to use custom configuration version here 334 // version(_ZIP_COMPILING_DEPRECATED) { 335 // #ifndef ZIP_DISABLE_DEPRECATED 336 // typedef void (*zip_progress_callback_t)(double); 337 // ZIP_EXTERN void zip_register_progress_callback(zip_t *_Nonnull, zip_progress_callback_t _Nullable); /* use zip_register_progress_callback_with_state */ 338 339 // ZIP_EXTERN zip_int64_t zip_add(zip_t *_Nonnull, const char *_Nonnull, zip_source_t *_Nonnull); /* use zip_file_add */ 340 // ZIP_EXTERN zip_int64_t zip_add_dir(zip_t *_Nonnull, const char *_Nonnull); /* use zip_dir_add */ 341 // ZIP_EXTERN const char *_Nullable zip_get_file_comment(zip_t *_Nonnull, zip_uint64_t, int *_Nullable, int); /* use zip_file_get_comment */ 342 // ZIP_EXTERN int zip_get_num_files(zip_t *_Nonnull); /* use zip_get_num_entries instead */ 343 // ZIP_EXTERN int zip_rename(zip_t *_Nonnull, zip_uint64_t, const char *_Nonnull); /* use zip_file_rename */ 344 // ZIP_EXTERN int zip_replace(zip_t *_Nonnull, zip_uint64_t, zip_source_t *_Nonnull); /* use zip_file_replace */ 345 // ZIP_EXTERN int zip_set_file_comment(zip_t *_Nonnull, zip_uint64_t, const char *_Nullable, int); /* use zip_file_set_comment */ 346 // ZIP_EXTERN int zip_error_get_sys_type(int); /* use zip_error_system_type */ 347 // ZIP_EXTERN void zip_error_get(zip_t *_Nonnull, int *_Nullable, int *_Nullable); /* use zip_get_error, zip_error_code_zip / zip_error_code_system */ 348 // ZIP_EXTERN int zip_error_to_str(char *_Nonnull, zip_uint64_t, int, int); /* use zip_error_init_with_code / zip_error_strerror */ 349 // ZIP_EXTERN void zip_file_error_get(zip_file_t *_Nonnull, int *_Nullable, int *_Nullable); /* use zip_file_get_error, zip_error_code_zip / zip_error_code_system */ 350 // #endif 351 // } 352 353 int zip_close(zip_t *); 354 int zip_delete(zip_t *, ulong); 355 long zip_dir_add(zip_t *, const char *, zip_flags_t); 356 void zip_discard(zip_t *); 357 358 zip_error_t * zip_get_error(zip_t *); 359 void zip_error_clear(zip_t *); 360 int zip_error_code_zip(const zip_error_t *); 361 int zip_error_code_system(const zip_error_t *); 362 void zip_error_fini(zip_error_t *); 363 void zip_error_init(zip_error_t *); 364 void zip_error_init_with_code(zip_error_t *, int); 365 void zip_error_set(zip_error_t *, int, int); 366 const(char*) zip_error_strerror(zip_error_t *); 367 int zip_error_system_type(const zip_error_t *); 368 long zip_error_to_data(const zip_error_t *, void *, ulong); 369 370 int zip_fclose(zip_file_t *); 371 zip_t * zip_fdopen(int, int, int *); 372 long zip_file_add(zip_t *, const char *, zip_source_t *, zip_flags_t); 373 void zip_file_attributes_init(zip_file_attributes_t *); 374 void zip_file_error_clear(zip_file_t *); 375 int zip_file_extra_field_delete(zip_t *, ulong, ushort, zip_flags_t); 376 int zip_file_extra_field_delete_by_id(zip_t *, ulong, ushort, ushort, zip_flags_t); 377 int zip_file_extra_field_set(zip_t *, ulong, ushort, ushort, const ubyte *, ushort, zip_flags_t); 378 short zip_file_extra_fields_count(zip_t *, ulong, zip_flags_t); 379 short zip_file_extra_fields_count_by_id(zip_t *, ulong, ushort, zip_flags_t); 380 const(ubyte*) zip_file_extra_field_get(zip_t *, ulong, ushort, ushort *, ushort *, zip_flags_t); 381 const(ubyte*) zip_file_extra_field_get_by_id(zip_t *, ulong, ushort, ushort, ushort *, zip_flags_t); 382 const(char*) zip_file_get_comment(zip_t *, ulong, uint *, zip_flags_t); 383 zip_error_t * zip_file_get_error(zip_file_t *); 384 int zip_file_get_external_attributes(zip_t *, ulong, zip_flags_t, ubyte *, uint *); 385 int zip_file_is_seekable(zip_file_t *); 386 int zip_file_rename(zip_t *, ulong, const char *, zip_flags_t); 387 int zip_file_replace(zip_t *, ulong, zip_source_t *, zip_flags_t); 388 int zip_file_set_comment(zip_t *, ulong, const char *, ushort, zip_flags_t); 389 int zip_file_set_dostime(zip_t *, ulong, ushort, ushort, zip_flags_t); 390 int zip_file_set_encryption(zip_t *, ulong, ushort, const char *); 391 int zip_file_set_external_attributes(zip_t *, ulong, zip_flags_t, ubyte, uint); 392 int zip_file_set_mtime(zip_t *, ulong, time_t, zip_flags_t); 393 const (char*) zip_file_strerror(zip_file_t *); 394 zip_file_t * zip_fopen(zip_t *, const char *, zip_flags_t); 395 zip_file_t * zip_fopen_encrypted(zip_t *, const char *, zip_flags_t, const char *); 396 zip_file_t * zip_fopen_index(zip_t *, ulong, zip_flags_t); 397 zip_file_t * zip_fopen_index_encrypted(zip_t *, ulong, zip_flags_t, const char *); 398 long zip_fread(zip_file_t *, void *, ulong); 399 byte zip_fseek(zip_file_t *, long, int); 400 long zip_ftell(zip_file_t *); 401 const(char*) zip_get_archive_comment(zip_t *, int *, zip_flags_t); 402 int zip_get_archive_flag(zip_t *, zip_flags_t, zip_flags_t); 403 const (char*) zip_get_name(zip_t *, ulong, zip_flags_t); 404 long zip_get_num_entries(zip_t *, zip_flags_t); 405 const(char*) zip_libzip_version(); 406 long zip_name_locate(zip_t *, const char *, zip_flags_t); 407 zip_t * zip_open(const char *, int, int *); 408 zip_t * zip_open_from_source(zip_source_t *, int, zip_error_t *); 409 410 int zip_register_progress_callback_with_state(zip_t *, double, zip_progress_callback , void function(void*), void *); 411 int zip_register_cancel_callback_with_state(zip_t *, zip_cancel_callback , void function(void*), void *); 412 413 int zip_set_archive_comment(zip_t *, const char *, ushort); 414 int zip_set_archive_flag(zip_t *, zip_flags_t, int); 415 int zip_set_default_password(zip_t *, const char *); 416 int zip_set_file_compression(zip_t *, ulong, int, uint); 417 int zip_source_begin_write(zip_source_t *); 418 int zip_source_begin_write_cloning(zip_source_t *, ulong); 419 zip_source_t * zip_source_buffer(zip_t *, const void *, ulong, int); 420 zip_source_t * zip_source_buffer_create(const void *, ulong, int, zip_error_t *); 421 zip_source_t * zip_source_buffer_fragment(zip_t *, const zip_buffer_fragment_t *, ulong, int); 422 zip_source_t * zip_source_buffer_fragment_create(const zip_buffer_fragment_t *, ulong, int, zip_error_t *); 423 int zip_source_close(zip_source_t *); 424 int zip_source_commit_write(zip_source_t *); 425 zip_error_t * zip_source_error(zip_source_t *); 426 zip_source_t * zip_source_file(zip_t *, const char *, ulong, long); 427 zip_source_t * zip_source_file_create(const char *, ulong, long, zip_error_t *); 428 zip_source_t * zip_source_filep(zip_t *, FILE *, ulong, long); 429 zip_source_t * zip_source_filep_create(FILE *, ulong, long, zip_error_t *); 430 void zip_source_free(zip_source_t *); 431 zip_source_t * zip_source_function(zip_t *, zip_source_callback , void *); 432 zip_source_t * zip_source_function_create(zip_source_callback , void *, zip_error_t *); 433 int zip_source_get_file_attributes(zip_source_t *, zip_file_attributes_t *); 434 int zip_source_is_deleted(zip_source_t *); 435 void zip_source_keep(zip_source_t *); 436 long zip_source_make_command_bitmap(zip_source_cmd_t, ...); 437 int zip_source_open(zip_source_t *); 438 long zip_source_read(zip_source_t *, void *, ulong); 439 void zip_source_rollback_write(zip_source_t *); 440 int zip_source_seek(zip_source_t *, long, int); 441 long zip_source_seek_compute_offset(ulong, ulong, void *, ulong, zip_error_t *); 442 int zip_source_seek_write(zip_source_t *, long, int); 443 int zip_source_stat(zip_source_t *, zip_stat_t *); 444 long zip_source_tell(zip_source_t *); 445 long zip_source_tell_write(zip_source_t *); 446 version(Windows){ 447 zip_source_t *zip_source_win32a(zip_t *, const char *, ulong, long); 448 zip_source_t *zip_source_win32a_create(const char *, ulong, long, zip_error_t *); 449 zip_source_t *zip_source_win32handle(zip_t *, void *, ulong, long); 450 zip_source_t *zip_source_win32handle_create(void *, ulong, long, zip_error_t *); 451 zip_source_t *zip_source_win32w(zip_t *, const wchar_t *, ulong, long); 452 zip_source_t *zip_source_win32w_create(const wchar_t *, ulong, long, zip_error_t *); 453 } 454 zip_source_t * zip_source_window_create(zip_source_t *, ulong, long, zip_error_t *); 455 long zip_source_write(zip_source_t *, const void *, ulong); 456 zip_source_t * zip_source_zip(zip_t *, zip_t *, ulong, zip_flags_t, ulong, long); 457 zip_source_t * zip_source_zip_create(zip_t *, ulong, zip_flags_t, ulong, long, zip_error_t *); 458 int zip_stat(zip_t *, const char *, zip_flags_t, zip_stat_t *); 459 int zip_stat_index(zip_t *, ulong, zip_flags_t, zip_stat_t *); 460 void zip_stat_init(zip_stat_t *); 461 const(char*) zip_strerror(zip_t *); 462 int zip_unchange(zip_t *, ulong); 463 int zip_unchange_all(zip_t *); 464 int zip_unchange_archive(zip_t *); 465 int zip_compression_method_supported(int method, int compress); 466 int zip_encryption_method_supported(ushort method, int encode); 467