michael@0: /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef _zipstruct_h michael@0: #define _zipstruct_h michael@0: michael@0: michael@0: /* michael@0: * Certain constants and structures for michael@0: * the Phil Katz ZIP archive format. michael@0: * michael@0: */ michael@0: michael@0: typedef struct ZipLocal_ michael@0: { michael@0: unsigned char signature [4]; michael@0: unsigned char word [2]; michael@0: unsigned char bitflag [2]; michael@0: unsigned char method [2]; michael@0: unsigned char time [2]; michael@0: unsigned char date [2]; michael@0: unsigned char crc32 [4]; michael@0: unsigned char size [4]; michael@0: unsigned char orglen [4]; michael@0: unsigned char filename_len [2]; michael@0: unsigned char extrafield_len [2]; michael@0: } ZipLocal; michael@0: michael@0: /* michael@0: * 'sizeof(struct XXX)' includes padding on ARM (see bug 87965) michael@0: * As the internals of a jar/zip file must not depend on the target michael@0: * architecture (i386, ppc, ARM, ...), use a fixed value instead. michael@0: */ michael@0: #define ZIPLOCAL_SIZE (4+2+2+2+2+2+4+4+4+2+2) michael@0: michael@0: typedef struct ZipCentral_ michael@0: { michael@0: unsigned char signature [4]; michael@0: unsigned char version_made_by [2]; michael@0: unsigned char version [2]; michael@0: unsigned char bitflag [2]; michael@0: unsigned char method [2]; michael@0: unsigned char time [2]; michael@0: unsigned char date [2]; michael@0: unsigned char crc32 [4]; michael@0: unsigned char size [4]; michael@0: unsigned char orglen [4]; michael@0: unsigned char filename_len [2]; michael@0: unsigned char extrafield_len [2]; michael@0: unsigned char commentfield_len [2]; michael@0: unsigned char diskstart_number [2]; michael@0: unsigned char internal_attributes [2]; michael@0: unsigned char external_attributes [4]; michael@0: unsigned char localhdr_offset [4]; michael@0: } ZipCentral; michael@0: michael@0: /* michael@0: * 'sizeof(struct XXX)' includes padding on ARM (see bug 87965) michael@0: * As the internals of a jar/zip file must not depend on the target michael@0: * architecture (i386, ppc, ARM, ...), use a fixed value instead. michael@0: */ michael@0: #define ZIPCENTRAL_SIZE (4+2+2+2+2+2+2+4+4+4+2+2+2+2+2+4+4) michael@0: michael@0: typedef struct ZipEnd_ michael@0: { michael@0: unsigned char signature [4]; michael@0: unsigned char disk_nr [2]; michael@0: unsigned char start_central_dir [2]; michael@0: unsigned char total_entries_disk [2]; michael@0: unsigned char total_entries_archive [2]; michael@0: unsigned char central_dir_size [4]; michael@0: unsigned char offset_central_dir [4]; michael@0: unsigned char commentfield_len [2]; michael@0: } ZipEnd; michael@0: michael@0: /* michael@0: * 'sizeof(struct XXX)' includes padding on ARM (see bug 87965) michael@0: * As the internals of a jar/zip file must not depend on the target michael@0: * architecture (i386, ppc, ARM, ...), use a fixed value instead. michael@0: */ michael@0: #define ZIPEND_SIZE (4+2+2+2+2+4+4+2) michael@0: michael@0: /* signatures */ michael@0: #define LOCALSIG 0x04034B50l michael@0: #define CENTRALSIG 0x02014B50l michael@0: #define ENDSIG 0x06054B50l michael@0: michael@0: /* extra fields */ michael@0: #define EXTENDED_TIMESTAMP_FIELD 0x5455 michael@0: #define EXTENDED_TIMESTAMP_MODTIME 0x01 michael@0: michael@0: /* compression methods */ michael@0: #define STORED 0 michael@0: #define SHRUNK 1 michael@0: #define REDUCED1 2 michael@0: #define REDUCED2 3 michael@0: #define REDUCED3 4 michael@0: #define REDUCED4 5 michael@0: #define IMPLODED 6 michael@0: #define TOKENIZED 7 michael@0: #define DEFLATED 8 michael@0: #define UNSUPPORTED 0xFF michael@0: michael@0: michael@0: #endif /* _zipstruct_h */