Debian Codegraph @

libfcache/libfcache_cache.h

raw symbols SCIP
1 /*
2 * The cache 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( _LIBFCACHE_CACHE_H )
23 #define _LIBFCACHE_CACHE_H
24
25 #include <common.h>
26 #include <types.h>
27
28 #include "libfcache_cache_value.h"
29 #include "libfcache_extern.h"
30 #include "libfcache_libcdata.h"
31 #include "libfcache_libcerror.h"
32 #include "libfcache_types.h"
33
34 #if defined( __cplusplus )
35 extern "C" {
36 #endif
37
38 typedef struct libfcache_internal_cache libfcache_internal_cache_t;
39
40 struct libfcache_internal_cache
41 {
42 /* The cache entries array
43 */
44 libcdata_array_t *entries_array;
45
46 /* The cache entries list
47 */
48 libcdata_list_t *entries_list;
49
50 /* The number of cache values
51 */
52 int number_of_cache_values;
53 };
54
55 LIBFCACHE_EXTERN \
56 int libfcache_cache_initialize(
57 libfcache_cache_t **cache,
58 int maximum_cache_entries,
59 libcerror_error_t **error );
60
61 LIBFCACHE_EXTERN \
62 int libfcache_cache_free(
63 libfcache_cache_t **cache,
64 libcerror_error_t **error );
65
66 LIBFCACHE_EXTERN \
67 int libfcache_cache_empty(
68 libfcache_cache_t *cache,
69 libcerror_error_t **error );
70
71 LIBFCACHE_EXTERN \
72 int libfcache_cache_clone(
73 libfcache_cache_t **destination_cache,
74 libfcache_cache_t *source_cache,
75 libcerror_error_t **error );
76
77 LIBFCACHE_EXTERN \
78 int libfcache_cache_resize(
79 libfcache_cache_t *cache,
80 int maximum_cache_entries,
81 libcerror_error_t **error );
82
83 LIBFCACHE_EXTERN \
84 int libfcache_cache_get_number_of_entries(
85 libfcache_cache_t *cache,
86 int *number_of_entries,
87 libcerror_error_t **error );
88
89 LIBFCACHE_EXTERN \
90 int libfcache_cache_get_number_of_cache_values(
91 libfcache_cache_t *cache,
92 int *number_of_values,
93 libcerror_error_t **error );
94
95 LIBFCACHE_EXTERN \
96 int libfcache_cache_clear_value_by_index(
97 libfcache_cache_t *cache,
98 int cache_entry_index,
99 libcerror_error_t **error );
100
101 LIBFCACHE_EXTERN \
102 int libfcache_cache_get_value_by_identifier(
103 libfcache_cache_t *cache,
104 int file_index,
105 off64_t offset,
106 int64_t timestamp,
107 libfcache_cache_value_t **cache_value,
108 libcerror_error_t **error );
109
110 LIBFCACHE_EXTERN \
111 int libfcache_cache_get_value_by_index(
112 libfcache_cache_t *cache,
113 int cache_entry_index,
114 libfcache_cache_value_t **cache_value,
115 libcerror_error_t **error );
116
117 LIBFCACHE_EXTERN \
118 int libfcache_cache_set_value_by_identifier(
119 libfcache_cache_t *cache,
120 int file_index,
121 off64_t offset,
122 int64_t timestamp,
123 intptr_t *value,
124 int (*value_free_function)(
125 intptr_t **value,
126 libcerror_error_t **error ),
127 uint8_t flags,
128 libcerror_error_t **error );
129
130 LIBFCACHE_EXTERN \
131 int libfcache_cache_set_value_by_index(
132 libfcache_cache_t *cache,
133 int cache_entry_index,
134 int file_index,
135 off64_t offset,
136 int64_t timestamp,
137 intptr_t *value,
138 int (*value_free_function)(
139 intptr_t **value,
140 libcerror_error_t **error ),
141 uint8_t flags,
142 libcerror_error_t **error );
143
144 #if defined( __cplusplus )
145 }
146 #endif
147
148 #endif /* !defined( _LIBFCACHE_CACHE_H ) */
149