apu_errno.h 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. /* Licensed to the Apache Software Foundation (ASF) under one or more
  2. * contributor license agreements. See the NOTICE file distributed with
  3. * this work for additional information regarding copyright ownership.
  4. * The ASF licenses this file to You under the Apache License, Version 2.0
  5. * (the "License"); you may not use this file except in compliance with
  6. * the License. You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. #ifndef APU_ERRNO_H
  17. #define APU_ERRNO_H
  18. /**
  19. * @file apu_errno.h
  20. * @brief APR-Util Error Codes
  21. */
  22. #include "apr.h"
  23. #include "apr_errno.h"
  24. #ifdef __cplusplus
  25. extern "C" {
  26. #endif /* __cplusplus */
  27. /**
  28. * @defgroup apu_errno Error Codes
  29. * @ingroup APR_Util
  30. * @{
  31. */
  32. /**
  33. * @defgroup APR_Util_Error APR_Util Error Values
  34. * <PRE>
  35. * <b>APU ERROR VALUES</b>
  36. * APR_ENOKEY The key provided was empty or NULL
  37. * APR_ENOIV The initialisation vector provided was NULL
  38. * APR_EKEYTYPE The key type was not recognised
  39. * APR_ENOSPACE The buffer supplied was not big enough
  40. * APR_ECRYPT An error occurred while encrypting or decrypting
  41. * APR_EPADDING Padding was not supported
  42. * APR_EKEYLENGTH The key length was incorrect
  43. * APR_ENOCIPHER The cipher provided was not recognised
  44. * APR_ENODIGEST The digest provided was not recognised
  45. * APR_ENOENGINE The engine provided was not recognised
  46. * APR_EINITENGINE The engine could not be initialised
  47. * APR_EREINIT Underlying crypto has already been initialised
  48. * </PRE>
  49. *
  50. * <PRE>
  51. * <b>APR STATUS VALUES</b>
  52. * APR_INCHILD Program is currently executing in the child
  53. * </PRE>
  54. * @{
  55. */
  56. /** @see APR_STATUS_IS_ENOKEY */
  57. #define APR_ENOKEY (APR_UTIL_START_STATUS + 1)
  58. /** @see APR_STATUS_IS_ENOIV */
  59. #define APR_ENOIV (APR_UTIL_START_STATUS + 2)
  60. /** @see APR_STATUS_IS_EKEYTYPE */
  61. #define APR_EKEYTYPE (APR_UTIL_START_STATUS + 3)
  62. /** @see APR_STATUS_IS_ENOSPACE */
  63. #define APR_ENOSPACE (APR_UTIL_START_STATUS + 4)
  64. /** @see APR_STATUS_IS_ECRYPT */
  65. #define APR_ECRYPT (APR_UTIL_START_STATUS + 5)
  66. /** @see APR_STATUS_IS_EPADDING */
  67. #define APR_EPADDING (APR_UTIL_START_STATUS + 6)
  68. /** @see APR_STATUS_IS_EKEYLENGTH */
  69. #define APR_EKEYLENGTH (APR_UTIL_START_STATUS + 7)
  70. /** @see APR_STATUS_IS_ENOCIPHER */
  71. #define APR_ENOCIPHER (APR_UTIL_START_STATUS + 8)
  72. /** @see APR_STATUS_IS_ENODIGEST */
  73. #define APR_ENODIGEST (APR_UTIL_START_STATUS + 9)
  74. /** @see APR_STATUS_IS_ENOENGINE */
  75. #define APR_ENOENGINE (APR_UTIL_START_STATUS + 10)
  76. /** @see APR_STATUS_IS_EINITENGINE */
  77. #define APR_EINITENGINE (APR_UTIL_START_STATUS + 11)
  78. /** @see APR_STATUS_IS_EREINIT */
  79. #define APR_EREINIT (APR_UTIL_START_STATUS + 12)
  80. /** @} */
  81. /**
  82. * @defgroup APU_STATUS_IS Status Value Tests
  83. * @warning For any particular error condition, more than one of these tests
  84. * may match. This is because platform-specific error codes may not
  85. * always match the semantics of the POSIX codes these tests (and the
  86. * corresponding APR error codes) are named after. A notable example
  87. * are the APR_STATUS_IS_ENOENT and APR_STATUS_IS_ENOTDIR tests on
  88. * Win32 platforms. The programmer should always be aware of this and
  89. * adjust the order of the tests accordingly.
  90. * @{
  91. */
  92. /** @} */
  93. /**
  94. * @addtogroup APR_Util_Error
  95. * @{
  96. */
  97. /**
  98. * The key was empty or not provided
  99. */
  100. #define APR_STATUS_IS_ENOKEY(s) ((s) == APR_ENOKEY)
  101. /**
  102. * The initialisation vector was not provided
  103. */
  104. #define APR_STATUS_IS_ENOIV(s) ((s) == APR_ENOIV)
  105. /**
  106. * The key type was not recognised
  107. */
  108. #define APR_STATUS_IS_EKEYTYPE(s) ((s) == APR_EKEYTYPE)
  109. /**
  110. * The buffer provided was not big enough
  111. */
  112. #define APR_STATUS_IS_ENOSPACE(s) ((s) == APR_ENOSPACE)
  113. /**
  114. * An error occurred while encrypting or decrypting
  115. */
  116. #define APR_STATUS_IS_ECRYPT(s) ((s) == APR_ECRYPT)
  117. /**
  118. * An error occurred while padding
  119. */
  120. #define APR_STATUS_IS_EPADDING(s) ((s) == APR_EPADDING)
  121. /**
  122. * An error occurred with the key length
  123. */
  124. #define APR_STATUS_IS_EKEYLENGTH(s) ((s) == APR_EKEYLENGTH)
  125. /**
  126. * The cipher provided was not recognised
  127. */
  128. #define APR_STATUS_IS_ENOCIPHER(s) ((s) == APR_ENOCIPHER)
  129. /**
  130. * The digest provided was not recognised
  131. */
  132. #define APR_STATUS_IS_ENODIGEST(s) ((s) == APR_ENODIGEST)
  133. /**
  134. * The engine provided was not recognised
  135. */
  136. #define APR_STATUS_IS_ENOENGINE(s) ((s) == APR_ENOENGINE)
  137. /**
  138. * The engine could not be initialised
  139. */
  140. #define APR_STATUS_IS_EINITENGINE(s) ((s) == APR_EINITENGINE)
  141. /**
  142. * Crypto has already been initialised
  143. */
  144. #define APR_STATUS_IS_EREINIT(s) ((s) == APR_EREINIT)
  145. /** @} */
  146. /**
  147. * This structure allows the underlying API error codes to be returned
  148. * along with plain text error messages that explain to us mere mortals
  149. * what really happened.
  150. */
  151. typedef struct apu_err_t {
  152. const char *reason;
  153. const char *msg;
  154. int rc;
  155. } apu_err_t;
  156. /** @} */
  157. #ifdef __cplusplus
  158. }
  159. #endif
  160. #endif /* ! APU_ERRNO_H */