tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

zipstruct.h (2979B)


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