Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openj9
Path: blob/master/runtime/include/vmizip.h
5986 views
1
/*******************************************************************************
2
* Copyright (c) 2001, 2014 IBM Corp. and others
3
*
4
* This program and the accompanying materials are made available under
5
* the terms of the Eclipse Public License 2.0 which accompanies this
6
* distribution and is available at https://www.eclipse.org/legal/epl-2.0/
7
* or the Apache License, Version 2.0 which accompanies this distribution and
8
* is available at https://www.apache.org/licenses/LICENSE-2.0.
9
*
10
* This Source Code may also be made available under the following
11
* Secondary Licenses when the conditions for such availability set
12
* forth in the Eclipse Public License, v. 2.0 are satisfied: GNU
13
* General Public License, version 2 with the GNU Classpath
14
* Exception [1] and GNU General Public License, version 2 with the
15
* OpenJDK Assembly Exception [2].
16
*
17
* [1] https://www.gnu.org/software/classpath/license.html
18
* [2] http://openjdk.java.net/legal/assembly-exception.html
19
*
20
* SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 OR LicenseRef-GPL-2.0 WITH Assembly-exception
21
*******************************************************************************/
22
#ifndef vmizip_h
23
#define vmizip_h
24
25
#include "j9comp.h"
26
#include "hookable_api.h"
27
28
#ifdef __cplusplus
29
extern "C" {
30
#endif
31
32
/* function return codes */
33
#define ZIP_ERR_FILE_READ_ERROR -1
34
#define ZIP_ERR_NO_MORE_ENTRIES -2
35
#define ZIP_ERR_OUT_OF_MEMORY -3
36
#define ZIP_ERR_UNKNOWN_FILE_TYPE -4
37
#define ZIP_ERR_UNSUPPORTED_FILE_TYPE -5
38
#define ZIP_ERR_FILE_CORRUPT -6
39
#define ZIP_ERR_BUFFER_TOO_SMALL -7
40
#define ZIP_ERR_ENTRY_NOT_FOUND -8
41
#define ZIP_ERR_FILE_OPEN_ERROR -9
42
#define ZIP_ERR_FILE_CLOSE_ERROR -10
43
#define ZIP_ERR_INTERNAL_ERROR -11
44
45
/* flags used in VMIZipEntry compressionMethod */
46
#define ZIP_CM_Stored 0
47
#define ZIP_CM_Shrunk 1
48
#define ZIP_CM_Reduced1 2
49
#define ZIP_CM_Reduced2 3
50
#define ZIP_CM_Reduced3 4
51
#define ZIP_CM_Imploded 6
52
#define ZIP_CM_Reduced4 5
53
#define ZIP_CM_Tokenized 7
54
#define ZIP_CM_Deflated 8
55
56
/* flags used in zip_getZipEntry(), zip_getZipEntryFromOffset(), and zip_getNextZipEntry() */
57
#define ZIP_FLAG_FIND_DIRECTORY 1
58
#define ZIP_FLAG_READ_DATA_POINTER 2
59
60
/* flags used in zip_openZipFile() */
61
#define ZIP_FLAG_OPEN_CACHE 1
62
#define ZIP_FLAG_BOOTSTRAP 2
63
64
typedef struct VMIZipEntry
65
{
66
U_8 *data;
67
U_8 *filename;
68
U_8 *extraField;
69
U_8 *fileComment;
70
I_32 dataPointer;
71
I_32 filenamePointer;
72
I_32 extraFieldPointer;
73
I_32 fileCommentPointer;
74
U_32 compressedSize;
75
U_32 uncompressedSize;
76
U_32 crc32;
77
U_16 filenameLength;
78
U_16 extraFieldLength;
79
U_16 fileCommentLength;
80
U_16 internalAttributes;
81
U_16 versionCreated;
82
U_16 versionNeeded;
83
U_16 flags;
84
U_16 compressionMethod;
85
U_16 lastModTime;
86
U_16 lastModDate;
87
U_8 internalFilename[80];
88
} VMIZipEntry;
89
90
typedef struct VMIZipFile
91
{
92
U_8 *filename;
93
void *cache;
94
void *cachePool;
95
I_32 fd;
96
I_32 pointer;
97
U_8 internalFilename[80];
98
U_8 type;
99
char _vmipadding0065[3]; /* 3 bytes of automatic padding */
100
} VMIZipFile;
101
102
typedef struct VMIZipFunctionTable {
103
I_32 (*zip_closeZipFile) (VMInterface * vmi, VMIZipFile * zipFile) ;
104
void (*zip_freeZipEntry) (VMInterface * vmi, VMIZipEntry * entry) ;
105
I_32 (*zip_getNextZipEntry) (VMInterface * vmi, VMIZipFile * zipFile, VMIZipEntry * zipEntry, IDATA * nextEntryPointer, I_32 flags) ;
106
I_32 (*zip_getZipEntry) (VMInterface * vmi, VMIZipFile * zipFile, VMIZipEntry * entry, const char *filename, I_32 flags) ;
107
I_32 (*zip_getZipEntryComment) (VMInterface * vmi, VMIZipFile * zipFile, VMIZipEntry * entry, U_8 * buffer, U_32 bufferSize) ;
108
I_32 (*zip_getZipEntryData) (VMInterface * vmi, VMIZipFile * zipFile, VMIZipEntry * entry, U_8 * buffer, U_32 bufferSize) ;
109
I_32 (*zip_getZipEntryExtraField) (VMInterface * vmi, VMIZipFile * zipFile, VMIZipEntry * entry, U_8 * buffer, U_32 bufferSize) ;
110
I_32 (*zip_getZipEntryFromOffset) (VMInterface * vmi, VMIZipFile * zipFile, VMIZipEntry * entry, IDATA offset, I_32 flags) ;
111
I_32 (*zip_getZipEntryRawData) (VMInterface * vm, VMIZipFile * zipFile, VMIZipEntry * entry, U_8 * buffer, U_32 bufferSize, U_32 offset) ;
112
void (*zip_initZipEntry) (VMInterface * vmi, VMIZipEntry * entry) ;
113
I_32 (*zip_openZipFile) (VMInterface * vmi, char *filename, VMIZipFile * zipFile, I_32 flags) ;
114
void (*zip_resetZipFile) (VMInterface * vmi, VMIZipFile * zipFile, IDATA * nextEntryPointer) ;
115
IDATA (*zipCache_enumElement) (void *handle, char *nameBuf, UDATA nameBufSize, UDATA * offset) ;
116
IDATA (*zipCache_enumGetDirName) (void *handle, char *nameBuf, UDATA nameBufSize) ;
117
void (*zipCache_enumKill) (void *handle) ;
118
IDATA (*zipCache_enumNew) (void * zipCache, char *directoryName, void **handle) ;
119
I_32 (*zip_getZipComment) (VMInterface * vmi, VMIZipFile * zipFile, U_8 ** comment, UDATA * commentSize);
120
void (*zip_freeZipComment) (VMInterface * vmi, U_8 * comment);
121
I_32 (*zip_getZipEntryWithSize) (VMInterface * vmi, VMIZipFile * zipFile, VMIZipEntry * entry, const char *filename, IDATA filenameLength, I_32 flags) ;
122
123
/* J9 specific, keep these at the end */
124
struct J9HookInterface** (*zip_getZipHookInterface) (VMInterface * vmi) ;
125
126
void *reserved;
127
} VMIZipFunctionTable;
128
129
extern VMIZipFunctionTable VMIZipLibraryTable;
130
131
#ifdef __cplusplus
132
}
133
#endif
134
135
#endif /* vmi_h */
136
137