diff options
Diffstat (limited to 'src/common/unzip.h')
-rw-r--r-- | src/common/unzip.h | 126 |
1 files changed, 126 insertions, 0 deletions
diff --git a/src/common/unzip.h b/src/common/unzip.h new file mode 100644 index 0000000..f0c2c4e --- /dev/null +++ b/src/common/unzip.h | |||
@@ -0,0 +1,126 @@ | |||
1 | /* | ||
2 | This file is part of libextractor. | ||
3 | (C) 2008 Christian Grothoff (and other contributing authors) | ||
4 | |||
5 | libextractor is free software; you can redistribute it and/or modify | ||
6 | it under the terms of the GNU General Public License as published | ||
7 | by the Free Software Foundation; either version 2, or (at your | ||
8 | option) any later version. | ||
9 | |||
10 | libextractor is distributed in the hope that it will be useful, but | ||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU General Public License | ||
16 | along with libextractor; see the file COPYING. If not, write to the | ||
17 | Free Software Foundation, Inc., 59 Temple Place - Suite 330, | ||
18 | Boston, MA 02111-1307, USA. | ||
19 | */ | ||
20 | |||
21 | #ifndef UNZIP_H_ | ||
22 | #define UNZIP_H_ | ||
23 | |||
24 | #include <zlib.h> | ||
25 | |||
26 | #define EXTRACTOR_UNZIP_OK (0) | ||
27 | #define EXTRACTOR_UNZIP_END_OF_LIST_OF_FILE (-100) | ||
28 | #define EXTRACTOR_UNZIP_ERRNO (Z_ERRNO) | ||
29 | #define EXTRACTOR_UNZIP_EOF (0) | ||
30 | #define EXTRACTOR_UNZIP_PARAMERROR (-102) | ||
31 | #define EXTRACTOR_UNZIP_BADZIPFILE (-103) | ||
32 | #define EXTRACTOR_UNZIP_INTERNALERROR (-104) | ||
33 | #define EXTRACTOR_UNZIP_CRCERROR (-105) | ||
34 | |||
35 | typedef voidp EXTRACTOR_unzip_file; | ||
36 | |||
37 | typedef struct EXTRACTOR_unzip_filefunc_def_s | ||
38 | { | ||
39 | voidpf ( *zopen_file) (voidpf opaque, const char* filename, int mode); | ||
40 | uLong ( *zread_file) (voidpf opaque, voidpf stream, void* buf, uLong size); | ||
41 | uLong ( *zwrite_file) (voidpf opaque, voidpf stream, const void* buf, uLong size); | ||
42 | long ( *ztell_file) (voidpf opaque, voidpf stream); | ||
43 | long ( *zseek_file) (voidpf opaque, voidpf stream, uLong offset, int origin); | ||
44 | int ( *zclose_file) (voidpf opaque, voidpf stream); | ||
45 | int ( *zerror_file) (voidpf opaque, voidpf stream); | ||
46 | voidpf opaque; | ||
47 | } EXTRACTOR_unzip_filefunc_def; | ||
48 | |||
49 | /* tm_unz contain date/time info */ | ||
50 | typedef struct EXTRACTOR_unzip_tm_unz_s | ||
51 | { | ||
52 | uInt tm_sec; /* seconds after the minute - [0,59] */ | ||
53 | uInt tm_min; /* minutes after the hour - [0,59] */ | ||
54 | uInt tm_hour; /* hours since midnight - [0,23] */ | ||
55 | uInt tm_mday; /* day of the month - [1,31] */ | ||
56 | uInt tm_mon; /* months since January - [0,11] */ | ||
57 | uInt tm_year; /* years - [1980..2044] */ | ||
58 | } EXTRACTOR_unzip_tm_unz; | ||
59 | |||
60 | /* unz_file_info contain information about a file in the zipfile */ | ||
61 | typedef struct EXTRACTOR_unzip_file_info_s | ||
62 | { | ||
63 | uLong version; /* version made by 2 bytes */ | ||
64 | uLong version_needed; /* version needed to extract 2 bytes */ | ||
65 | uLong flag; /* general purpose bit flag 2 bytes */ | ||
66 | uLong compression_method; /* compression method 2 bytes */ | ||
67 | uLong dosDate; /* last mod file date in Dos fmt 4 bytes */ | ||
68 | uLong crc; /* crc-32 4 bytes */ | ||
69 | uLong compressed_size; /* compressed size 4 bytes */ | ||
70 | uLong uncompressed_size; /* uncompressed size 4 bytes */ | ||
71 | uLong size_filename; /* filename length 2 bytes */ | ||
72 | uLong size_file_extra; /* extra field length 2 bytes */ | ||
73 | uLong size_file_comment; /* file comment length 2 bytes */ | ||
74 | |||
75 | uLong disk_num_start; /* disk number start 2 bytes */ | ||
76 | uLong internal_fa; /* internal file attributes 2 bytes */ | ||
77 | uLong external_fa; /* external file attributes 4 bytes */ | ||
78 | |||
79 | EXTRACTOR_unzip_tm_unz tmu_date; | ||
80 | } EXTRACTOR_unzip_file_info; | ||
81 | |||
82 | int EXTRACTOR_common_unzip_string_file_name_compare(const char* fileName1, | ||
83 | const char* fileName2, int iCaseSensitivity); | ||
84 | |||
85 | int EXTRACTOR_common_unzip_go_to_first_file(EXTRACTOR_unzip_file file); | ||
86 | |||
87 | EXTRACTOR_unzip_file EXTRACTOR_common_unzip_open2(const char *path, | ||
88 | EXTRACTOR_unzip_filefunc_def* pzlib_filefunc_def); | ||
89 | |||
90 | int EXTRACTOR_common_unzip_close_current_file(EXTRACTOR_unzip_file file); | ||
91 | |||
92 | int EXTRACTOR_common_unzip_close(EXTRACTOR_unzip_file file); | ||
93 | |||
94 | int EXTRACTOR_common_unzip_get_current_file_info(EXTRACTOR_unzip_file file, | ||
95 | EXTRACTOR_unzip_file_info *pfile_info, char *szFileName, uLong fileNameBufferSize, | ||
96 | void *extraField, uLong extraFieldBufferSize, char *szComment, | ||
97 | uLong commentBufferSize); | ||
98 | |||
99 | int EXTRACTOR_common_unzip_go_to_next_file(EXTRACTOR_unzip_file file); | ||
100 | |||
101 | int EXTRACTOR_common_unzip_local_file(EXTRACTOR_unzip_file file, const char *szFileName, | ||
102 | int iCaseSensitivity); | ||
103 | |||
104 | int EXTRACTOR_common_unzip_read_current_file(EXTRACTOR_unzip_file file, voidp buf, | ||
105 | unsigned len); | ||
106 | |||
107 | int EXTRACTOR_common_unzip_open_current_file3(EXTRACTOR_unzip_file file, int* method, | ||
108 | int* level, int raw); | ||
109 | |||
110 | voidpf EXTRACTOR_common_unzip_zlib_open_file_func(voidpf opaque, | ||
111 | const char* filename, int mode); | ||
112 | |||
113 | uLong EXTRACTOR_common_unzip_zlib_read_file_func(voidpf opaque, voidpf stream, | ||
114 | void* buf, uLong size); | ||
115 | |||
116 | long EXTRACTOR_common_unzip_zlib_tell_file_func(voidpf opaque, voidpf stream); | ||
117 | |||
118 | long EXTRACTOR_common_unzip_zlib_seek_file_func(voidpf opaque, voidpf stream, | ||
119 | uLong offset, int origin); | ||
120 | |||
121 | int EXTRACTOR_common_unzip_zlib_close_file_func(voidpf opaque, voidpf stream); | ||
122 | |||
123 | int EXTRACTOR_common_unzip_zlib_testerror_file_func(voidpf opaque, | ||
124 | voidpf stream); | ||
125 | |||
126 | #endif /* UNZIP_H_ */ | ||