pal_error.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. /* Copyright (C) 2014 Stony Brook University
  2. This file is part of Graphene Library OS.
  3. Graphene Library OS is free software: you can redistribute it and/or
  4. modify it under the terms of the GNU Lesser General Public License
  5. as published by the Free Software Foundation, either version 3 of the
  6. License, or (at your option) any later version.
  7. Graphene Library OS is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU Lesser General Public License for more details.
  11. You should have received a copy of the GNU Lesser General Public License
  12. along with this program. If not, see <http://www.gnu.org/licenses/>. */
  13. /*
  14. * pal_error.h
  15. *
  16. * This file contains definitions of PAL error codes.
  17. */
  18. #ifndef PAL_ERROR_H
  19. #define PAL_ERROR_H
  20. #include <stddef.h>
  21. typedef enum _pal_error_t {
  22. PAL_ERROR_SUCCESS = 0,
  23. PAL_ERROR_NOTIMPLEMENTED,
  24. PAL_ERROR_NOTDEFINED,
  25. PAL_ERROR_NOTSUPPORT,
  26. PAL_ERROR_INVAL,
  27. PAL_ERROR_TOOLONG,
  28. PAL_ERROR_DENIED,
  29. PAL_ERROR_BADHANDLE,
  30. PAL_ERROR_STREAMEXIST,
  31. PAL_ERROR_STREAMNOTEXIST,
  32. PAL_ERROR_STREAMISFILE,
  33. PAL_ERROR_STREAMISDIR,
  34. PAL_ERROR_STREAMISDEVICE,
  35. PAL_ERROR_INTERRUPTED,
  36. PAL_ERROR_OVERFLOW,
  37. PAL_ERROR_BADADDR,
  38. PAL_ERROR_NOMEM,
  39. PAL_ERROR_NOTKILLABLE,
  40. PAL_ERROR_INCONSIST,
  41. PAL_ERROR_TRYAGAIN,
  42. PAL_ERROR_ENDOFSTREAM,
  43. PAL_ERROR_NOTSERVER,
  44. PAL_ERROR_NOTCONNECTION,
  45. PAL_ERROR_CONNFAILED,
  46. PAL_ERROR_ADDRNOTEXIST,
  47. PAL_ERROR_AFNOSUPPORT,
  48. #define PAL_ERROR_NATIVE_COUNT PAL_ERROR_AFNOSUPPORT
  49. #define PAL_ERROR_CRYPTO_START PAL_ERROR_CRYPTO_FEATURE_UNAVAILABLE
  50. /* Crypto error constants and their descriptions are adapted from mbedtls. */
  51. PAL_ERROR_CRYPTO_FEATURE_UNAVAILABLE = 1000,
  52. PAL_ERROR_CRYPTO_INVALID_CONTEXT,
  53. PAL_ERROR_CRYPTO_INVALID_KEY_LENGTH,
  54. PAL_ERROR_CRYPTO_INVALID_INPUT_LENGTH,
  55. PAL_ERROR_CRYPTO_INVALID_OUTPUT_LENGTH,
  56. PAL_ERROR_CRYPTO_BAD_INPUT_DATA,
  57. PAL_ERROR_CRYPTO_INVALID_PADDING,
  58. PAL_ERROR_CRYPTO_DATA_MISALIGNED,
  59. PAL_ERROR_CRYPTO_INVALID_FORMAT,
  60. PAL_ERROR_CRYPTO_AUTH_FAILED,
  61. PAL_ERROR_CRYPTO_IO_ERROR,
  62. PAL_ERROR_CRYPTO_KEY_GEN_FAILED,
  63. PAL_ERROR_CRYPTO_INVALID_KEY,
  64. PAL_ERROR_CRYPTO_VERIFY_FAILED,
  65. PAL_ERROR_CRYPTO_RNG_FAILED,
  66. PAL_ERROR_CRYPTO_INVALID_DH_STATE,
  67. #define PAL_ERROR_CRYPTO_END PAL_ERROR_CRYPTO_INVALID_DH_STATE
  68. } pal_error_t;
  69. const char* pal_strerror(int err);
  70. #endif