You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

292 lines
6.5 KiB

  1. /*
  2. * The error code definitions for libpff
  3. *
  4. * Copyright (C) 2008-2019, 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. #if !defined( _LIBPFF_ERROR_H )
  22. #define _LIBPFF_ERROR_H
  23. #include <libpff/types.h>
  24. /* External error type definition hides internal structure
  25. */
  26. typedef intptr_t libpff_error_t;
  27. /* The error domains
  28. */
  29. enum LIBPFF_ERROR_DOMAINS
  30. {
  31. LIBPFF_ERROR_DOMAIN_ARGUMENTS = (int) 'a',
  32. LIBPFF_ERROR_DOMAIN_CONVERSION = (int) 'c',
  33. LIBPFF_ERROR_DOMAIN_COMPRESSION = (int) 'C',
  34. LIBPFF_ERROR_DOMAIN_IO = (int) 'I',
  35. LIBPFF_ERROR_DOMAIN_INPUT = (int) 'i',
  36. LIBPFF_ERROR_DOMAIN_MEMORY = (int) 'm',
  37. LIBPFF_ERROR_DOMAIN_OUTPUT = (int) 'o',
  38. LIBPFF_ERROR_DOMAIN_RUNTIME = (int) 'r'
  39. };
  40. /* The argument error codes
  41. * to signify errors regarding arguments passed to a function
  42. */
  43. enum LIBPFF_ARGUMENT_ERROR
  44. {
  45. LIBPFF_ARGUMENT_ERROR_GENERIC = 0,
  46. /* The argument contains an invalid value
  47. */
  48. LIBPFF_ARGUMENT_ERROR_INVALID_VALUE = 1,
  49. /* The argument contains a value less than zero
  50. */
  51. LIBPFF_ARGUMENT_ERROR_VALUE_LESS_THAN_ZERO = 2,
  52. /* The argument contains a value zero or less
  53. */
  54. LIBPFF_ARGUMENT_ERROR_VALUE_ZERO_OR_LESS = 3,
  55. /* The argument contains a value that exceeds the maximum
  56. * for the specific type
  57. */
  58. LIBPFF_ARGUMENT_ERROR_VALUE_EXCEEDS_MAXIMUM = 4,
  59. /* The argument contains a value that is too small
  60. */
  61. LIBPFF_ARGUMENT_ERROR_VALUE_TOO_SMALL = 5,
  62. /* The argument contains a value that is too large
  63. */
  64. LIBPFF_ARGUMENT_ERROR_VALUE_TOO_LARGE = 6,
  65. /* The argument contains a value that is out of bounds
  66. */
  67. LIBPFF_ARGUMENT_ERROR_VALUE_OUT_OF_BOUNDS = 7,
  68. /* The argument contains a value that is not supported
  69. */
  70. LIBPFF_ARGUMENT_ERROR_UNSUPPORTED_VALUE = 8,
  71. /* The argument contains a value that conficts with another argument
  72. */
  73. LIBPFF_ARGUMENT_ERROR_CONFLICTING_VALUE = 9
  74. };
  75. /* The conversion error codes
  76. * to signify errors regarding conversions
  77. */
  78. enum LIBPFF_CONVERSION_ERROR
  79. {
  80. LIBPFF_CONVERSION_ERROR_GENERIC = 0,
  81. /* The conversion failed on the input
  82. */
  83. LIBPFF_CONVERSION_ERROR_INPUT_FAILED = 1,
  84. /* The conversion failed on the output
  85. */
  86. LIBPFF_CONVERSION_ERROR_OUTPUT_FAILED = 2
  87. };
  88. /* The compression error codes
  89. * to signify errors regarding compression
  90. */
  91. enum LIBPFF_COMPRESSION_ERROR
  92. {
  93. LIBPFF_COMPRESSION_ERROR_GENERIC = 0,
  94. /* The compression failed
  95. */
  96. LIBPFF_COMPRESSION_ERROR_COMPRESS_FAILED = 1,
  97. /* The decompression failed
  98. */
  99. LIBPFF_COMPRESSION_ERROR_DECOMPRESS_FAILED = 2
  100. };
  101. /* The input/output error codes
  102. * to signify errors regarding input/output
  103. */
  104. enum LIBPFF_IO_ERROR
  105. {
  106. LIBPFF_IO_ERROR_GENERIC = 0,
  107. /* The open failed
  108. */
  109. LIBPFF_IO_ERROR_OPEN_FAILED = 1,
  110. /* The close failed
  111. */
  112. LIBPFF_IO_ERROR_CLOSE_FAILED = 2,
  113. /* The seek failed
  114. */
  115. LIBPFF_IO_ERROR_SEEK_FAILED = 3,
  116. /* The read failed
  117. */
  118. LIBPFF_IO_ERROR_READ_FAILED = 4,
  119. /* The write failed
  120. */
  121. LIBPFF_IO_ERROR_WRITE_FAILED = 5,
  122. /* Access denied
  123. */
  124. LIBPFF_IO_ERROR_ACCESS_DENIED = 6,
  125. /* The resource is invalid i.e. a missing file
  126. */
  127. LIBPFF_IO_ERROR_INVALID_RESOURCE = 7,
  128. /* The ioctl failed
  129. */
  130. LIBPFF_IO_ERROR_IOCTL_FAILED = 8,
  131. /* The unlink failed
  132. */
  133. LIBPFF_IO_ERROR_UNLINK_FAILED = 9
  134. };
  135. /* The input error codes
  136. * to signify errors regarding handing input data
  137. */
  138. enum LIBPFF_INPUT_ERROR
  139. {
  140. LIBPFF_INPUT_ERROR_GENERIC = 0,
  141. /* The input contains invalid data
  142. */
  143. LIBPFF_INPUT_ERROR_INVALID_DATA = 1,
  144. /* The input contains an unsupported signature
  145. */
  146. LIBPFF_INPUT_ERROR_SIGNATURE_MISMATCH = 2,
  147. /* A checksum in the input did not match
  148. */
  149. LIBPFF_INPUT_ERROR_CHECKSUM_MISMATCH = 3,
  150. /* A value in the input did not match a previously
  151. * read value or calculated value
  152. */
  153. LIBPFF_INPUT_ERROR_VALUE_MISMATCH = 4
  154. };
  155. /* The memory error codes
  156. * to signify errors regarding memory
  157. */
  158. enum LIBPFF_MEMORY_ERROR
  159. {
  160. LIBPFF_MEMORY_ERROR_GENERIC = 0,
  161. /* There is insufficient memory available
  162. */
  163. LIBPFF_MEMORY_ERROR_INSUFFICIENT = 1,
  164. /* The memory failed to be copied
  165. */
  166. LIBPFF_MEMORY_ERROR_COPY_FAILED = 2,
  167. /* The memory failed to be set
  168. */
  169. LIBPFF_MEMORY_ERROR_SET_FAILED = 3
  170. };
  171. /* The output error codes
  172. */
  173. enum LIBPFF_OUTPUT_ERROR
  174. {
  175. LIBPFF_OUTPUT_ERROR_GENERIC = 0,
  176. /* There is insuficient space to write the output
  177. */
  178. LIBPFF_OUTPUT_ERROR_INSUFFICIENT_SPACE = 1
  179. };
  180. /* The runtime error codes
  181. * to signify errors regarding runtime processing
  182. */
  183. enum LIBPFF_RUNTIME_ERROR
  184. {
  185. LIBPFF_RUNTIME_ERROR_GENERIC = 0,
  186. /* The value is missing
  187. */
  188. LIBPFF_RUNTIME_ERROR_VALUE_MISSING = 1,
  189. /* The value was already set
  190. */
  191. LIBPFF_RUNTIME_ERROR_VALUE_ALREADY_SET = 2,
  192. /* The creation and/or initialization of an internal structure failed
  193. */
  194. LIBPFF_RUNTIME_ERROR_INITIALIZE_FAILED = 3,
  195. /* The resize of an internal structure failed
  196. */
  197. LIBPFF_RUNTIME_ERROR_RESIZE_FAILED = 4,
  198. /* The free and/or finalization of an internal structure failed
  199. */
  200. LIBPFF_RUNTIME_ERROR_FINALIZE_FAILED = 5,
  201. /* The value could not be determined
  202. */
  203. LIBPFF_RUNTIME_ERROR_GET_FAILED = 6,
  204. /* The value could not be set
  205. */
  206. LIBPFF_RUNTIME_ERROR_SET_FAILED = 7,
  207. /* The value could not be appended/prepended
  208. */
  209. LIBPFF_RUNTIME_ERROR_APPEND_FAILED = 8,
  210. /* The value could not be copied
  211. */
  212. LIBPFF_RUNTIME_ERROR_COPY_FAILED = 9,
  213. /* The value could not be removed
  214. */
  215. LIBPFF_RUNTIME_ERROR_REMOVE_FAILED = 10,
  216. /* The value could not be printed
  217. */
  218. LIBPFF_RUNTIME_ERROR_PRINT_FAILED = 11,
  219. /* The value was out of bounds
  220. */
  221. LIBPFF_RUNTIME_ERROR_VALUE_OUT_OF_BOUNDS = 12,
  222. /* The value exceeds the maximum for its specific type
  223. */
  224. LIBPFF_RUNTIME_ERROR_VALUE_EXCEEDS_MAXIMUM = 13,
  225. /* The value is unsupported
  226. */
  227. LIBPFF_RUNTIME_ERROR_UNSUPPORTED_VALUE = 14,
  228. /* An abort was requested
  229. */
  230. LIBPFF_RUNTIME_ERROR_ABORT_REQUESTED = 15
  231. };
  232. #endif /* !defined( _LIBPFF_ERROR_H ) */