Google

Main Page   Class Hierarchy   Compound List   File List   Compound Members  

zip.h

00001 /*
00002     ZIP archive support for Crystal Space 3D library
00003     Copyright (C) 1998,1999 by Andrew Zabolotny <bit@eltech.ru>
00004 
00005     This library is free software; you can redistribute it and/or
00006     modify it under the terms of the GNU Library General Public
00007     License as published by the Free Software Foundation; either
00008     version 2 of the License, or (at your option) any later version.
00009 
00010     This library is distributed in the hope that it will be useful,
00011     but WITHOUT ANY WARRANTY; without even the implied warranty of
00012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013     Library General Public License for more details.
00014 
00015     You should have received a copy of the GNU Library General Public
00016     License along with this library; if not, write to the Free
00017     Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00018 */
00019 
00020 #ifndef ZIP_H
00021 #define ZIP_H
00022 
00023 #if defined(__cplusplus) && !defined(COMP_BC)
00024 extern "C" {
00025 #endif
00026 
00027 #define Byte z_Byte     /* Kludge to avoid conflicting typedef in zconf.h */
00028 #include <zlib.h>
00029 #undef Byte
00030 
00031 #if defined(__cplusplus) && !defined(COMP_BC)
00032 }
00033 #endif
00034 
00035 #define CENTRAL_HDR_SIG '\001','\002'   /* the infamous "PK" signature bytes, */
00036 #define LOCAL_HDR_SIG   '\003','\004'   /*  sans "PK" (so unzip executable not */
00037 #define END_CENTRAL_SIG '\005','\006'   /*  mistaken for zipfile itself) */
00038 #define EXTD_LOCAL_SIG  '\007','\010'   /* [ASCII "\113" == EBCDIC "\080" ??] */
00039 
00040 #define DEF_WBITS       15              /* Default LZ77 window size */
00041 #define ZIP_STORE       0               /* 'STORED' method id */
00042 #define ZIP_DEFLATE     8               /* 'DEFLATE' method id */
00043 
00044 typedef unsigned char  uch;
00045 typedef unsigned short ush;
00046 typedef unsigned long  ulg;
00047 
00048 #if 0            /* Optimization: use the (const) result of crc32(0L,NULL,0) */
00049 #  define CRCVAL_INITIAL  crc32(0L, NULL, 0)
00050 #else
00051 #  define CRCVAL_INITIAL  0L
00052 #endif
00053 
00054 typedef struct
00055 {
00056   uch version_needed_to_extract[2];
00057   ush general_purpose_bit_flag;
00058   ush compression_method;
00059   ush last_mod_file_time;
00060   ush last_mod_file_date;
00061   ulg crc32;
00062   ulg csize;
00063   ulg ucsize;
00064   ush filename_length;
00065   ush extra_field_length;
00066 } ZIP_local_file_header;
00067 
00068 typedef struct
00069 {
00070   uch version_made_by[2];
00071   uch version_needed_to_extract[2];
00072   ush general_purpose_bit_flag;
00073   ush compression_method;
00074   ush last_mod_file_time;
00075   ush last_mod_file_date;
00076   ulg crc32;
00077   ulg csize;
00078   ulg ucsize;
00079   ush filename_length;
00080   ush extra_field_length;
00081   ush file_comment_length;
00082   ush disk_number_start;
00083   ush internal_file_attributes;
00084   ulg external_file_attributes;
00085   ulg relative_offset_local_header;
00086 } ZIP_central_directory_file_header;
00087 
00088 typedef struct
00089 {
00090   ush number_this_disk;
00091   ush num_disk_start_cdir;
00092   ush num_entries_centrl_dir_ths_disk;
00093   ush total_entries_central_dir;
00094   ulg size_central_directory;
00095   ulg offset_start_central_directory;
00096   ush zipfile_comment_length;
00097 } ZIP_end_central_dir_record;
00098 
00099 //--- ZIP_local_file_header layout ---------------------------------------------
00100 #define ZIP_LOCAL_FILE_HEADER_SIZE              26
00101 #      define L_VERSION_NEEDED_TO_EXTRACT_0     0
00102 #      define L_VERSION_NEEDED_TO_EXTRACT_1     1
00103 #      define L_GENERAL_PURPOSE_BIT_FLAG        2
00104 #      define L_COMPRESSION_METHOD              4
00105 #      define L_LAST_MOD_FILE_TIME              6
00106 #      define L_LAST_MOD_FILE_DATE              8
00107 #      define L_CRC32                           10
00108 #      define L_COMPRESSED_SIZE                 14
00109 #      define L_UNCOMPRESSED_SIZE               18
00110 #      define L_FILENAME_LENGTH                 22
00111 #      define L_EXTRA_FIELD_LENGTH              24
00112 
00113 //--- ZIP_central_directory_file_header layout ---------------------------------
00114 #define ZIP_CENTRAL_DIRECTORY_FILE_HEADER_SIZE  42
00115 #      define C_VERSION_MADE_BY_0               0
00116 #      define C_VERSION_MADE_BY_1               1
00117 #      define C_VERSION_NEEDED_TO_EXTRACT_0     2
00118 #      define C_VERSION_NEEDED_TO_EXTRACT_1     3
00119 #      define C_GENERAL_PURPOSE_BIT_FLAG        4
00120 #      define C_COMPRESSION_METHOD              6
00121 #      define C_LAST_MOD_FILE_TIME              8
00122 #      define C_LAST_MOD_FILE_DATE              10
00123 #      define C_CRC32                           12
00124 #      define C_COMPRESSED_SIZE                 16
00125 #      define C_UNCOMPRESSED_SIZE               20
00126 #      define C_FILENAME_LENGTH                 24
00127 #      define C_EXTRA_FIELD_LENGTH              26
00128 #      define C_FILE_COMMENT_LENGTH             28
00129 #      define C_DISK_NUMBER_START               30
00130 #      define C_INTERNAL_FILE_ATTRIBUTES        32
00131 #      define C_EXTERNAL_FILE_ATTRIBUTES        34
00132 #      define C_RELATIVE_OFFSET_LOCAL_HEADER    38
00133 
00134 //--- ZIP_end_central_dir_record layout ----------------------------------------
00135 #define ZIP_END_CENTRAL_DIR_RECORD_SIZE         18
00136 #      define E_NUMBER_THIS_DISK                0
00137 #      define E_NUM_DISK_WITH_START_CENTRAL_DIR 2
00138 #      define E_NUM_ENTRIES_CENTRL_DIR_THS_DISK 4
00139 #      define E_TOTAL_ENTRIES_CENTRAL_DIR       6
00140 #      define E_SIZE_CENTRAL_DIRECTORY          8
00141 #      define E_OFFSET_START_CENTRAL_DIRECTORY  12
00142 #      define E_ZIPFILE_COMMENT_LENGTH          16
00143 
00144 #endif /* ZIP_H */

Generated for Crystal Space by doxygen 1.2.5 written by Dimitri van Heesch, ©1997-2000