Debian Codegraph @

libfdata/libfdata_range_list.h

raw symbols SCIP
1 /*
2 * The range list functions
3 *
4 * Copyright (C) 2010-2024, Joachim Metz <[email protected]>
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( _LIBFDATA_INTERNAL_RANGE_LIST_H )
23 #define _LIBFDATA_INTERNAL_RANGE_LIST_H
24
25 #include <common.h>
26 #include <types.h>
27
28 #include "libfdata_extern.h"
29 #include "libfdata_libcdata.h"
30 #include "libfdata_libcerror.h"
31 #include "libfdata_types.h"
32
33 #if defined( __cplusplus )
34 extern "C" {
35 #endif
36
37 typedef struct libfdata_internal_range_list libfdata_internal_range_list_t;
38
39 struct libfdata_internal_range_list
40 {
41 /* The (list) elements range list
42 */
43 libcdata_range_list_t *elements_range_list;
44
45 /* The flags
46 */
47 uint8_t flags;
48
49 /* The data handle
50 */
51 intptr_t *data_handle;
52
53 /* The free data handle function
54 */
55 int (*free_data_handle)(
56 intptr_t **data_handle,
57 libcerror_error_t **error );
58
59 /* The clone (duplicate) data handle function
60 */
61 int (*clone_data_handle)(
62 intptr_t **destination_data_handle,
63 intptr_t *source_data_handle,
64 libcerror_error_t **error );
65
66 /* The read element data function
67 */
68 int (*read_element_data)(
69 intptr_t *data_handle,
70 intptr_t *file_io_handle,
71 libfdata_list_element_t *list_element,
72 libfdata_cache_t *cache,
73 int element_file_index,
74 off64_t element_offset,
75 size64_t element_size,
76 uint32_t element_flags,
77 uint8_t read_flags,
78 libcerror_error_t **error );
79
80 /* The write element data function
81 */
82 int (*write_element_data)(
83 intptr_t *data_handle,
84 intptr_t *file_io_handle,
85 libfdata_list_element_t *list_element,
86 libfdata_cache_t *cache,
87 int element_file_index,
88 off64_t element_offset,
89 size64_t element_size,
90 uint32_t element_flags,
91 uint8_t write_flags,
92 libcerror_error_t **error );
93 };
94
95 LIBFDATA_EXTERN \
96 int libfdata_range_list_initialize(
97 libfdata_range_list_t **range_list,
98 intptr_t *data_handle,
99 int (*free_data_handle)(
100 intptr_t **data_handle,
101 libcerror_error_t **error ),
102 int (*clone_data_handle)(
103 intptr_t **destination_data_handle,
104 intptr_t *source_data_handle,
105 libcerror_error_t **error ),
106 int (*read_element_data)(
107 intptr_t *data_handle,
108 intptr_t *file_io_handle,
109 libfdata_list_element_t *list_element,
110 libfdata_cache_t *cache,
111 int element_file_index,
112 off64_t element_offset,
113 size64_t element_size,
114 uint32_t element_flags,
115 uint8_t read_flags,
116 libcerror_error_t **error ),
117 int (*write_element_data)(
118 intptr_t *data_handle,
119 intptr_t *file_io_handle,
120 libfdata_list_element_t *list_element,
121 libfdata_cache_t *cache,
122 int element_file_index,
123 off64_t element_offset,
124 size64_t element_size,
125 uint32_t element_flags,
126 uint8_t write_flags,
127 libcerror_error_t **error ),
128 uint8_t flags,
129 libcerror_error_t **error );
130
131 LIBFDATA_EXTERN \
132 int libfdata_range_list_free(
133 libfdata_range_list_t **range_list,
134 libcerror_error_t **error );
135
136 LIBFDATA_EXTERN \
137 int libfdata_range_list_clone(
138 libfdata_range_list_t **destination_range_list,
139 libfdata_range_list_t *source_range_list,
140 libcerror_error_t **error );
141
142 /* List elements functions
143 */
144 LIBFDATA_EXTERN \
145 int libfdata_range_list_empty(
146 libfdata_range_list_t *range_list,
147 libcerror_error_t **error );
148
149 /* Mapped range functions
150 */
151
152 LIBFDATA_EXTERN \
153 int libfdata_range_list_get_list_element_at_offset(
154 libfdata_range_list_t *range_list,
155 off64_t offset,
156 off64_t *element_data_offset,
157 libfdata_list_element_t **element,
158 libcerror_error_t **error );
159
160 LIBFDATA_EXTERN \
161 int libfdata_range_list_get_element_at_offset(
162 libfdata_range_list_t *range_list,
163 off64_t offset,
164 off64_t *element_data_offset,
165 int *element_file_index,
166 off64_t *element_offset,
167 size64_t *element_size,
168 uint32_t *element_flags,
169 libcerror_error_t **error );
170
171 LIBFDATA_EXTERN \
172 int libfdata_range_list_insert_element(
173 libfdata_range_list_t *range_list,
174 off64_t offset,
175 size64_t size,
176 int element_file_index,
177 off64_t element_offset,
178 size64_t element_size,
179 uint32_t element_flags,
180 libcerror_error_t **error );
181
182 /* List element value functions
183 */
184
185 LIBFDATA_EXTERN \
186 int libfdata_range_list_get_element_value_at_offset(
187 libfdata_range_list_t *range_list,
188 intptr_t *file_io_handle,
189 libfdata_cache_t *cache,
190 off64_t offset,
191 off64_t *element_data_offset,
192 intptr_t **element_value,
193 uint8_t read_flags,
194 libcerror_error_t **error );
195
196 LIBFDATA_EXTERN \
197 int libfdata_range_list_set_element_value_at_offset(
198 libfdata_range_list_t *range_list,
199 intptr_t *file_io_handle,
200 libfdata_cache_t *cache,
201 off64_t offset,
202 intptr_t *element_value,
203 int (*free_element_value)(
204 intptr_t **element_value,
205 libcerror_error_t **error ),
206 uint8_t write_flags,
207 libcerror_error_t **error );
208
209 #if defined( __cplusplus )
210 }
211 #endif
212
213 #endif /* !defined( _LIBFDATA_INTERNAL_RANGE_LIST_H ) */
214