PageRenderTime 21ms CodeModel.GetById 9ms app.highlight 9ms RepoModel.GetById 1ms app.codeStats 0ms

/modules/libjar/zipstruct.h

http://github.com/zpao/v8monkey
C Header | 142 lines | 66 code | 14 blank | 62 comment | 0 complexity | 88e45eec03bf55809a9ac0ff0e287f30 MD5 | raw file
  1/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
  2/* ***** BEGIN LICENSE BLOCK *****
  3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
  4 *
  5 * The contents of this file are subject to the Mozilla Public License Version
  6 * 1.1 (the "License"); you may not use this file except in compliance with
  7 * the License. You may obtain a copy of the License at
  8 * http://www.mozilla.org/MPL/
  9 *
 10 * Software distributed under the License is distributed on an "AS IS" basis,
 11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
 12 * for the specific language governing rights and limitations under the
 13 * License.
 14 *
 15 * The Original Code is Mozilla Communicator client code, released
 16 * March 31, 1998.
 17 *
 18 * The Initial Developer of the Original Code is
 19 * Netscape Communications Corporation.
 20 * Portions created by the Initial Developer are Copyright (C) 1998-1999
 21 * the Initial Developer. All Rights Reserved.
 22 *
 23 * Contributor(s):
 24 *   Daniel Veditz <dveditz@netscape.com>
 25 *   Jeroen Dobbelaere <jeroen.dobbelaere@acunia.com>
 26 *
 27 * Alternatively, the contents of this file may be used under the terms of
 28 * either the GNU General Public License Version 2 or later (the "GPL"), or
 29 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
 30 * in which case the provisions of the GPL or the LGPL are applicable instead
 31 * of those above. If you wish to allow use of your version of this file only
 32 * under the terms of either the GPL or the LGPL, and not to allow others to
 33 * use your version of this file under the terms of the MPL, indicate your
 34 * decision by deleting the provisions above and replace them with the notice
 35 * and other provisions required by the GPL or the LGPL. If you do not delete
 36 * the provisions above, a recipient may use your version of this file under
 37 * the terms of any one of the MPL, the GPL or the LGPL.
 38 *
 39 * ***** END LICENSE BLOCK ***** */
 40
 41#ifndef _zipstruct_h
 42#define _zipstruct_h
 43
 44
 45/*
 46 *  Certain constants and structures for
 47 *  the Phil Katz ZIP archive format.
 48 *
 49 */
 50
 51typedef struct ZipLocal_
 52  {
 53  unsigned char signature [4];
 54  unsigned char word [2];
 55  unsigned char bitflag [2];
 56  unsigned char method [2];
 57  unsigned char time [2];
 58  unsigned char date [2];
 59  unsigned char crc32 [4];
 60  unsigned char size [4];
 61  unsigned char orglen [4];
 62  unsigned char filename_len [2];
 63  unsigned char extrafield_len [2];
 64} ZipLocal;
 65
 66/*
 67 * 'sizeof(struct XXX)' includes padding on ARM (see bug 87965)
 68 * As the internals of a jar/zip file must not depend on the target
 69 * architecture (i386, ppc, ARM, ...), use a fixed value instead.
 70 */ 
 71#define ZIPLOCAL_SIZE (4+2+2+2+2+2+4+4+4+2+2)
 72
 73typedef struct ZipCentral_
 74  {
 75  unsigned char signature [4];
 76  unsigned char version_made_by [2];
 77  unsigned char version [2];
 78  unsigned char bitflag [2];
 79  unsigned char method [2];
 80  unsigned char time [2];
 81  unsigned char date [2];
 82  unsigned char crc32 [4];
 83  unsigned char size [4];
 84  unsigned char orglen [4];
 85  unsigned char filename_len [2];
 86  unsigned char extrafield_len [2];
 87  unsigned char commentfield_len [2];
 88  unsigned char diskstart_number [2];
 89  unsigned char internal_attributes [2];
 90  unsigned char external_attributes [4];
 91  unsigned char localhdr_offset [4];
 92} ZipCentral;
 93
 94/*
 95 * 'sizeof(struct XXX)' includes padding on ARM (see bug 87965)
 96 * As the internals of a jar/zip file must not depend on the target
 97 * architecture (i386, ppc, ARM, ...), use a fixed value instead.
 98 */ 
 99#define ZIPCENTRAL_SIZE (4+2+2+2+2+2+2+4+4+4+2+2+2+2+2+4+4)
100
101typedef struct ZipEnd_
102  {
103  unsigned char signature [4];
104  unsigned char disk_nr [2];
105  unsigned char start_central_dir [2];
106  unsigned char total_entries_disk [2];
107  unsigned char total_entries_archive [2];
108  unsigned char central_dir_size [4];
109  unsigned char offset_central_dir [4];
110  unsigned char commentfield_len [2];
111} ZipEnd;
112
113/*
114 * 'sizeof(struct XXX)' includes padding on ARM (see bug 87965)
115 * As the internals of a jar/zip file must not depend on the target
116 * architecture (i386, ppc, ARM, ...), use a fixed value instead.
117 */ 
118#define ZIPEND_SIZE (4+2+2+2+2+4+4+2)
119
120/* signatures */
121#define LOCALSIG    0x04034B50l
122#define CENTRALSIG  0x02014B50l
123#define ENDSIG      0x06054B50l
124
125/* extra fields */
126#define EXTENDED_TIMESTAMP_FIELD   0x5455
127#define EXTENDED_TIMESTAMP_MODTIME 0x01
128
129/* compression methods */
130#define STORED            0
131#define SHRUNK            1
132#define REDUCED1          2
133#define REDUCED2          3
134#define REDUCED3          4
135#define REDUCED4          5
136#define IMPLODED          6
137#define TOKENIZED         7
138#define DEFLATED          8
139#define UNSUPPORTED       0xFF
140
141
142#endif /* _zipstruct_h */