1 /* 2 * Notes Storage Facility (NSF) timedate 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_NSF_TIMEDATE_H ) 23 #define _LIBFDATETIME_INTERNAL_NSF_TIMEDATE_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_nsf_timedate libfdatetime_internal_nsf_timedate_t; 37 38 /* Contains a 64-bit value which consists of: 39 * The lower 32-bit value represents the number of 100th seconds 40 * The upper 32-bit value which consists of: 41 * a 24-bit value which contains the number of Julian day 42 * a 4-bit value which contains the UTC timezone difference in hours 43 * a 2-bit value which contains the UTC timezone difference in 15 minutes periods 44 * a 1-bit value to indicate if the timezone difference is negative (0) or positive (1) 45 * a 1-bit value to indicate if the day light savings are active 46 */ 47 struct libfdatetime_internal_nsf_timedate 48 { 49 /* The lower nsf timedate part 50 */ 51 uint32_t lower; 52 53 /* The upper nsf timedate part 54 */ 55 uint32_t upper; 56 }; 57 58 LIBFDATETIME_EXTERN \ 59 int libfdatetime_nsf_timedate_initialize( 60 libfdatetime_nsf_timedate_t **nsf_timedate, 61 libcerror_error_t **error ); 62 63 LIBFDATETIME_EXTERN \ 64 int libfdatetime_nsf_timedate_free( 65 libfdatetime_nsf_timedate_t **nsf_timedate, 66 libcerror_error_t **error ); 67 68 LIBFDATETIME_EXTERN \ 69 int libfdatetime_nsf_timedate_copy_from_byte_stream( 70 libfdatetime_nsf_timedate_t *nsf_timedate, 71 const uint8_t *byte_stream, 72 size_t byte_stream_size, 73 int byte_order, 74 libcerror_error_t **error ); 75 76 LIBFDATETIME_EXTERN \ 77 int libfdatetime_nsf_timedate_copy_from_64bit( 78 libfdatetime_nsf_timedate_t *nsf_timedate, 79 uint64_t value_64bit, 80 libcerror_error_t **error ); 81 82 LIBFDATETIME_EXTERN \ 83 int libfdatetime_nsf_timedate_copy_to_64bit( 84 libfdatetime_nsf_timedate_t *nsf_timedate, 85 uint64_t *value_64bit, 86 libcerror_error_t **error ); 87 88 int libfdatetime_internal_nsf_timedate_copy_to_date_time_values( 89 libfdatetime_internal_nsf_timedate_t *internal_nsf_timedate, 90 libfdatetime_date_time_values_t *date_time_values, 91 libcerror_error_t **error ); 92 93 LIBFDATETIME_EXTERN \ 94 int libfdatetime_nsf_timedate_get_string_size( 95 libfdatetime_nsf_timedate_t *nsf_timedate, 96 size_t *string_size, 97 uint32_t string_format_flags, 98 libcerror_error_t **error ); 99 100 int libfdatetime_internal_nsf_timedate_copy_to_utf8_string_in_hexadecimal( 101 libfdatetime_internal_nsf_timedate_t *internal_nsf_timedate, 102 uint8_t *utf8_string, 103 size_t utf8_string_size, 104 size_t *utf8_string_index, 105 libcerror_error_t **error ); 106 107 LIBFDATETIME_EXTERN \ 108 int libfdatetime_nsf_timedate_copy_to_utf8_string( 109 libfdatetime_nsf_timedate_t *nsf_timedate, 110 uint8_t *utf8_string, 111 size_t utf8_string_size, 112 uint32_t string_format_flags, 113 libcerror_error_t **error ); 114 115 LIBFDATETIME_EXTERN \ 116 int libfdatetime_nsf_timedate_copy_to_utf8_string_with_index( 117 libfdatetime_nsf_timedate_t *nsf_timedate, 118 uint8_t *utf8_string, 119 size_t utf8_string_size, 120 size_t *utf8_string_index, 121 uint32_t string_format_flags, 122 libcerror_error_t **error ); 123 124 int libfdatetime_internal_nsf_timedate_copy_to_utf16_string_in_hexadecimal( 125 libfdatetime_internal_nsf_timedate_t *internal_nsf_timedate, 126 uint16_t *utf16_string, 127 size_t utf16_string_size, 128 size_t *utf16_string_index, 129 libcerror_error_t **error ); 130 131 LIBFDATETIME_EXTERN \ 132 int libfdatetime_nsf_timedate_copy_to_utf16_string( 133 libfdatetime_nsf_timedate_t *nsf_timedate, 134 uint16_t *utf16_string, 135 size_t utf16_string_size, 136 uint32_t string_format_flags, 137 libcerror_error_t **error ); 138 139 LIBFDATETIME_EXTERN \ 140 int libfdatetime_nsf_timedate_copy_to_utf16_string_with_index( 141 libfdatetime_nsf_timedate_t *nsf_timedate, 142 uint16_t *utf16_string, 143 size_t utf16_string_size, 144 size_t *utf16_string_index, 145 uint32_t string_format_flags, 146 libcerror_error_t **error ); 147 148 int libfdatetime_internal_nsf_timedate_copy_to_utf32_string_in_hexadecimal( 149 libfdatetime_internal_nsf_timedate_t *internal_nsf_timedate, 150 uint32_t *utf32_string, 151 size_t utf32_string_size, 152 size_t *utf32_string_index, 153 libcerror_error_t **error ); 154 155 LIBFDATETIME_EXTERN \ 156 int libfdatetime_nsf_timedate_copy_to_utf32_string( 157 libfdatetime_nsf_timedate_t *nsf_timedate, 158 uint32_t *utf32_string, 159 size_t utf32_string_size, 160 uint32_t string_format_flags, 161 libcerror_error_t **error ); 162 163 LIBFDATETIME_EXTERN \ 164 int libfdatetime_nsf_timedate_copy_to_utf32_string_with_index( 165 libfdatetime_nsf_timedate_t *nsf_timedate, 166 uint32_t *utf32_string, 167 size_t utf32_string_size, 168 size_t *utf32_string_index, 169 uint32_t string_format_flags, 170 libcerror_error_t **error ); 171 172 #if defined( __cplusplus ) 173 } 174 #endif 175 176 #endif /* !defined( _LIBFDATETIME_INTERNAL_NSF_TIMEDATE_H ) */ 177 178