forked from eclipse-openj9/openj9
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathzipsup.h
More file actions
195 lines (169 loc) · 5.57 KB
/
zipsup.h
File metadata and controls
195 lines (169 loc) · 5.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
/*******************************************************************************
* Copyright IBM Corp. and others 1991
*
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which accompanies this
* distribution and is available at https://www.eclipse.org/legal/epl-2.0/
* or the Apache License, Version 2.0 which accompanies this distribution and
* is available at https://www.apache.org/licenses/LICENSE-2.0.
*
* This Source Code may also be made available under the following
* Secondary Licenses when the conditions for such availability set
* forth in the Eclipse Public License, v. 2.0 are satisfied: GNU
* General Public License, version 2 with the GNU Classpath
* Exception [1] and GNU General Public License, version 2 with the
* OpenJDK Assembly Exception [2].
*
* [1] https://www.gnu.org/software/classpath/license.html
* [2] https://openjdk.org/legal/assembly-exception.html
*
* SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 OR GPL-2.0-only WITH OpenJDK-assembly-exception-1.0
*******************************************************************************/
/**
* @file
* @ingroup ZipSupport
* @brief Zip Support Header
*/
#ifndef ZIPSUP_H
#define ZIPSUP_H
/* @ddr_namespace: default */
#ifdef __cplusplus
extern "C" {
#endif
/* DO NOT DIRECTLY INCLUDE THIS FILE! */
/* Use zip_api.h from the include/ directory instead. */
#include "j9port.h"
typedef struct J9ZipCachePool J9ZipCachePool;
#define J9WSRP IDATA
#define ZIP_INTERNAL_MAX 80
#define ZIP_CM_Reduced1 2
#define ZIP_Unknown 0
#define ZIP_GZIP 2
#define ZIP_ERR_OUT_OF_MEMORY -3
#define ZIP_ERR_FILE_CORRUPT -6
#define ZIP_ERR_INTERNAL_ERROR -11
#define ZIP_ERR_FILE_TOO_BIG -12
#define ZIP_CM_Imploded 6
#define ZIP_CM_Reduced4 5
#define ZIP_CM_Shrunk 1
#define ZIP_CM_Reduced2 3
#define ZIP_ERR_FILE_READ_ERROR -1
#define ZIP_CentralHeader 0x2014B50
#define ZIP_ERR_FILE_CLOSE_ERROR -10
#define ZIP_ERR_BUFFER_TOO_SMALL -7
#define ZIP_CM_Reduced3 4
#define ZIP_CM_Deflated 8
#define ZIP_LocalHeader 0x4034B50
#define ZIP_CM_Tokenized 7
#define ZIP_PKZIP 1
#define ZIP_CM_Stored 0
#define ZIP_ERR_UNSUPPORTED_FILE_TYPE -5
#define ZIP_ERR_NO_MORE_ENTRIES -2
#define ZIP_CentralEnd 0x6054B50
#define ZIP_ERR_FILE_OPEN_ERROR -9
#define ZIP_ERR_UNKNOWN_FILE_TYPE -4
#define ZIP_ERR_ENTRY_NOT_FOUND -8
#define ZIP_DataDescriptor 0x8074B50
typedef struct J9ZipCache {
struct J9PortLibrary * portLib;
void* cachePool;
void* cachePoolEntry;
} J9ZipCache;
typedef struct J9ZipCentralEnd {
U_16 diskNumber;
U_16 dirStartDisk;
U_16 thisDiskEntries;
#if defined(J9VM_ENV_DATA64)
/* entries in the central dir <= INT32_MAX */
I_32 totalEntries;
/* size of the central dir <= LLONG_MAX */
I_64 dirSize;
/* offset of the central dir <= LLONG_MAX */
I_64 dirOffset;
#else /* defined(J9VM_ENV_DATA64) */
U_16 totalEntries;
U_32 dirSize;
U_32 dirOffset;
#endif /* defined(J9VM_ENV_DATA64) */
U_16 commentLength;
U_8* comment;
U_64 endCentralDirRecordPosition;
} J9ZipCentralEnd;
typedef struct J9ZipEntry {
U_8* data;
U_8* filename;
U_8* extraField;
U_8* fileComment;
I_64 dataPointer;
I_64 filenamePointer;
I_64 extraFieldPointer;
I_64 fileCommentPointer;
U_32 compressedSize;
U_32 uncompressedSize;
U_32 crc32;
U_16 filenameLength;
U_16 extraFieldLength;
U_16 fileCommentLength;
U_16 internalAttributes;
U_16 versionCreated;
U_16 versionNeeded;
U_16 flags;
U_16 compressionMethod;
U_16 lastModTime;
U_16 lastModDate;
U_8 internalFilename[80];
} J9ZipEntry;
typedef struct J9ZipFile {
U_8* filename;
struct J9ZipCache* cache;
void* cachePool;
IDATA fd;
I_64 pointer;
U_8 internalFilename[80];
U_8 type;
} J9ZipFile;
typedef struct J9ZipChunkHeader {
J9WSRP next;
U_8* beginFree;
U_8* endFree;
} J9ZipChunkHeader;
#define J9ZIPCHUNKHEADER_NEXT(base) WSRP_GET((base)->next, struct J9ZipChunkHeader*)
typedef struct J9ZipFileEntry {
UDATA nameLength;
UDATA zipFileOffset;
} J9ZipFileEntry;
typedef struct J9ZipFileRecord {
J9WSRP next;
UDATA entryCount;
struct J9ZipFileEntry entry[1];
} J9ZipFileRecord;
#define J9ZIPFILERECORD_NEXT(base) WSRP_GET((base)->next, struct J9ZipFileRecord*)
typedef struct J9ZipDirEntry {
J9WSRP next;
J9WSRP fileList;
J9WSRP dirList;
UDATA zipFileOffset;
} J9ZipDirEntry;
#define J9ZIPDIRENTRY_NEXT(base) WSRP_GET((base)->next, struct J9ZipDirEntry*)
#define J9ZIPDIRENTRY_FILELIST(base) WSRP_GET((base)->fileList, struct J9ZipFileRecord*)
#define J9ZIPDIRENTRY_DIRLIST(base) WSRP_GET((base)->dirList, struct J9ZipDirEntry*)
typedef struct J9ZipCacheEntry {
J9WSRP zipFileName;
IDATA zipFileSize;
I_64 zipTimeStamp;
IDATA startCentralDir;
J9WSRP currentChunk;
J9WSRP chunkActiveDir;
struct J9ZipDirEntry root;
} J9ZipCacheEntry;
#define J9ZIPCACHEENTRY_ZIPFILENAME(base) WSRP_GET((base)->zipFileName, U_8*)
#define J9ZIPCACHEENTRY_CURRENTCHUNK(base) WSRP_GET((base)->currentChunk, struct J9ZipChunkHeader*)
#define J9ZIPCACHEENTRY_CHUNKACTIVEDIR(base) WSRP_GET((base)->chunkActiveDir, struct J9ZipDirEntry*)
#define J9ZIPCACHEENTRY_NEXT(base) WSRP_GET((&((base)->root))->next, struct J9ZipDirEntry*)
#define J9ZIPCACHEENTRY_FILELIST(base) WSRP_GET((&((base)->root))->fileList, struct J9ZipFileRecord*)
#define J9ZIPCACHEENTRY_DIRLIST(base) WSRP_GET((&((base)->root))->dirList, struct J9ZipDirEntry*)
#undef J9WSRP
#ifdef __cplusplus
}
#endif
#endif /* ZIPSUP_H */