|
1 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
|
2 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
3 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
5 |
|
6 #ifndef _zipstruct_h |
|
7 #define _zipstruct_h |
|
8 |
|
9 |
|
10 /* |
|
11 * Certain constants and structures for |
|
12 * the Phil Katz ZIP archive format. |
|
13 * |
|
14 */ |
|
15 |
|
16 typedef struct ZipLocal_ |
|
17 { |
|
18 unsigned char signature [4]; |
|
19 unsigned char word [2]; |
|
20 unsigned char bitflag [2]; |
|
21 unsigned char method [2]; |
|
22 unsigned char time [2]; |
|
23 unsigned char date [2]; |
|
24 unsigned char crc32 [4]; |
|
25 unsigned char size [4]; |
|
26 unsigned char orglen [4]; |
|
27 unsigned char filename_len [2]; |
|
28 unsigned char extrafield_len [2]; |
|
29 } ZipLocal; |
|
30 |
|
31 /* |
|
32 * 'sizeof(struct XXX)' includes padding on ARM (see bug 87965) |
|
33 * As the internals of a jar/zip file must not depend on the target |
|
34 * architecture (i386, ppc, ARM, ...), use a fixed value instead. |
|
35 */ |
|
36 #define ZIPLOCAL_SIZE (4+2+2+2+2+2+4+4+4+2+2) |
|
37 |
|
38 typedef struct ZipCentral_ |
|
39 { |
|
40 unsigned char signature [4]; |
|
41 unsigned char version_made_by [2]; |
|
42 unsigned char version [2]; |
|
43 unsigned char bitflag [2]; |
|
44 unsigned char method [2]; |
|
45 unsigned char time [2]; |
|
46 unsigned char date [2]; |
|
47 unsigned char crc32 [4]; |
|
48 unsigned char size [4]; |
|
49 unsigned char orglen [4]; |
|
50 unsigned char filename_len [2]; |
|
51 unsigned char extrafield_len [2]; |
|
52 unsigned char commentfield_len [2]; |
|
53 unsigned char diskstart_number [2]; |
|
54 unsigned char internal_attributes [2]; |
|
55 unsigned char external_attributes [4]; |
|
56 unsigned char localhdr_offset [4]; |
|
57 } ZipCentral; |
|
58 |
|
59 /* |
|
60 * 'sizeof(struct XXX)' includes padding on ARM (see bug 87965) |
|
61 * As the internals of a jar/zip file must not depend on the target |
|
62 * architecture (i386, ppc, ARM, ...), use a fixed value instead. |
|
63 */ |
|
64 #define ZIPCENTRAL_SIZE (4+2+2+2+2+2+2+4+4+4+2+2+2+2+2+4+4) |
|
65 |
|
66 typedef struct ZipEnd_ |
|
67 { |
|
68 unsigned char signature [4]; |
|
69 unsigned char disk_nr [2]; |
|
70 unsigned char start_central_dir [2]; |
|
71 unsigned char total_entries_disk [2]; |
|
72 unsigned char total_entries_archive [2]; |
|
73 unsigned char central_dir_size [4]; |
|
74 unsigned char offset_central_dir [4]; |
|
75 unsigned char commentfield_len [2]; |
|
76 } ZipEnd; |
|
77 |
|
78 /* |
|
79 * 'sizeof(struct XXX)' includes padding on ARM (see bug 87965) |
|
80 * As the internals of a jar/zip file must not depend on the target |
|
81 * architecture (i386, ppc, ARM, ...), use a fixed value instead. |
|
82 */ |
|
83 #define ZIPEND_SIZE (4+2+2+2+2+4+4+2) |
|
84 |
|
85 /* signatures */ |
|
86 #define LOCALSIG 0x04034B50l |
|
87 #define CENTRALSIG 0x02014B50l |
|
88 #define ENDSIG 0x06054B50l |
|
89 |
|
90 /* extra fields */ |
|
91 #define EXTENDED_TIMESTAMP_FIELD 0x5455 |
|
92 #define EXTENDED_TIMESTAMP_MODTIME 0x01 |
|
93 |
|
94 /* compression methods */ |
|
95 #define STORED 0 |
|
96 #define SHRUNK 1 |
|
97 #define REDUCED1 2 |
|
98 #define REDUCED2 3 |
|
99 #define REDUCED3 4 |
|
100 #define REDUCED4 5 |
|
101 #define IMPLODED 6 |
|
102 #define TOKENIZED 7 |
|
103 #define DEFLATED 8 |
|
104 #define UNSUPPORTED 0xFF |
|
105 |
|
106 |
|
107 #endif /* _zipstruct_h */ |