File: storage_media_buffer.h

package info (click to toggle)
libewf 20140804-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 19,284 kB
  • sloc: ansic: 313,293; sh: 6,855; cpp: 3,819; makefile: 1,926; yacc: 1,094; python: 467; lex: 391; sed: 16
file content (125 lines) | stat: -rw-r--r-- 2,767 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
/*
 * Storage media buffer
 *
 * Copyright (c) 2006-2014, Joachim Metz <joachim.metz@gmail.com>
 *
 * Refer to AUTHORS for acknowledgements.
 *
 * This software is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This software is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this software.  If not, see <http://www.gnu.org/licenses/>.
 */

#if !defined( _STORAGE_MEDIA_BUFFER_H )
#define _STORAGE_MEDIA_BUFFER_H

#include <common.h>
#include <types.h>

#include "ewftools_libcerror.h"

#if defined( __cplusplus )
extern "C" {
#endif

enum STORAGE_MEDIA_BUFFER_MODES
{
	STORAGE_MEDIA_BUFFER_MODE_BUFFERED	= 0,
	STORAGE_MEDIA_BUFFER_MODE_CHUNK_DATA	= 1
};

typedef struct storage_media_buffer storage_media_buffer_t;

struct storage_media_buffer
{
	/* The mode
	 */
	uint8_t mode;

	/* The raw buffer
	 */
	uint8_t *raw_buffer;

	/* The raw buffer size
	 */
	size_t raw_buffer_size;

	/* The size of the data in the raw buffer
	 */
	size_t raw_buffer_data_size;

        /* Value to indicate if the compression buffer
	 * contains uncompressed data
	 */
        int8_t data_in_compression_buffer;

	/* Value to indicate if the data is compressed
	 */
	int8_t is_compressed;

	/* The compression buffer
	 */
	uint8_t *compression_buffer;

	/* The compression buffer size
	 */
	size_t compression_buffer_size;

	/* The size of the data in the compression buffer
	 */
	size_t compression_buffer_data_size;

	/* The process count after read or write prepare
	 */
	size_t process_count;

	/* The checksum buffer
	 */
	uint8_t *checksum_buffer;

	/* Value to indicate if the checksum should be processed
	 * read or written
	 */
	int8_t process_checksum;

	/* The checksum of the data within the buffer
	 */
	uint32_t checksum;
};

int storage_media_buffer_initialize(
     storage_media_buffer_t **buffer,
     uint8_t mode,
     size_t size,
     libcerror_error_t **error );

int storage_media_buffer_free(
     storage_media_buffer_t **buffer,
     libcerror_error_t **error );

int storage_media_buffer_resize(
     storage_media_buffer_t *buffer,
     size_t size,
     libcerror_error_t **error );

int storage_media_buffer_get_data(
     storage_media_buffer_t *buffer,
     uint8_t **data,
     size_t *data_size,
     libcerror_error_t **error );

#if defined( __cplusplus )
}
#endif

#endif