1/*
2 * The internal definitions
3 *
4 * Copyright (c) 2006-2014, Joachim Metz <joachim.metz@gmail.com>
5 *
6 * Refer to AUTHORS for acknowledgements.
7 *
8 * This program is free software: you can redistribute it and/or modify
9 * it under the terms of the GNU Lesser General Public License as published by
10 * the Free Software Foundation, either version 3 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public License
19 * along with this program.  If not, see <https://www.gnu.org/licenses/>.
20 */
21
22#if !defined( _LIBEWF_INTERNAL_DEFINITIONS_H )
23#define _LIBEWF_INTERNAL_DEFINITIONS_H
24
25#include <common.h>
26#include <byte_stream.h>
27
28#include "libewf_libmfdata.h"
29
30/* Define HAVE_LOCAL_LIBEWF for local use of libewf
31 */
32#if !defined( HAVE_LOCAL_LIBEWF )
33#include <libewf/definitions.h>
34
35#else
36#define LIBEWF_VERSION						@VERSION@
37
38/* The version string
39 */
40#define LIBEWF_VERSION_STRING					"@VERSION@"
41
42/* The access flags definitions
43 * bit 1	set to 1 for read access
44 * bit 2	set to 1 for write access
45 * bit 3-4	not used
46 * bit 5        set to 1 to resume write
47 * bit 6-8	not used
48 */
49enum LIBEWF_ACCESS_FLAGS
50{
51	LIBEWF_ACCESS_FLAG_READ					= 0x01,
52	LIBEWF_ACCESS_FLAG_WRITE				= 0x02,
53
54	LIBEWF_ACCESS_FLAG_RESUME				= 0x10
55};
56
57/* The file access macros
58 */
59#define LIBEWF_OPEN_READ					( LIBEWF_ACCESS_FLAG_READ )
60#define LIBEWF_OPEN_READ_WRITE					( LIBEWF_ACCESS_FLAG_READ | LIBEWF_ACCESS_FLAG_WRITE )
61#define LIBEWF_OPEN_WRITE					( LIBEWF_ACCESS_FLAG_WRITE )
62#define LIBEWF_OPEN_WRITE_RESUME				( LIBEWF_ACCESS_FLAG_WRITE | LIBEWF_ACCESS_FLAG_RESUME )
63
64/* The file formats
65 */
66enum LIBEWF_FORMAT
67{
68	LIBEWF_FORMAT_UNKNOWN					= 0x00,
69	LIBEWF_FORMAT_ENCASE1					= 0x01,
70	LIBEWF_FORMAT_ENCASE2					= 0x02,
71	LIBEWF_FORMAT_ENCASE3					= 0x03,
72	LIBEWF_FORMAT_ENCASE4					= 0x04,
73	LIBEWF_FORMAT_ENCASE5					= 0x05,
74	LIBEWF_FORMAT_ENCASE6					= 0x06,
75	LIBEWF_FORMAT_ENCASE7					= 0x07,
76
77	LIBEWF_FORMAT_SMART					= 0x0e,
78	LIBEWF_FORMAT_FTK_IMAGER				= 0x0f,
79
80	LIBEWF_FORMAT_LOGICAL_ENCASE5				= 0x10,
81	LIBEWF_FORMAT_LOGICAL_ENCASE6				= 0x11,
82	LIBEWF_FORMAT_LOGICAL_ENCASE7				= 0x12,
83
84	LIBEWF_FORMAT_LINEN5					= 0x25,
85	LIBEWF_FORMAT_LINEN6					= 0x26,
86	LIBEWF_FORMAT_LINEN7					= 0x27,
87
88	/* The format as specified by Andrew Rosen
89	 */
90	LIBEWF_FORMAT_EWF					= 0x70,
91
92	/* Libewf eXtended EWF format
93	 */
94	LIBEWF_FORMAT_EWFX					= 0x71
95};
96
97/* TODO deprecated remove after a while */
98#define LIBEWF_FORMAT_LVF					LIBEWF_FORMAT_LOGICAL_ENCASE5
99#define LIBEWF_FORMAT_FTK					LIBEWF_FORMAT_FTK_IMAGER
100
101/* The default segment file size
102 */
103#define LIBEWF_DEFAULT_SEGMENT_FILE_SIZE			( 1500 * 1024 * 1024 )
104
105/* The compression methods definitions
106 */
107enum LIBEWF_COMPRESSION_METHODS
108{
109	LIBEWF_COMPRESSION_METHOD_NONE				= 0,
110	LIBEWF_COMPRESSION_METHOD_DEFLATE			= 1,
111	LIBEWF_COMPRESSION_METHOD_BZIP2				= 2,
112};
113
114/* The compression level definitions
115 */
116enum LIBEWF_COMPRESSION_LEVELS
117{
118	LIBEWF_COMPRESSION_DEFAULT                              = -1,
119	LIBEWF_COMPRESSION_NONE					= 0,
120	LIBEWF_COMPRESSION_FAST					= 1,
121	LIBEWF_COMPRESSION_BEST					= 2,
122};
123
124/* The compression flags
125 * bit 1	set to 1 for empty block compression
126 *              detects empty blocks and stored them compressed, the compression
127 *              is only done once
128 * bit 2-8	not used
129 */
130enum LIBEWF_COMPRESSION_FLAGS
131{
132	LIBEWF_COMPRESS_FLAG_USE_EMPTY_BLOCK_COMPRESSION	= (uint8_t) 0x01,
133};
134
135/* TODO deprecated remove after a while */
136#define LIBEWF_FLAG_COMPRESS_EMPTY_BLOCK			LIBEWF_COMPRESS_FLAG_USE_EMPTY_BLOCK_COMPRESSION
137
138/* The media type definitions
139 */
140enum LIBEWF_MEDIA_TYPES
141{
142	LIBEWF_MEDIA_TYPE_REMOVABLE				= 0x00,
143	LIBEWF_MEDIA_TYPE_FIXED					= 0x01,
144	LIBEWF_MEDIA_TYPE_OPTICAL				= 0x03,
145	LIBEWF_MEDIA_TYPE_SINGLE_FILES				= 0x0e,
146	LIBEWF_MEDIA_TYPE_MEMORY				= 0x10
147};
148
149/* The media flags definitions
150 */
151enum LIBEWF_MEDIA_FLAGS
152{
153	LIBEWF_MEDIA_FLAG_PHYSICAL				= 0x02,
154	LIBEWF_MEDIA_FLAG_FASTBLOC				= 0x04,
155	LIBEWF_MEDIA_FLAG_TABLEAU				= 0x08
156};
157
158#if defined( HAVE_V1_API )
159/* The volume type definitions
160 */
161enum LIBEWF_VOLUME_TYPES
162{
163	LIBEWF_VOLUME_TYPE_LOGICAL				= 0x00,
164	LIBEWF_VOLUME_TYPE_PHYSICAL				= 0x01
165};
166#endif
167
168/* The date representation formats
169 */
170enum LIBEWF_DATE_FORMATS
171{
172	LIBEWF_DATE_FORMAT_DAYMONTH				= 0x01,
173	LIBEWF_DATE_FORMAT_MONTHDAY				= 0x02,
174	LIBEWF_DATE_FORMAT_ISO8601				= 0x03,
175	LIBEWF_DATE_FORMAT_CTIME				= 0x04
176};
177
178/* The header value compression levels definitions
179 */
180#define LIBEWF_HEADER_VALUE_COMPRESSION_LEVEL_NONE		"n"
181#define LIBEWF_HEADER_VALUE_COMPRESSION_LEVEL_FAST		"f"
182#define LIBEWF_HEADER_VALUE_COMPRESSION_LEVEL_BEST		"b"
183
184/* TODO deprecated remove after a while */
185#define LIBEWF_COMPRESSION_LEVEL_NONE				"n"
186#define LIBEWF_COMPRESSION_LEVEL_FAST				"f"
187#define LIBEWF_COMPRESSION_LEVEL_BEST				"b"
188
189/* The segment file type definitions
190 */
191enum LIBEWF_SEGMENT_FILE_TYPES
192{
193	LIBEWF_SEGMENT_FILE_TYPE_DWF				= (int) 'd',
194	LIBEWF_SEGMENT_FILE_TYPE_EWF				= (int) 'E',
195	LIBEWF_SEGMENT_FILE_TYPE_LWF				= (int) 'L'
196};
197
198/* The (single) file entry types
199 */
200enum LIBEWF_FILE_ENTRY_TYPES
201{
202	LIBEWF_FILE_ENTRY_TYPE_DIRECTORY			= (uint8_t) 'd',
203	LIBEWF_FILE_ENTRY_TYPE_FILE				= (uint8_t) 'f'
204};
205
206#define LIBEWF_FILE_ENTRY_TYPE_FOLDER				LIBEWF_FILE_ENTRY_TYPE_DIRECTORY
207
208/* The (single) file entry flags
209 */
210enum LIBEWF_FILE_ENTRY_FLAGS
211{
212	LIBEWF_FILE_ENTRY_FLAG_ARCHIVE				= 0x00000008UL,
213
214	LIBEWF_FILE_ENTRY_FLAG_SPARSE_DATA			= 0x04000000UL,
215};
216
217/* The (single) file entry name separator
218 */
219#define LIBEWF_SEPARATOR					'\\'
220
221#endif /* !defined( HAVE_LOCAL_LIBEWF ) */
222
223/* The item flags definitions
224 */
225enum LIBEWF_ITEM_FLAGS
226{
227        /* The file entry tree node is not managed by the item
228	 */
229	LIBEWF_ITEM_FLAG_NON_MANAGED_FILE_ENTRY_TREE_NODE	= 0x00,
230
231        /* The file entry tree node is managed by the item
232	 */
233	LIBEWF_ITEM_FLAG_MANAGED_FILE_ENTRY_TREE_NODE		= 0x01
234};
235
236/* The segment table flags definitions
237 */
238enum LIBEWF_SEGMENT_TABLE_FLAGS
239{
240	/* The segment table is corrupted
241	 */
242	LIBEWF_SEGMENT_TABLE_FLAG_CORRUPTED			= 0x01
243};
244
245/* The segment file flags definitions
246 */
247enum LIBEWF_SEGMENT_FILE_FLAGS
248{
249	/* The segment file is corrupted
250	 */
251	LIBEWF_SEGMENT_FILE_FLAG_CORRUPTED			= 0x01,
252
253	/* The segment file is open for writing
254	 */
255	LIBEWF_SEGMENT_FILE_FLAG_WRITE_OPEN			= 0x02
256};
257
258#if defined( HAVE_DEBUG_OUTPUT )
259#define LIBEWF_ITEM_FLAGS_DEFAULT				LIBEWF_ITEM_FLAG_MANAGED_FILE_ENTRY_TREE_NODE
260#else
261#define LIBEWF_ITEM_FLAGS_DEFAULT				LIBEWF_ITEM_FLAG_NON_MANAGED_FILE_ENTRY_TREE_NODE
262#endif
263
264#define LIBEWF_ENDIAN_BIG					_BYTE_STREAM_ENDIAN_BIG
265#define LIBEWF_ENDIAN_LITTLE					_BYTE_STREAM_ENDIAN_LITTLE
266
267/* The chunk data range is sparse
268 */
269#define LIBEWF_RANGE_FLAG_IS_SPARSE				LIBMFDATA_RANGE_FLAG_IS_SPARSE
270
271/* The chunk data range is compressed
272 */
273#define LIBEWF_RANGE_FLAG_IS_COMPRESSED				LIBMFDATA_RANGE_FLAG_IS_COMPRESSED
274
275/* The chunk data range refers to a delta chunk
276 */
277#define LIBEWF_RANGE_FLAG_IS_DELTA				LIBMFDATA_RANGE_FLAG_USER_DEFINED_4
278
279/* The chunk data range is tainted (possibly corrupted)
280 */
281#define LIBEWF_RANGE_FLAG_IS_TAINTED				LIBMFDATA_RANGE_FLAG_USER_DEFINED_5
282
283/* The chunk data range is corrupted
284 */
285#define LIBEWF_RANGE_FLAG_IS_CORRUPTED				LIBMFDATA_RANGE_FLAG_USER_DEFINED_6
286
287#if defined( __BORLANDC__ ) && ( __BORLANDC__ < 0x0560 )
288#define LIBEWF_2_TIB						0x20000000000UL
289#else
290#define LIBEWF_2_TIB						0x20000000000ULL
291#endif
292
293#endif /* !defined( _LIBEWF_INTERNAL_DEFINITIONS_H ) */
294
295