1 /* 2 * The internal definitions 3 * 4 * Copyright (C) 2008-2020, Joachim Metz <joachim.metz@gmail.com> 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( LIBCERROR_INTERNAL_DEFINITIONS_H ) 23 #define LIBCERROR_INTERNAL_DEFINITIONS_H 24 25 #include <common.h> 26 #include <types.h> 27 28 /* Define HAVE_LOCAL_LIBCERROR for local use of libcerror 29 */ 30 #if !defined( HAVE_LOCAL_LIBCERROR ) 31 #include <libcerror/definitions.h> 32 33 /* The definitions in <libcerror/definitions.h> are copied here 34 * for local use of libcerror 35 */ 36 #else 37 38 #define LIBCERROR_VERSION 20201121 39 40 /* The libcerror version string 41 */ 42 #define LIBCERROR_VERSION_STRING "20201121" 43 44 /* The error domains 45 */ 46 enum LIBCERROR_ERROR_DOMAINS 47 { 48 LIBCERROR_ERROR_DOMAIN_ARGUMENTS = (int) 'a', 49 LIBCERROR_ERROR_DOMAIN_CONVERSION = (int) 'c', 50 LIBCERROR_ERROR_DOMAIN_COMPRESSION = (int) 'C', 51 LIBCERROR_ERROR_DOMAIN_ENCRYPTION = (int) 'E', 52 LIBCERROR_ERROR_DOMAIN_IO = (int) 'I', 53 LIBCERROR_ERROR_DOMAIN_INPUT = (int) 'i', 54 LIBCERROR_ERROR_DOMAIN_MEMORY = (int) 'm', 55 LIBCERROR_ERROR_DOMAIN_OUTPUT = (int) 'o', 56 LIBCERROR_ERROR_DOMAIN_RUNTIME = (int) 'r', 57 }; 58 59 /* The argument error codes 60 * to signify errors regarding arguments passed to a function 61 */ 62 enum LIBCERROR_ARGUMENT_ERROR 63 { 64 LIBCERROR_ARGUMENT_ERROR_GENERIC = 0, 65 66 /* The argument contains an invalid value 67 */ 68 LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE = 1, 69 70 /* The argument contains a value less than zero 71 */ 72 LIBCERROR_ARGUMENT_ERROR_VALUE_LESS_THAN_ZERO = 2, 73 74 /* The argument contains a value zero or less 75 */ 76 LIBCERROR_ARGUMENT_ERROR_VALUE_ZERO_OR_LESS = 3, 77 78 /* The argument contains a value that exceeds the maximum 79 * for the specific type 80 */ 81 LIBCERROR_ARGUMENT_ERROR_VALUE_EXCEEDS_MAXIMUM = 4, 82 83 /* The argument contains a value that is too small 84 */ 85 LIBCERROR_ARGUMENT_ERROR_VALUE_TOO_SMALL = 5, 86 87 /* The argument contains a value that is too large 88 */ 89 LIBCERROR_ARGUMENT_ERROR_VALUE_TOO_LARGE = 6, 90 91 /* The argument contains a value that is out of bound 92 */ 93 LIBCERROR_ARGUMENT_ERROR_VALUE_OUT_OF_BOUNDS = 7, 94 95 /* The argument contains a value that is not supported 96 */ 97 LIBCERROR_ARGUMENT_ERROR_UNSUPPORTED_VALUE = 8, 98 99 /* The argument contains a value that conficts with another argument 100 */ 101 LIBCERROR_ARGUMENT_ERROR_CONFLICTING_VALUE = 9 102 }; 103 104 /* The conversion error codes 105 * to signify errors regarding conversions 106 */ 107 enum LIBCERROR_CONVERSION_ERROR 108 { 109 LIBCERROR_CONVERSION_ERROR_GENERIC = 0, 110 111 /* The conversion failed on the input 112 */ 113 LIBCERROR_CONVERSION_ERROR_INPUT_FAILED = 1, 114 115 /* The conversion failed on the output 116 */ 117 LIBCERROR_CONVERSION_ERROR_OUTPUT_FAILED = 2 118 }; 119 120 /* The compression error codes 121 * to signify errors regarding compression 122 */ 123 enum LIBCERROR_COMPRESSION_ERROR 124 { 125 LIBCERROR_COMPRESSION_ERROR_GENERIC = 0, 126 127 /* The compression failed 128 */ 129 LIBCERROR_COMPRESSION_ERROR_COMPRESS_FAILED = 1, 130 131 /* The decompression failed 132 */ 133 LIBCERROR_COMPRESSION_ERROR_DECOMPRESS_FAILED = 2 134 }; 135 136 /* The encryption error codes 137 * to signify errors regarding encryption 138 */ 139 enum LIBCERROR_ENCRYPTION_ERROR 140 { 141 LIBCERROR_ENCRYPTION_ERROR_GENERIC = 0, 142 143 /* The encryption failed 144 */ 145 LIBCERROR_ENCRYPTION_ERROR_ENCRYPT_FAILED = 1, 146 147 /* The decryption failed 148 */ 149 LIBCERROR_ENCRYPTION_ERROR_DECRYPT_FAILED = 2 150 }; 151 152 /* The input/output error codes 153 * to signify errors regarding input/output 154 */ 155 enum LIBCERROR_IO_ERROR 156 { 157 LIBCERROR_IO_ERROR_GENERIC = 0, 158 159 /* The open failed 160 */ 161 LIBCERROR_IO_ERROR_OPEN_FAILED = 1, 162 163 /* The close failed 164 */ 165 LIBCERROR_IO_ERROR_CLOSE_FAILED = 2, 166 167 /* The seek failed 168 */ 169 LIBCERROR_IO_ERROR_SEEK_FAILED = 3, 170 171 /* The read failed 172 */ 173 LIBCERROR_IO_ERROR_READ_FAILED = 4, 174 175 /* The write failed 176 */ 177 LIBCERROR_IO_ERROR_WRITE_FAILED = 5, 178 179 /* Access denied 180 */ 181 LIBCERROR_IO_ERROR_ACCESS_DENIED = 6, 182 183 /* The resource is invalid i.e. a missing file 184 */ 185 LIBCERROR_IO_ERROR_INVALID_RESOURCE = 7, 186 187 /* The ioctl failed 188 */ 189 LIBCERROR_IO_ERROR_IOCTL_FAILED = 8, 190 191 /* The unlink failed 192 */ 193 LIBCERROR_IO_ERROR_UNLINK_FAILED = 9 194 }; 195 196 /* The input error codes 197 * to signify errors regarding handing input data 198 */ 199 enum LIBCERROR_INPUT_ERROR 200 { 201 LIBCERROR_INPUT_ERROR_GENERIC = 0, 202 203 /* The input contains invalid data 204 */ 205 LIBCERROR_INPUT_ERROR_INVALID_DATA = 1, 206 207 /* The input contains an unsupported signature 208 */ 209 LIBCERROR_INPUT_ERROR_SIGNATURE_MISMATCH = 2, 210 211 /* A checksum in the input did not match 212 */ 213 LIBCERROR_INPUT_ERROR_CHECKSUM_MISMATCH = 3, 214 215 /* A value in the input did not match a previously 216 * read value or calculated value 217 */ 218 LIBCERROR_INPUT_ERROR_VALUE_MISMATCH = 4 219 }; 220 221 /* The memory error codes 222 * to signify errors regarding memory 223 */ 224 enum LIBCERROR_MEMORY_ERROR 225 { 226 LIBCERROR_MEMORY_ERROR_GENERIC = 0, 227 228 /* There is insufficient memory available 229 */ 230 LIBCERROR_MEMORY_ERROR_INSUFFICIENT = 1, 231 232 /* The memory failed to be copied 233 */ 234 LIBCERROR_MEMORY_ERROR_COPY_FAILED = 2, 235 236 /* The memory failed to be set 237 */ 238 LIBCERROR_MEMORY_ERROR_SET_FAILED = 3 239 }; 240 241 /* The output error codes 242 */ 243 enum LIBCERROR_OUTPUT_ERROR 244 { 245 LIBCERROR_OUTPUT_ERROR_GENERIC = 0, 246 247 /* There is insuficient space to write the output 248 */ 249 LIBCERROR_OUTPUT_ERROR_INSUFFICIENT_SPACE = 1 250 }; 251 252 /* The runtime error codes 253 * to signify errors regarding runtime processing 254 */ 255 enum LIBCERROR_RUNTIME_ERROR 256 { 257 LIBCERROR_RUNTIME_ERROR_GENERIC = 0, 258 259 /* The value is missing 260 */ 261 LIBCERROR_RUNTIME_ERROR_VALUE_MISSING = 1, 262 263 /* The value was already set 264 */ 265 LIBCERROR_RUNTIME_ERROR_VALUE_ALREADY_SET = 2, 266 267 /* The creation and/or initialization of an internal structure failed 268 */ 269 LIBCERROR_RUNTIME_ERROR_INITIALIZE_FAILED = 3, 270 271 /* The resize of an internal structure failed 272 */ 273 LIBCERROR_RUNTIME_ERROR_RESIZE_FAILED = 4, 274 275 /* The free and/or finalization of an internal structure failed 276 */ 277 LIBCERROR_RUNTIME_ERROR_FINALIZE_FAILED = 5, 278 279 /* The value could not be determined 280 */ 281 LIBCERROR_RUNTIME_ERROR_GET_FAILED = 6, 282 283 /* The value could not be set 284 */ 285 LIBCERROR_RUNTIME_ERROR_SET_FAILED = 7, 286 287 /* The value could not be appended/prepended 288 */ 289 LIBCERROR_RUNTIME_ERROR_APPEND_FAILED = 8, 290 291 /* The value could not be copied 292 */ 293 LIBCERROR_RUNTIME_ERROR_COPY_FAILED = 9, 294 295 /* The value could not be removed 296 */ 297 LIBCERROR_RUNTIME_ERROR_REMOVE_FAILED = 10, 298 299 /* The value could not be printed 300 */ 301 LIBCERROR_RUNTIME_ERROR_PRINT_FAILED = 11, 302 303 /* The value was out of bounds 304 */ 305 LIBCERROR_RUNTIME_ERROR_VALUE_OUT_OF_BOUNDS = 12, 306 307 /* The value exceeds the maximum for its specific type 308 */ 309 LIBCERROR_RUNTIME_ERROR_VALUE_EXCEEDS_MAXIMUM = 13, 310 311 /* The value is unsupported 312 */ 313 LIBCERROR_RUNTIME_ERROR_UNSUPPORTED_VALUE = 14, 314 315 /* An aborted was requested 316 */ 317 LIBCERROR_RUNTIME_ERROR_ABORT_REQUESTED = 15 318 }; 319 320 #endif /* !defined( HAVE_LOCAL_LIBCERROR ) */ 321 322 #define LIBCERROR_MESSAGE_INCREMENT_SIZE 64 323 #define LIBCERROR_MESSAGE_MAXIMUM_SIZE 4096 324 325 #endif /* !defined( LIBCERROR_INTERNAL_DEFINITIONS_H ) */ 326 327