Back to index

lightning-sunbird  0.9+nobinonly
zipstruct.h
Go to the documentation of this file.
00001 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
00002 /* ***** BEGIN LICENSE BLOCK *****
00003  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00004  *
00005  * The contents of this file are subject to the Mozilla Public License Version
00006  * 1.1 (the "License"); you may not use this file except in compliance with
00007  * the License. You may obtain a copy of the License at
00008  * http://www.mozilla.org/MPL/
00009  *
00010  * Software distributed under the License is distributed on an "AS IS" basis,
00011  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00012  * for the specific language governing rights and limitations under the
00013  * License.
00014  *
00015  * The Original Code is Mozilla Communicator client code, released
00016  * March 31, 1998.
00017  *
00018  * The Initial Developer of the Original Code is
00019  * Netscape Communications Corporation.
00020  * Portions created by the Initial Developer are Copyright (C) 1998-1999
00021  * the Initial Developer. All Rights Reserved.
00022  *
00023  * Contributor(s):
00024  *   Daniel Veditz <dveditz@netscape.com>
00025  *   Jeroen Dobbelaere <jeroen.dobbelaere@acunia.com>
00026  *
00027  * Alternatively, the contents of this file may be used under the terms of
00028  * either the GNU General Public License Version 2 or later (the "GPL"), or
00029  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00030  * in which case the provisions of the GPL or the LGPL are applicable instead
00031  * of those above. If you wish to allow use of your version of this file only
00032  * under the terms of either the GPL or the LGPL, and not to allow others to
00033  * use your version of this file under the terms of the MPL, indicate your
00034  * decision by deleting the provisions above and replace them with the notice
00035  * and other provisions required by the GPL or the LGPL. If you do not delete
00036  * the provisions above, a recipient may use your version of this file under
00037  * the terms of any one of the MPL, the GPL or the LGPL.
00038  *
00039  * ***** END LICENSE BLOCK ***** */
00040 
00041 #ifndef _zipstruct_h
00042 #define _zipstruct_h
00043 
00044 
00045 /*
00046  *  Certain constants and structures for
00047  *  the Phil Katz ZIP archive format.
00048  *
00049  */
00050 
00051 typedef struct ZipLocal_
00052   {
00053   unsigned char signature [4];
00054   unsigned char word [2];
00055   unsigned char bitflag [2];
00056   unsigned char method [2];
00057   unsigned char time [2];
00058   unsigned char date [2];
00059   unsigned char crc32 [4];
00060   unsigned char size [4];
00061   unsigned char orglen [4];
00062   unsigned char filename_len [2];
00063   unsigned char extrafield_len [2];
00064 } ZipLocal;
00065 
00066 /*
00067  * 'sizeof(struct XXX)' includes padding on ARM (see bug 87965)
00068  * As the internals of a jar/zip file must not depend on the target
00069  * architecture (i386, ppc, ARM, ...), use a fixed value instead.
00070  */ 
00071 #define ZIPLOCAL_SIZE (4+2+2+2+2+2+4+4+4+2+2)
00072 
00073 typedef struct ZipCentral_
00074   {
00075   unsigned char signature [4];
00076   unsigned char version_made_by [2];
00077   unsigned char version [2];
00078   unsigned char bitflag [2];
00079   unsigned char method [2];
00080   unsigned char time [2];
00081   unsigned char date [2];
00082   unsigned char crc32 [4];
00083   unsigned char size [4];
00084   unsigned char orglen [4];
00085   unsigned char filename_len [2];
00086   unsigned char extrafield_len [2];
00087   unsigned char commentfield_len [2];
00088   unsigned char diskstart_number [2];
00089   unsigned char internal_attributes [2];
00090   unsigned char external_attributes [4];
00091   unsigned char localhdr_offset [4];
00092 } ZipCentral;
00093 
00094 /*
00095  * 'sizeof(struct XXX)' includes padding on ARM (see bug 87965)
00096  * As the internals of a jar/zip file must not depend on the target
00097  * architecture (i386, ppc, ARM, ...), use a fixed value instead.
00098  */ 
00099 #define ZIPCENTRAL_SIZE (4+2+2+2+2+2+2+4+4+4+2+2+2+2+2+4+4)
00100 
00101 typedef struct ZipEnd_
00102   {
00103   unsigned char signature [4];
00104   unsigned char disk_nr [2];
00105   unsigned char start_central_dir [2];
00106   unsigned char total_entries_disk [2];
00107   unsigned char total_entries_archive [2];
00108   unsigned char central_dir_size [4];
00109   unsigned char offset_central_dir [4];
00110   unsigned char commentfield_len [2];
00111 } ZipEnd;
00112 
00113 /*
00114  * 'sizeof(struct XXX)' includes padding on ARM (see bug 87965)
00115  * As the internals of a jar/zip file must not depend on the target
00116  * architecture (i386, ppc, ARM, ...), use a fixed value instead.
00117  */ 
00118 #define ZIPEND_SIZE (4+2+2+2+2+4+4+2)
00119 
00120 /* signatures */
00121 #define LOCALSIG    0x04034B50l
00122 #define CENTRALSIG  0x02014B50l
00123 #define ENDSIG      0x06054B50l
00124 
00125 /* compression methods */
00126 #define STORED            0
00127 #define SHRUNK            1
00128 #define REDUCED1          2
00129 #define REDUCED2          3
00130 #define REDUCED3          4
00131 #define REDUCED4          5
00132 #define IMPLODED          6
00133 #define TOKENIZED         7
00134 #define DEFLATED          8
00135 #define UNSUPPORTED       0xFF
00136 
00137 
00138 #endif /* _zipstruct_h */