2
This file is part of libextractor.
3
(C) 2008 Christian Grothoff (and other contributing authors)
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.
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.
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.
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)
35
typedef voidp EXTRACTOR_unzip_file;
37
typedef struct EXTRACTOR_unzip_filefunc_def_s
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);
47
} EXTRACTOR_unzip_filefunc_def;
49
/* tm_unz contain date/time info */
50
typedef struct EXTRACTOR_unzip_tm_unz_s
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;
60
/* unz_file_info contain information about a file in the zipfile */
61
typedef struct EXTRACTOR_unzip_file_info_s
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 */
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 */
79
EXTRACTOR_unzip_tm_unz tmu_date;
80
} EXTRACTOR_unzip_file_info;
82
int EXTRACTOR_common_unzip_string_file_name_compare(const char* fileName1,
83
const char* fileName2, int iCaseSensitivity);
85
int EXTRACTOR_common_unzip_go_to_first_file(EXTRACTOR_unzip_file file);
87
EXTRACTOR_unzip_file EXTRACTOR_common_unzip_open2(const char *path,
88
EXTRACTOR_unzip_filefunc_def* pzlib_filefunc_def);
90
int EXTRACTOR_common_unzip_close_current_file(EXTRACTOR_unzip_file file);
92
int EXTRACTOR_common_unzip_close(EXTRACTOR_unzip_file file);
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);
99
int EXTRACTOR_common_unzip_go_to_next_file(EXTRACTOR_unzip_file file);
101
int EXTRACTOR_common_unzip_local_file(EXTRACTOR_unzip_file file, const char *szFileName,
102
int iCaseSensitivity);
104
int EXTRACTOR_common_unzip_read_current_file(EXTRACTOR_unzip_file file, voidp buf,
107
int EXTRACTOR_common_unzip_open_current_file3(EXTRACTOR_unzip_file file, int* method,
108
int* level, int raw);
110
voidpf EXTRACTOR_common_unzip_zlib_open_file_func(voidpf opaque,
111
const char* filename, int mode);
113
uLong EXTRACTOR_common_unzip_zlib_read_file_func(voidpf opaque, voidpf stream,
114
void* buf, uLong size);
116
long EXTRACTOR_common_unzip_zlib_tell_file_func(voidpf opaque, voidpf stream);
118
long EXTRACTOR_common_unzip_zlib_seek_file_func(voidpf opaque, voidpf stream,
119
uLong offset, int origin);
121
int EXTRACTOR_common_unzip_zlib_close_file_func(voidpf opaque, voidpf stream);
123
int EXTRACTOR_common_unzip_zlib_testerror_file_func(voidpf opaque,
126
#endif /* UNZIP_H_ */