source: trunk/icedtea-web/launcher/manifest_info.h@ 385

Last change on this file since 385 was 348, checked in by dmik, 13 years ago

vendor: Add icedtea-web v1.1.2 to current.

File size: 6.0 KB
Line 
1/*
2 * Copyright (c) 2003, 2005, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26#ifndef _MANIFEST_INFO_H
27#define _MANIFEST_INFO_H
28
29#include <sys/types.h>
30
31/*
32 * Zip file header signatures
33 */
34#define SIGSIZ 4 /* size of all header signatures */
35#define LOCSIG 0x04034b50L /* "PK\003\004" */
36#define EXTSIG 0x08074b50L /* "PK\007\008" */
37#define CENSIG 0x02014b50L /* "PK\001\002" */
38#define ENDSIG 0x06054b50L /* "PK\005\006" */
39
40/*
41 * Header sizes including signatures
42 */
43#define LOCHDR 30
44#define EXTHDR 16
45#define CENHDR 46
46#define ENDHDR 22
47
48/*
49 * Header field access macros
50 */
51#define CH(b, n) (((unsigned char *)(b))[n])
52#define SH(b, n) (CH(b, n) | (CH(b, n+1) << 8))
53#define LG(b, n) (SH(b, n) | (SH(b, n+2) << 16))
54#define GETSIG(b) LG(b, 0)
55
56/*
57 * Macros for getting local file (LOC) header fields
58 */
59#define LOCVER(b) SH(b, 4) /* version needed to extract */
60#define LOCFLG(b) SH(b, 6) /* general purpose bit flags */
61#define LOCHOW(b) SH(b, 8) /* compression method */
62#define LOCTIM(b) LG(b, 10) /* modification time */
63#define LOCCRC(b) LG(b, 14) /* crc of uncompressed data */
64#define LOCSIZ(b) LG(b, 18) /* compressed data size */
65#define LOCLEN(b) LG(b, 22) /* uncompressed data size */
66#define LOCNAM(b) SH(b, 26) /* filename length */
67#define LOCEXT(b) SH(b, 28) /* extra field length */
68
69/*
70 * Macros for getting extra local (EXT) header fields
71 */
72#define EXTCRC(b) LG(b, 4) /* crc of uncompressed data */
73#define EXTSIZ(b) LG(b, 8) /* compressed size */
74#define EXTLEN(b) LG(b, 12) /* uncompressed size */
75
76/*
77 * Macros for getting central directory header (CEN) fields
78 */
79#define CENVEM(b) SH(b, 4) /* version made by */
80#define CENVER(b) SH(b, 6) /* version needed to extract */
81#define CENFLG(b) SH(b, 8) /* general purpose bit flags */
82#define CENHOW(b) SH(b, 10) /* compression method */
83#define CENTIM(b) LG(b, 12) /* modification time */
84#define CENCRC(b) LG(b, 16) /* crc of uncompressed data */
85#define CENSIZ(b) LG(b, 20) /* compressed size */
86#define CENLEN(b) LG(b, 24) /* uncompressed size */
87#define CENNAM(b) SH(b, 28) /* length of filename */
88#define CENEXT(b) SH(b, 30) /* length of extra field */
89#define CENCOM(b) SH(b, 32) /* file comment length */
90#define CENDSK(b) SH(b, 34) /* disk number start */
91#define CENATT(b) SH(b, 36) /* internal file attributes */
92#define CENATX(b) LG(b, 38) /* external file attributes */
93#define CENOFF(b) LG(b, 42) /* offset of local header */
94
95/*
96 * Macros for getting end of central directory header (END) fields
97 */
98#define ENDSUB(b) SH(b, 8) /* number of entries on this disk */
99#define ENDTOT(b) SH(b, 10) /* total number of entries */
100#define ENDSIZ(b) LG(b, 12) /* central directory size */
101#define ENDOFF(b) LG(b, 16) /* central directory offset */
102#define ENDCOM(b) SH(b, 20) /* size of zip file comment */
103
104/*
105 * A comment of maximum length of 64kb can follow the END record. This
106 * is the furthest the END record can be from the end of the file.
107 */
108#define END_MAXLEN (0xFFFF + ENDHDR)
109
110/*
111 * Supported compression methods.
112 */
113#define STORED 0
114#define DEFLATED 8
115
116/*
117 * Information from the CEN entry to inflate a file.
118 */
119typedef struct zentry { /* Zip file entry */
120 size_t isize; /* size of inflated data */
121 size_t csize; /* size of compressed data (zero if uncompressed) */
122 off_t offset; /* position of compressed data */
123 int how; /* compression method (if any) */
124} zentry;
125
126/*
127 * Information returned from the Manifest file by the ParseManifest() routine.
128 * Certainly (much) more could be returned, but this is the information
129 * currently of interest to the C based Java utilities (particularly the
130 * Java launcher).
131 */
132typedef struct manifest_info { /* Interesting fields from the Manifest */
133 char *manifest_version; /* Manifest-Version string */
134 char *main_class; /* Main-Class entry */
135 char *jre_version; /* Appropriate J2SE release spec */
136 char jre_restrict_search; /* Restricted JRE search */
137 char *splashscreen_image_file_name; /* splashscreen image file */
138} manifest_info;
139
140/*
141 * Attribute closure to provide to manifest_iterate.
142 */
143typedef void (*attribute_closure)(const char *name, const char *value,
144 void *user_data);
145
146/*
147 * Function prototypes.
148 */
149int JLI_ParseManifest(char *jarfile, manifest_info *info);
150void *JLI_JarUnpackFile(const char *jarfile, const char *filename,
151 int *size);
152void JLI_FreeManifest(void);
153int JLI_ManifestIterate(const char *jarfile, attribute_closure ac,
154 void *user_data);
155
156#endif /* _MANIFEST_INFO_H */
Note: See TracBrowser for help on using the repository browser.