1 /* 2 * The error code definitions for libvmdk 3 * 4 * Copyright (C) 2009-2021, 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( _LIBVMDK_ERROR_H ) 23 #define _LIBVMDK_ERROR_H 24 25 #include <libvmdk/types.h> 26 27 /* External error type definition hides internal structure 28 */ 29 typedef intptr_t libvmdk_error_t; 30 31 /* The error domains 32 */ 33 enum LIBVMDK_ERROR_DOMAINS 34 { 35 LIBVMDK_ERROR_DOMAIN_ARGUMENTS = (int) 'a', 36 LIBVMDK_ERROR_DOMAIN_CONVERSION = (int) 'c', 37 LIBVMDK_ERROR_DOMAIN_COMPRESSION = (int) 'C', 38 LIBVMDK_ERROR_DOMAIN_IO = (int) 'I', 39 LIBVMDK_ERROR_DOMAIN_INPUT = (int) 'i', 40 LIBVMDK_ERROR_DOMAIN_MEMORY = (int) 'm', 41 LIBVMDK_ERROR_DOMAIN_OUTPUT = (int) 'o', 42 LIBVMDK_ERROR_DOMAIN_RUNTIME = (int) 'r' 43 }; 44 45 /* The argument error codes 46 * to signify errors regarding arguments passed to a function 47 */ 48 enum LIBVMDK_ARGUMENT_ERROR 49 { 50 LIBVMDK_ARGUMENT_ERROR_GENERIC = 0, 51 52 /* The argument contains an invalid value 53 */ 54 LIBVMDK_ARGUMENT_ERROR_INVALID_VALUE = 1, 55 56 /* The argument contains a value less than zero 57 */ 58 LIBVMDK_ARGUMENT_ERROR_VALUE_LESS_THAN_ZERO = 2, 59 60 /* The argument contains a value zero or less 61 */ 62 LIBVMDK_ARGUMENT_ERROR_VALUE_ZERO_OR_LESS = 3, 63 64 /* The argument contains a value that exceeds the maximum 65 * for the specific type 66 */ 67 LIBVMDK_ARGUMENT_ERROR_VALUE_EXCEEDS_MAXIMUM = 4, 68 69 /* The argument contains a value that is too small 70 */ 71 LIBVMDK_ARGUMENT_ERROR_VALUE_TOO_SMALL = 5, 72 73 /* The argument contains a value that is too large 74 */ 75 LIBVMDK_ARGUMENT_ERROR_VALUE_TOO_LARGE = 6, 76 77 /* The argument contains a value that is out of bounds 78 */ 79 LIBVMDK_ARGUMENT_ERROR_VALUE_OUT_OF_BOUNDS = 7, 80 81 /* The argument contains a value that is not supported 82 */ 83 LIBVMDK_ARGUMENT_ERROR_UNSUPPORTED_VALUE = 8, 84 85 /* The argument contains a value that conficts with another argument 86 */ 87 LIBVMDK_ARGUMENT_ERROR_CONFLICTING_VALUE = 9 88 }; 89 90 /* The conversion error codes 91 * to signify errors regarding conversions 92 */ 93 enum LIBVMDK_CONVERSION_ERROR 94 { 95 LIBVMDK_CONVERSION_ERROR_GENERIC = 0, 96 97 /* The conversion failed on the input 98 */ 99 LIBVMDK_CONVERSION_ERROR_INPUT_FAILED = 1, 100 101 /* The conversion failed on the output 102 */ 103 LIBVMDK_CONVERSION_ERROR_OUTPUT_FAILED = 2 104 }; 105 106 /* The compression error codes 107 * to signify errors regarding compression 108 */ 109 enum LIBVMDK_COMPRESSION_ERROR 110 { 111 LIBVMDK_COMPRESSION_ERROR_GENERIC = 0, 112 113 /* The compression failed 114 */ 115 LIBVMDK_COMPRESSION_ERROR_COMPRESS_FAILED = 1, 116 117 /* The decompression failed 118 */ 119 LIBVMDK_COMPRESSION_ERROR_DECOMPRESS_FAILED = 2 120 }; 121 122 /* The input/output error codes 123 * to signify errors regarding input/output 124 */ 125 enum LIBVMDK_IO_ERROR 126 { 127 LIBVMDK_IO_ERROR_GENERIC = 0, 128 129 /* The open failed 130 */ 131 LIBVMDK_IO_ERROR_OPEN_FAILED = 1, 132 133 /* The close failed 134 */ 135 LIBVMDK_IO_ERROR_CLOSE_FAILED = 2, 136 137 /* The seek failed 138 */ 139 LIBVMDK_IO_ERROR_SEEK_FAILED = 3, 140 141 /* The read failed 142 */ 143 LIBVMDK_IO_ERROR_READ_FAILED = 4, 144 145 /* The write failed 146 */ 147 LIBVMDK_IO_ERROR_WRITE_FAILED = 5, 148 149 /* Access denied 150 */ 151 LIBVMDK_IO_ERROR_ACCESS_DENIED = 6, 152 153 /* The resource is invalid i.e. a missing file 154 */ 155 LIBVMDK_IO_ERROR_INVALID_RESOURCE = 7, 156 157 /* The ioctl failed 158 */ 159 LIBVMDK_IO_ERROR_IOCTL_FAILED = 8, 160 161 /* The unlink failed 162 */ 163 LIBVMDK_IO_ERROR_UNLINK_FAILED = 9 164 }; 165 166 /* The input error codes 167 * to signify errors regarding handing input data 168 */ 169 enum LIBVMDK_INPUT_ERROR 170 { 171 LIBVMDK_INPUT_ERROR_GENERIC = 0, 172 173 /* The input contains invalid data 174 */ 175 LIBVMDK_INPUT_ERROR_INVALID_DATA = 1, 176 177 /* The input contains an unsupported signature 178 */ 179 LIBVMDK_INPUT_ERROR_SIGNATURE_MISMATCH = 2, 180 181 /* A checksum in the input did not match 182 */ 183 LIBVMDK_INPUT_ERROR_CHECKSUM_MISMATCH = 3, 184 185 /* A value in the input did not match a previously 186 * read value or calculated value 187 */ 188 LIBVMDK_INPUT_ERROR_VALUE_MISMATCH = 4 189 }; 190 191 /* The memory error codes 192 * to signify errors regarding memory 193 */ 194 enum LIBVMDK_MEMORY_ERROR 195 { 196 LIBVMDK_MEMORY_ERROR_GENERIC = 0, 197 198 /* There is insufficient memory available 199 */ 200 LIBVMDK_MEMORY_ERROR_INSUFFICIENT = 1, 201 202 /* The memory failed to be copied 203 */ 204 LIBVMDK_MEMORY_ERROR_COPY_FAILED = 2, 205 206 /* The memory failed to be set 207 */ 208 LIBVMDK_MEMORY_ERROR_SET_FAILED = 3 209 }; 210 211 /* The output error codes 212 */ 213 enum LIBVMDK_OUTPUT_ERROR 214 { 215 LIBVMDK_OUTPUT_ERROR_GENERIC = 0, 216 217 /* There is insuficient space to write the output 218 */ 219 LIBVMDK_OUTPUT_ERROR_INSUFFICIENT_SPACE = 1 220 }; 221 222 /* The runtime error codes 223 * to signify errors regarding runtime processing 224 */ 225 enum LIBVMDK_RUNTIME_ERROR 226 { 227 LIBVMDK_RUNTIME_ERROR_GENERIC = 0, 228 229 /* The value is missing 230 */ 231 LIBVMDK_RUNTIME_ERROR_VALUE_MISSING = 1, 232 233 /* The value was already set 234 */ 235 LIBVMDK_RUNTIME_ERROR_VALUE_ALREADY_SET = 2, 236 237 /* The creation and/or initialization of an internal structure failed 238 */ 239 LIBVMDK_RUNTIME_ERROR_INITIALIZE_FAILED = 3, 240 241 /* The resize of an internal structure failed 242 */ 243 LIBVMDK_RUNTIME_ERROR_RESIZE_FAILED = 4, 244 245 /* The free and/or finalization of an internal structure failed 246 */ 247 LIBVMDK_RUNTIME_ERROR_FINALIZE_FAILED = 5, 248 249 /* The value could not be determined 250 */ 251 LIBVMDK_RUNTIME_ERROR_GET_FAILED = 6, 252 253 /* The value could not be set 254 */ 255 LIBVMDK_RUNTIME_ERROR_SET_FAILED = 7, 256 257 /* The value could not be appended/prepended 258 */ 259 LIBVMDK_RUNTIME_ERROR_APPEND_FAILED = 8, 260 261 /* The value could not be copied 262 */ 263 LIBVMDK_RUNTIME_ERROR_COPY_FAILED = 9, 264 265 /* The value could not be removed 266 */ 267 LIBVMDK_RUNTIME_ERROR_REMOVE_FAILED = 10, 268 269 /* The value could not be printed 270 */ 271 LIBVMDK_RUNTIME_ERROR_PRINT_FAILED = 11, 272 273 /* The value was out of bounds 274 */ 275 LIBVMDK_RUNTIME_ERROR_VALUE_OUT_OF_BOUNDS = 12, 276 277 /* The value exceeds the maximum for its specific type 278 */ 279 LIBVMDK_RUNTIME_ERROR_VALUE_EXCEEDS_MAXIMUM = 13, 280 281 /* The value is unsupported 282 */ 283 LIBVMDK_RUNTIME_ERROR_UNSUPPORTED_VALUE = 14, 284 285 /* An abort was requested 286 */ 287 LIBVMDK_RUNTIME_ERROR_ABORT_REQUESTED = 15 288 }; 289 290 #endif /* !defined( _LIBVMDK_ERROR_H ) */ 291 292