1 /*
2  * HFS time functions
3  *
4  * Copyright (C) 2009-2018, 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( _LIBFDATETIME_INTERNAL_HFS_TIME_H )
23 #define _LIBFDATETIME_INTERNAL_HFS_TIME_H
24 
25 #include <common.h>
26 #include <types.h>
27 
28 #include "libfdatetime_extern.h"
29 #include "libfdatetime_libcerror.h"
30 #include "libfdatetime_types.h"
31 
32 #if defined( __cplusplus )
33 extern "C" {
34 #endif
35 
36 typedef struct libfdatetime_internal_hfs_time libfdatetime_internal_hfs_time_t;
37 
38 /* Contains a value representing the number of seconds since January 1, 1904
39  */
40 struct libfdatetime_internal_hfs_time
41 {
42 	/* The timestamp
43 	 */
44 	uint32_t timestamp;
45 };
46 
47 LIBFDATETIME_EXTERN \
48 int libfdatetime_hfs_time_initialize(
49      libfdatetime_hfs_time_t **hfs_time,
50      libcerror_error_t **error );
51 
52 LIBFDATETIME_EXTERN \
53 int libfdatetime_hfs_time_free(
54      libfdatetime_hfs_time_t **hfs_time,
55      libcerror_error_t **error );
56 
57 LIBFDATETIME_EXTERN \
58 int libfdatetime_hfs_time_copy_from_byte_stream(
59      libfdatetime_hfs_time_t *hfs_time,
60      const uint8_t *byte_stream,
61      size_t byte_stream_size,
62      int byte_order,
63      libcerror_error_t **error );
64 
65 LIBFDATETIME_EXTERN \
66 int libfdatetime_hfs_time_copy_from_32bit(
67      libfdatetime_hfs_time_t *hfs_time,
68      uint32_t value_32bit,
69      libcerror_error_t **error );
70 
71 LIBFDATETIME_EXTERN \
72 int libfdatetime_hfs_time_copy_to_32bit(
73      libfdatetime_hfs_time_t *hfs_time,
74      uint32_t *value_32bit,
75      libcerror_error_t **error );
76 
77 int libfdatetime_internal_hfs_time_copy_to_date_time_values(
78      libfdatetime_internal_hfs_time_t *internal_hfs_time,
79      libfdatetime_date_time_values_t *date_time_values,
80      libcerror_error_t **error );
81 
82 LIBFDATETIME_EXTERN \
83 int libfdatetime_hfs_time_get_string_size(
84      libfdatetime_hfs_time_t *hfs_time,
85      size_t *string_size,
86      uint32_t string_format_flags,
87      libcerror_error_t **error );
88 
89 int libfdatetime_internal_hfs_time_copy_to_utf8_string_in_hexadecimal(
90      libfdatetime_internal_hfs_time_t *internal_hfs_time,
91      uint8_t *utf8_string,
92      size_t utf8_string_size,
93      size_t *utf8_string_index,
94      libcerror_error_t **error );
95 
96 LIBFDATETIME_EXTERN \
97 int libfdatetime_hfs_time_copy_to_utf8_string(
98      libfdatetime_hfs_time_t *hfs_time,
99      uint8_t *utf8_string,
100      size_t utf8_string_size,
101      uint32_t string_format_flags,
102      libcerror_error_t **error );
103 
104 LIBFDATETIME_EXTERN \
105 int libfdatetime_hfs_time_copy_to_utf8_string_with_index(
106      libfdatetime_hfs_time_t *hfs_time,
107      uint8_t *utf8_string,
108      size_t utf8_string_size,
109      size_t *utf8_string_index,
110      uint32_t string_format_flags,
111      libcerror_error_t **error );
112 
113 int libfdatetime_internal_hfs_time_copy_to_utf16_string_in_hexadecimal(
114      libfdatetime_internal_hfs_time_t *internal_hfs_time,
115      uint16_t *utf16_string,
116      size_t utf16_string_size,
117      size_t *utf16_string_index,
118      libcerror_error_t **error );
119 
120 LIBFDATETIME_EXTERN \
121 int libfdatetime_hfs_time_copy_to_utf16_string(
122      libfdatetime_hfs_time_t *hfs_time,
123      uint16_t *utf16_string,
124      size_t utf16_string_size,
125      uint32_t string_format_flags,
126      libcerror_error_t **error );
127 
128 LIBFDATETIME_EXTERN \
129 int libfdatetime_hfs_time_copy_to_utf16_string_with_index(
130      libfdatetime_hfs_time_t *hfs_time,
131      uint16_t *utf16_string,
132      size_t utf16_string_size,
133      size_t *utf16_string_index,
134      uint32_t string_format_flags,
135      libcerror_error_t **error );
136 
137 int libfdatetime_internal_hfs_time_copy_to_utf32_string_in_hexadecimal(
138      libfdatetime_internal_hfs_time_t *internal_hfs_time,
139      uint32_t *utf32_string,
140      size_t utf32_string_size,
141      size_t *utf32_string_index,
142      libcerror_error_t **error );
143 
144 LIBFDATETIME_EXTERN \
145 int libfdatetime_hfs_time_copy_to_utf32_string(
146      libfdatetime_hfs_time_t *hfs_time,
147      uint32_t *utf32_string,
148      size_t utf32_string_size,
149      uint32_t string_format_flags,
150      libcerror_error_t **error );
151 
152 LIBFDATETIME_EXTERN \
153 int libfdatetime_hfs_time_copy_to_utf32_string_with_index(
154      libfdatetime_hfs_time_t *hfs_time,
155      uint32_t *utf32_string,
156      size_t utf32_string_size,
157      size_t *utf32_string_index,
158      uint32_t string_format_flags,
159      libcerror_error_t **error );
160 
161 #if defined( __cplusplus )
162 }
163 #endif
164 
165 #endif /* !defined( _LIBFDATETIME_INTERNAL_HFS_TIME_H ) */
166 
167