libewf_segment_table.h 5.5 KB
Newer Older
1
/*
2
 * Segment table functions
3
 *
4
 * Copyright (C) 2006-2017, Joachim Metz <joachim.metz@gmail.com>
5 6 7
 *
 * Refer to AUTHORS for acknowledgements.
 *
8 9 10 11
 * 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.
12
 *
13 14 15 16
 * 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.
17
 *
18 19
 * 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/>.
20 21 22 23 24 25
 */

#if !defined( _LIBEWF_SEGMENT_TABLE_H )
#define _LIBEWF_SEGMENT_TABLE_H

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

28
#include "libewf_io_handle.h"
29
#include "libewf_libbfio.h"
30 31 32 33
#include "libewf_libcerror.h"
#include "libewf_libfcache.h"
#include "libewf_libfdata.h"
#include "libewf_segment_file.h"
34 35 36 37 38 39 40 41 42 43 44

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

typedef struct libewf_segment_table libewf_segment_table_t;

struct libewf_segment_table
{
	/* The basename
	 */
45
	system_character_t *basename;
46 47 48 49

	/* The basename size
	 */
	size_t basename_size;
50

51
	/* The maximum segment size
52
	 */
53
	size64_t maximum_segment_size;
54

55
	/* The segment files list
56
	 */
57 58 59 60 61 62 63 64 65
	libfdata_list_t *segment_files_list;

	/* The number of segments
	 */
	uint32_t number_of_segments;

	/* The segment files cache
	 */
	libfcache_cache_t *segment_files_cache;
66 67 68 69

	/* Flags
	 */
	uint8_t flags;
70 71
};

72 73
int libewf_segment_table_initialize(
     libewf_segment_table_t **segment_table,
74
     libewf_io_handle_t *io_handle,
75
     size64_t maximum_segment_size,
76
     libcerror_error_t **error );
77

78 79
int libewf_segment_table_free(
     libewf_segment_table_t **segment_table,
80
     libcerror_error_t **error );
81

82 83 84
int libewf_segment_table_clone(
     libewf_segment_table_t **destination_segment_table,
     libewf_segment_table_t *source_segment_table,
85
     libcerror_error_t **error );
86

87 88 89 90
int libewf_segment_table_empty(
     libewf_segment_table_t *segment_table,
     libcerror_error_t **error );

91 92 93
int libewf_segment_table_get_basename_size(
     libewf_segment_table_t *segment_table,
     size_t *basename_size,
94
     libcerror_error_t **error );
95 96 97

int libewf_segment_table_get_basename(
     libewf_segment_table_t *segment_table,
98 99
     char *basename,
     size_t basename_size,
100
     libcerror_error_t **error );
101 102 103

int libewf_segment_table_set_basename(
     libewf_segment_table_t *segment_table,
104
     const char *basename,
105
     size_t basename_length,
106
     libcerror_error_t **error );
107

108
#if defined( HAVE_WIDE_CHARACTER_TYPE )
109

110
int libewf_segment_table_get_basename_size_wide(
111
     libewf_segment_table_t *segment_table,
112
     size_t *basename_size,
113
     libcerror_error_t **error );
114 115

int libewf_segment_table_get_basename_wide(
116
     libewf_segment_table_t *segment_table,
117 118
     wchar_t *basename,
     size_t basename_size,
119
     libcerror_error_t **error );
120

121 122 123
int libewf_segment_table_set_basename_wide(
     libewf_segment_table_t *segment_table,
     const wchar_t *basename,
124
     size_t basename_length,
125
     libcerror_error_t **error );
126 127

#endif /* defined( HAVE_WIDE_CHARACTER_TYPE ) */
128

129
int libewf_segment_table_set_maximum_segment_size(
130
     libewf_segment_table_t *segment_table,
131
     size64_t maximum_segment_size,
132
     libcerror_error_t **error );
133

134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194
int libewf_segment_table_get_number_of_segments(
     libewf_segment_table_t *segment_table,
     uint32_t *number_of_segments,
     libcerror_error_t **error );

int libewf_segment_table_get_segment_by_index(
     libewf_segment_table_t *segment_table,
     uint32_t segment_number,
     int *file_io_pool_entry,
     size64_t *segment_file_size,
     libcerror_error_t **error );

int libewf_segment_table_get_segment_at_offset(
     libewf_segment_table_t *segment_table,
     off64_t offset,
     int *file_io_pool_entry,
     size64_t *segment_file_size,
     libcerror_error_t **error );

int libewf_segment_table_get_segment_storage_media_size_by_index(
     libewf_segment_table_t *segment_table,
     uint32_t segment_number,
     size64_t *storage_media_size,
     libcerror_error_t **error );

int libewf_segment_table_set_segment_storage_media_size_by_index(
     libewf_segment_table_t *segment_table,
     uint32_t segment_number,
     size64_t storage_media_size,
     libcerror_error_t **error );

int libewf_segment_table_get_segment_file_by_index(
     libewf_segment_table_t *segment_table,
     uint32_t segment_number,
     libbfio_pool_t *file_io_pool,
     libewf_segment_file_t **segment_file,
     libcerror_error_t **error );

int libewf_segment_table_get_segment_file_at_offset(
     libewf_segment_table_t *segment_table,
     off64_t offset,
     libbfio_pool_t *file_io_pool,
     uint32_t *segment_number,
     off64_t *segment_file_data_offset,
     libewf_segment_file_t **segment_file,
     libcerror_error_t **error );

int libewf_segment_table_set_segment_file_by_index(
     libewf_segment_table_t *segment_table,
     libbfio_pool_t *file_io_pool,
     uint32_t segment_number,
     libewf_segment_file_t *segment_file,
     libcerror_error_t **error );

int libewf_segment_table_append_segment_by_segment_file(
     libewf_segment_table_t *segment_table,
     libewf_segment_file_t *segment_file,
     int file_io_pool_entry,
     size64_t segment_file_size,
     libcerror_error_t **error );

195 196 197 198
#if defined( __cplusplus )
}
#endif

199
#endif /* !defined( _LIBEWF_SEGMENT_TABLE_H ) */
200