1 /*
2  * Cache value functions
3  *
4  * Copyright (C) 2010-2017, Joachim Metz <joachim.metz@gmail.com>
5  *
6  * Refer to AUTHORS for acknowledgements.
7  *
8  * This software 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 software 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 software.  If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 #if !defined( _LIBFCACHE_INTERNAL_CACHE_VALUE_H )
23 #define _LIBFCACHE_INTERNAL_CACHE_VALUE_H
24 
25 #include <common.h>
26 #include <types.h>
27 
28 #include "libfcache_date_time.h"
29 #include "libfcache_extern.h"
30 #include "libfcache_libcerror.h"
31 #include "libfcache_types.h"
32 
33 #if defined( __cplusplus )
34 extern "C" {
35 #endif
36 
37 typedef struct libfcache_internal_cache_value libfcache_internal_cache_value_t;
38 
39 struct libfcache_internal_cache_value
40 {
41 	/* The file index
42 	 */
43 	int file_index;
44 
45 	/* The offset
46 	 */
47 	off64_t offset;
48 
49 	/* The time stamp
50 	 */
51 	time_t timestamp;
52 
53 	/* The value
54 	 */
55 	intptr_t *value;
56 
57 	/* The free value function
58 	 */
59 	int (*free_value)(
60 	       intptr_t **value,
61 	       libcerror_error_t **error );
62 
63 	/* The flags
64 	 */
65 	uint8_t flags;
66 };
67 
68 int libfcache_cache_value_initialize(
69      libfcache_cache_value_t **cache_value,
70      libcerror_error_t **error );
71 
72 int libfcache_cache_value_free(
73      libfcache_cache_value_t **cache_value,
74      libcerror_error_t **error );
75 
76 LIBFCACHE_EXTERN \
77 int libfcache_cache_value_clear(
78      libfcache_cache_value_t *cache_value,
79      libcerror_error_t **error );
80 
81 LIBFCACHE_EXTERN \
82 int libfcache_cache_value_get_identifier(
83      libfcache_cache_value_t *cache_value,
84      int *file_index,
85      off64_t *offset,
86      time_t *timestamp,
87      libcerror_error_t **error );
88 
89 LIBFCACHE_EXTERN \
90 int libfcache_cache_value_set_identifier(
91      libfcache_cache_value_t *cache_value,
92      int file_index,
93      off64_t offset,
94      time_t timestamp,
95      libcerror_error_t **error );
96 
97 LIBFCACHE_EXTERN \
98 int libfcache_cache_value_get_value(
99      libfcache_cache_value_t *cache_value,
100      intptr_t **value,
101      libcerror_error_t **error );
102 
103 LIBFCACHE_EXTERN \
104 int libfcache_cache_value_set_value(
105      libfcache_cache_value_t *cache_value,
106      intptr_t *value,
107      int (*free_value)(
108             intptr_t **value,
109             libcerror_error_t **error ),
110      uint8_t flags,
111      libcerror_error_t **error );
112 
113 #if defined( __cplusplus )
114 }
115 #endif
116 
117 #endif /* !defined( _LIBFCACHE_INTERNAL_CACHE_VALUE_H ) */
118 
119