modules/libjar/zipstruct.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/modules/libjar/zipstruct.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,107 @@
     1.4 +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.8 +
     1.9 +#ifndef _zipstruct_h
    1.10 +#define _zipstruct_h
    1.11 +
    1.12 +
    1.13 +/*
    1.14 + *  Certain constants and structures for
    1.15 + *  the Phil Katz ZIP archive format.
    1.16 + *
    1.17 + */
    1.18 +
    1.19 +typedef struct ZipLocal_
    1.20 +  {
    1.21 +  unsigned char signature [4];
    1.22 +  unsigned char word [2];
    1.23 +  unsigned char bitflag [2];
    1.24 +  unsigned char method [2];
    1.25 +  unsigned char time [2];
    1.26 +  unsigned char date [2];
    1.27 +  unsigned char crc32 [4];
    1.28 +  unsigned char size [4];
    1.29 +  unsigned char orglen [4];
    1.30 +  unsigned char filename_len [2];
    1.31 +  unsigned char extrafield_len [2];
    1.32 +} ZipLocal;
    1.33 +
    1.34 +/*
    1.35 + * 'sizeof(struct XXX)' includes padding on ARM (see bug 87965)
    1.36 + * As the internals of a jar/zip file must not depend on the target
    1.37 + * architecture (i386, ppc, ARM, ...), use a fixed value instead.
    1.38 + */ 
    1.39 +#define ZIPLOCAL_SIZE (4+2+2+2+2+2+4+4+4+2+2)
    1.40 +
    1.41 +typedef struct ZipCentral_
    1.42 +  {
    1.43 +  unsigned char signature [4];
    1.44 +  unsigned char version_made_by [2];
    1.45 +  unsigned char version [2];
    1.46 +  unsigned char bitflag [2];
    1.47 +  unsigned char method [2];
    1.48 +  unsigned char time [2];
    1.49 +  unsigned char date [2];
    1.50 +  unsigned char crc32 [4];
    1.51 +  unsigned char size [4];
    1.52 +  unsigned char orglen [4];
    1.53 +  unsigned char filename_len [2];
    1.54 +  unsigned char extrafield_len [2];
    1.55 +  unsigned char commentfield_len [2];
    1.56 +  unsigned char diskstart_number [2];
    1.57 +  unsigned char internal_attributes [2];
    1.58 +  unsigned char external_attributes [4];
    1.59 +  unsigned char localhdr_offset [4];
    1.60 +} ZipCentral;
    1.61 +
    1.62 +/*
    1.63 + * 'sizeof(struct XXX)' includes padding on ARM (see bug 87965)
    1.64 + * As the internals of a jar/zip file must not depend on the target
    1.65 + * architecture (i386, ppc, ARM, ...), use a fixed value instead.
    1.66 + */ 
    1.67 +#define ZIPCENTRAL_SIZE (4+2+2+2+2+2+2+4+4+4+2+2+2+2+2+4+4)
    1.68 +
    1.69 +typedef struct ZipEnd_
    1.70 +  {
    1.71 +  unsigned char signature [4];
    1.72 +  unsigned char disk_nr [2];
    1.73 +  unsigned char start_central_dir [2];
    1.74 +  unsigned char total_entries_disk [2];
    1.75 +  unsigned char total_entries_archive [2];
    1.76 +  unsigned char central_dir_size [4];
    1.77 +  unsigned char offset_central_dir [4];
    1.78 +  unsigned char commentfield_len [2];
    1.79 +} ZipEnd;
    1.80 +
    1.81 +/*
    1.82 + * 'sizeof(struct XXX)' includes padding on ARM (see bug 87965)
    1.83 + * As the internals of a jar/zip file must not depend on the target
    1.84 + * architecture (i386, ppc, ARM, ...), use a fixed value instead.
    1.85 + */ 
    1.86 +#define ZIPEND_SIZE (4+2+2+2+2+4+4+2)
    1.87 +
    1.88 +/* signatures */
    1.89 +#define LOCALSIG    0x04034B50l
    1.90 +#define CENTRALSIG  0x02014B50l
    1.91 +#define ENDSIG      0x06054B50l
    1.92 +
    1.93 +/* extra fields */
    1.94 +#define EXTENDED_TIMESTAMP_FIELD   0x5455
    1.95 +#define EXTENDED_TIMESTAMP_MODTIME 0x01
    1.96 +
    1.97 +/* compression methods */
    1.98 +#define STORED            0
    1.99 +#define SHRUNK            1
   1.100 +#define REDUCED1          2
   1.101 +#define REDUCED2          3
   1.102 +#define REDUCED3          4
   1.103 +#define REDUCED4          5
   1.104 +#define IMPLODED          6
   1.105 +#define TOKENIZED         7
   1.106 +#define DEFLATED          8
   1.107 +#define UNSUPPORTED       0xFF
   1.108 +
   1.109 +
   1.110 +#endif /* _zipstruct_h */

mercurial