00001 #ifndef CLASSLIB_Z_CONSTANTS_H
00002 # define CLASSLIB_Z_CONSTANTS_H
00003
00004
00005
00006 # include "classlib/zip/ZipUtils.h"
00007
00008 namespace lat {
00009
00010
00011
00012
00013
00014
00015
00017 struct ZConstants : ZipUtils
00018 {
00019
00020
00021 enum Method {
00022 STORED = 0,
00023 DEFLATED = 8
00024 };
00025 enum Strategy {
00026 DEFAULT = 0,
00027 FILTERED = 1,
00028 HUFFMAN_ONLY = 2
00029 };
00030
00031
00032 enum { BEST_COMPRESSION = 9 };
00033 enum { DEFAULT_COMPRESSION = 6 };
00034 enum { BEST_SPEED = 1 };
00035
00036
00037 enum { DEFAULT_WINDOW_BITS = 15 };
00038 enum { DEFAULT_MEM_LEVEL = 8 };
00039
00040
00041
00042 enum { ARCHIVE_VERSION = 20 };
00043
00044
00045 enum { DIR_HEADER_MAGIC = 0x02014b50 };
00046 enum { ENTRY_HEADER_MAGIC = 0x04034b50 };
00047 enum { END_HEADER_MAGIC = 0x06054b50 };
00048 enum { ZIP_MAGIC_LEN = 4 };
00049 enum { MAX_VAR_LEN = 0xffff };
00050 enum { MAX_SIZE = 0xffffffff };
00051
00052
00053
00054 enum {
00055 DIR_MAGIC_OFF = 0,
00056 DIR_VMADE_OFF = 4, DIR_VMADE_LEN = 2,
00057 DIR_VREQD_OFF = 6, DIR_VREQD_LEN = 2,
00058 DIR_FLAG_OFF = 8, DIR_FLAG_LEN = 2,
00059 DIR_METHOD_OFF = 10, DIR_METHOD_LEN = 2,
00060 DIR_DATE_OFF = 12, DIR_DATE_LEN = 4,
00061 DIR_CRC32_OFF = 16, DIR_CRC32_LEN = 4,
00062 DIR_CSIZE_OFF = 20, DIR_CSIZE_LEN = 4,
00063 DIR_USIZE_OFF = 24, DIR_USIZE_LEN = 4,
00064 DIR_NAMELEN_OFF = 28, DIR_NAMELEN_LEN = 2,
00065 DIR_EXTRALEN_OFF = 30, DIR_EXTRALEN_LEN = 2,
00066 DIR_COMMENTLEN_OFF = 32, DIR_COMMENTLEN_LEN = 2,
00067 DIR_DISK_START_OFF = 34, DIR_DISK_START_LEN = 2,
00068 DIR_INT_ATTR_OFF = 36, DIR_INT_ATTR_LEN = 2,
00069 DIR_EXT_ATTR_OFF = 38, DIR_EXT_ATTR_LEN = 4,
00070 DIR_ENTRY_POS_OFF = 42, DIR_ENTRY_POS_LEN = 4,
00071 DIR_HEADER_SIZE = 46
00072 };
00073
00074
00075 enum{
00076 END_MAGIC_OFF = 0,
00077 END_DISK_OFF = 4, END_DISK_LEN = 2,
00078 END_DIR_DISK_OFF = 6, END_DIR_DISK_LEN = 2,
00079 END_DISK_HDRS_OFF = 8, END_DISK_HDRS_LEN = 2,
00080 END_TOTAL_HDRS_OFF = 10, END_TOTAL_HDRS_LEN = 2,
00081 END_DIR_SIZE_OFF = 12, END_DIR_SIZE_LEN = 4,
00082 END_DIR_OFFSET_OFF = 16, END_DIR_OFFSET_LEN = 4,
00083 END_COMMENTLEN_OFF = 20, END_COMMENTLEN_LEN = 2,
00084 END_HEADER_SIZE = 22
00085 };
00086
00087
00088 enum {
00089 ENTRY_MAGIC_OFF = 0,
00090 ENTRY_VREQD_OFF = 4, ENTRY_VREQD_LEN = 2,
00091 ENTRY_FLAG_OFF = 6, ENTRY_FLAG_LEN = 2,
00092 ENTRY_METHOD_OFF = 8, ENTRY_METHOD_LEN = 2,
00093 ENTRY_DATE_OFF = 10, ENTRY_DATE_LEN = 4,
00094 ENTRY_CRC32_OFF = 14, ENTRY_CRC32_LEN = 4,
00095 ENTRY_CSIZE_OFF = 18, ENTRY_CSIZE_LEN = 4,
00096 ENTRY_USIZE_OFF = 22, ENTRY_USIZE_LEN = 4,
00097 ENTRY_NAMELEN_OFF = 26, ENTRY_NAMELEN_LEN = 2,
00098 ENTRY_EXTRALEN_OFF = 28, ENTRY_EXTRALEN_LEN = 2,
00099 ENTRY_HEADER_SIZE = 30
00100 };
00101
00102
00103 enum { GZIP_MAGIC = 0x8b1f };
00104 enum {
00105 GZHDR_MAGIC_OFF = 0, GZHDR_MAGIC_LEN = 2,
00106 GZHDR_METHOD_OFF = 2, GZHDR_METHOD_LEN = 1,
00107 GZHDR_FLAGS_OFF = 3, GZHDR_FLAGS_LEN = 1,
00108 GZHDR_TIME_OFF = 4, GZHDR_TIME_LEN = 4,
00109 GZHDR_XFLAGS_OFF = 8, GZHDR_XFLAGS_LEN = 1,
00110 GZHDR_OS_OFF = 9, GZHDR_OS_LEN = 1,
00111 GZHDR_SIZE = 10,
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124 GZHDR_FLAG_ASCII = 1,
00125 GZHDR_FLAG_HEAD_CRC = 2,
00126 GZHDR_FLAG_EXTRA_FIELD = 4,
00127 GZHDR_FLAG_ORIG_NAME = 8,
00128 GZHDR_FLAG_COMMENT = 16,
00129 GZHDR_FLAG_RESERVED = 0xe0
00130 };
00131 };
00132
00133
00134
00135
00136 }
00137 #endif // CLASSLIB_Z_CONSTANTS_H