* Removed all Id tags.
[cacao.git] / src / vmcore / zip.h
1 /* src/vmcore/zip.c - ZIP file handling for bootstrap classloader
2
3    Copyright (C) 1996-2005, 2006, 2007 R. Grafl, A. Krall, C. Kruegel,
4    C. Oates, R. Obermaisser, M. Platter, M. Probst, S. Ring,
5    E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich,
6    J. Wenninger, Institut f. Computersprachen - TU Wien
7
8    This file is part of CACAO.
9
10    This program is free software; you can redistribute it and/or
11    modify it under the terms of the GNU General Public License as
12    published by the Free Software Foundation; either version 2, or (at
13    your option) any later version.
14
15    This program is distributed in the hope that it will be useful, but
16    WITHOUT ANY WARRANTY; without even the implied warranty of
17    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18    General Public License for more details.
19
20    You should have received a copy of the GNU General Public License
21    along with this program; if not, write to the Free Software
22    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
23    02110-1301, USA.
24
25 */
26
27
28 #ifndef _ZIP_H
29 #define _ZIP_H
30
31 #include "config.h"
32 #include "vm/types.h"
33
34 #include "toolbox/hashtable.h"
35
36 #include "vm/global.h"
37
38 #include "vmcore/class.h"
39 #include "vmcore/loader.h"
40 #include "vmcore/suck.h"
41 #include "vmcore/utf8.h"
42
43
44 /* Local file header ***********************************************************
45
46    local file header signature     4 bytes  (0x04034b50)
47    version needed to extract       2 bytes
48    general purpose bit flag        2 bytes
49    compression method              2 bytes
50    last mod file time              2 bytes
51    last mod file date              2 bytes
52    crc-32                          4 bytes
53    compressed size                 4 bytes
54    uncompressed size               4 bytes
55    file name length                2 bytes
56    extra field length              2 bytes
57
58    file name (variable size)
59    extra field (variable size)
60
61 *******************************************************************************/
62
63 #define LFH_HEADER_SIZE              30
64
65 #define LFH_SIGNATURE                0x04034b50
66 #define LFH_FILE_NAME_LENGTH         26
67 #define LFH_EXTRA_FIELD_LENGTH       28
68
69 typedef struct lfh lfh;
70
71 struct lfh {
72         u2 compressionmethod;
73         u4 compressedsize;
74         u4 uncompressedsize;
75         u2 filenamelength;
76         u2 extrafieldlength;
77 };
78
79 /* hashtable_zipfile_entry ****************************************************/
80
81 typedef struct hashtable_zipfile_entry hashtable_zipfile_entry;
82
83 struct hashtable_zipfile_entry {
84         utf                     *filename;
85         u2                       compressionmethod;
86         u4                       compressedsize;
87         u4                       uncompressedsize;
88         u1                      *data;
89         hashtable_zipfile_entry *hashlink;
90 };
91
92
93 /* function prototypes ********************************************************/
94
95 hashtable *zip_open(char *path);
96 hashtable_zipfile_entry *zip_find(list_classpath_entry *lce, utf *u);
97 classbuffer *zip_get(list_classpath_entry *lce, classinfo *c);
98
99 #endif /* _ZIP_H */
100
101 /*
102  * These are local overrides for various environment variables in Emacs.
103  * Please do not remove this and leave it at the end of the file, where
104  * Emacs will automagically detect them.
105  * ---------------------------------------------------------------------
106  * Local variables:
107  * mode: c
108  * indent-tabs-mode: t
109  * c-basic-offset: 4
110  * tab-width: 4
111  * End:
112  */