1 /* This Source Code Form is subject to the terms of the Mozilla Public
2  * License, v. 2.0. If a copy of the MPL was not distributed with this
3  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4 
5 /*
6  *  JARFILE.H
7  *
8  *  Certain constants and structures for the archive format.
9  *
10  */
11 
12 /* ZIP */
13 struct ZipLocal { /* 30 bytes */
14     char signature[4];
15     char word[2];
16     char bitflag[2];
17     char method[2];
18     char time[2];
19     char date[2];
20     char crc32[4];
21     char size[4];
22     char orglen[4];
23     char filename_len[2];
24     char extrafield_len[2];
25 };
26 
27 struct ZipCentral { /* 46 bytes */
28     char signature[4];
29     char version_made_by[2];
30     char version[2];
31     char bitflag[2];
32     char method[2];
33     char time[2];
34     char date[2];
35     char crc32[4];
36     char size[4];
37     char orglen[4];
38     char filename_len[2];
39     char extrafield_len[2];
40     char commentfield_len[2];
41     char diskstart_number[2];
42     char internal_attributes[2];
43     char external_attributes[4];
44     char localhdr_offset[4];
45 };
46 
47 struct ZipEnd { /* 22 bytes */
48     char signature[4];
49     char disk_nr[2];
50     char start_central_dir[2];
51     char total_entries_disk[2];
52     char total_entries_archive[2];
53     char central_dir_size[4];
54     char offset_central_dir[4];
55     char commentfield_len[2];
56 };
57 
58 #define LSIG 0x04034B50l
59 #define CSIG 0x02014B50l
60 #define ESIG 0x06054B50l
61 
62 /* TAR */
63 union TarEntry {    /* 512 bytes */
64     struct header { /* 257 bytes */
65         char filename[100];
66         char mode[8];
67         char uid[8];
68         char gid[8];
69         char size[12];
70         char time[12];
71         char checksum[8];
72         char linkflag;
73         char linkname[100];
74     } val;
75     char buffer[512];
76 };
77