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.

185 lines
8.4 KiB

  1. /**
  2. * @file status_to_string.h
  3. * @brief Convert various statuses and enums into string format (generally for logs)
  4. * @license GNU General Public License 3.0 - see LICENSE.txt
  5. * @todo generate this file
  6. */
  7. #ifndef STATUS_TO_STRING_H
  8. #define STATUS_TO_STRING_H
  9. #ifdef __cplusplus
  10. extern "C" {
  11. #endif
  12. #include "pEpEngine.h"
  13. #ifndef PEP_STATUS_TO_STRING
  14. #define PEP_STATUS_TO_STRING
  15. #endif
  16. /**
  17. * <!-- pEp_status_to_string() -->
  18. *
  19. * @brief TODO
  20. *
  21. * @param[in] status PEP_STATUS
  22. *
  23. */
  24. static inline const char *pEp_status_to_string(PEP_STATUS status) {
  25. switch (status) {
  26. case PEP_STATUS_OK: return "PEP_STATUS_OK";
  27. case PEP_INIT_CANNOT_LOAD_CRYPTO_LIB: return "PEP_INIT_CANNOT_LOAD_CRYPTO_LIB";
  28. case PEP_INIT_CRYPTO_LIB_INIT_FAILED: return "PEP_INIT_CRYPTO_LIB_INIT_FAILED";
  29. case PEP_INIT_NO_CRYPTO_HOME: return "PEP_INIT_NO_CRYPTO_HOME";
  30. // case PEP_INIT_NETPGP_INIT_FAILED: return "PEP_INIT_NETPGP_INIT_FAILED";
  31. case PEP_INIT_CANNOT_DETERMINE_CRYPTO_VERSION: return "PEP_INIT_CANNOT_DETERMINE_CRYPTO_VERSION";
  32. case PEP_INIT_UNSUPPORTED_CRYPTO_VERSION: return "PEP_INIT_UNSUPPORTED_CRYPTO_VERSION";
  33. case PEP_INIT_CANNOT_CONFIG_CRYPTO_AGENT: return "PEP_INIT_CANNOT_CONFIG_CRYPTO_AGENT";
  34. case PEP_INIT_SQLITE3_WITHOUT_MUTEX: return "PEP_INIT_SQLITE3_WITHOUT_MUTEX";
  35. case PEP_INIT_CANNOT_OPEN_DB: return "PEP_INIT_CANNOT_OPEN_DB";
  36. case PEP_INIT_CANNOT_OPEN_SYSTEM_DB: return "PEP_INIT_CANNOT_OPEN_SYSTEM_DB";
  37. case PEP_UNKNOWN_DB_ERROR: return "PEP_UNKNOWN_DB_ERROR";
  38. case PEP_KEY_NOT_FOUND: return "PEP_KEY_NOT_FOUND";
  39. case PEP_KEY_HAS_AMBIG_NAME: return "PEP_KEY_HAS_AMBIG_NAME";
  40. case PEP_GET_KEY_FAILED: return "PEP_GET_KEY_FAILED";
  41. case PEP_CANNOT_EXPORT_KEY: return "PEP_CANNOT_EXPORT_KEY";
  42. case PEP_CANNOT_EDIT_KEY: return "PEP_CANNOT_EDIT_KEY";
  43. case PEP_KEY_UNSUITABLE: return "PEP_KEY_UNSUITABLE";
  44. case PEP_MALFORMED_KEY_RESET_MSG: return "PEP_MALFORMED_KEY_RESET_MSG";
  45. case PEP_KEY_NOT_RESET: return "PEP_KEY_NOT_RESET";
  46. case PEP_KEY_IMPORTED: return "PEP_KEY_IMPORTED";
  47. case PEP_NO_KEY_IMPORTED: return "PEP_NO_KEY_IMPORTED";
  48. case PEP_KEY_IMPORT_STATUS_UNKNOWN: return "PEP_KEY_IMPORT_STATUS_UNKNOWN";
  49. case PEP_SOME_KEYS_IMPORTED: return "PEP_SOME_KEYS_IMPORTED";
  50. case PEP_CANNOT_FIND_IDENTITY: return "PEP_CANNOT_FIND_IDENTITY";
  51. case PEP_CANNOT_SET_PERSON: return "PEP_CANNOT_SET_PERSON";
  52. case PEP_CANNOT_SET_PGP_KEYPAIR: return "PEP_CANNOT_SET_PGP_KEYPAIR";
  53. case PEP_CANNOT_SET_IDENTITY: return "PEP_CANNOT_SET_IDENTITY";
  54. case PEP_CANNOT_SET_TRUST: return "PEP_CANNOT_SET_TRUST";
  55. case PEP_KEY_BLACKLISTED: return "PEP_KEY_BLACKLISTED";
  56. case PEP_CANNOT_FIND_PERSON: return "PEP_CANNOT_FIND_PERSON";
  57. case PEP_CANNOT_FIND_ALIAS: return "PEP_CANNOT_FIND_ALIAS";
  58. case PEP_CANNOT_SET_ALIAS: return "PEP_CANNOT_SET_ALIAS";
  59. case PEP_UNENCRYPTED: return "PEP_UNENCRYPTED";
  60. case PEP_VERIFIED: return "PEP_VERIFIED";
  61. case PEP_DECRYPTED: return "PEP_DECRYPTED";
  62. case PEP_DECRYPTED_AND_VERIFIED: return "PEP_DECRYPTED_AND_VERIFIED";
  63. case PEP_DECRYPT_WRONG_FORMAT: return "PEP_DECRYPT_WRONG_FORMAT";
  64. case PEP_DECRYPT_NO_KEY: return "PEP_DECRYPT_NO_KEY";
  65. case PEP_DECRYPT_SIGNATURE_DOES_NOT_MATCH: return "PEP_DECRYPT_SIGNATURE_DOES_NOT_MATCH";
  66. case PEP_VERIFY_NO_KEY: return "PEP_VERIFY_NO_KEY";
  67. case PEP_VERIFIED_AND_TRUSTED: return "PEP_VERIFIED_AND_TRUSTED";
  68. case PEP_CANNOT_REENCRYPT: return "PEP_CANNOT_REENCRYPT";
  69. case PEP_CANNOT_DECRYPT_UNKNOWN: return "PEP_CANNOT_DECRYPT_UNKNOWN";
  70. case PEP_TRUSTWORD_NOT_FOUND: return "PEP_TRUSTWORD_NOT_FOUND";
  71. case PEP_TRUSTWORDS_FPR_WRONG_LENGTH: return "PEP_TRUSTWORDS_FPR_WRONG_LENGTH";
  72. case PEP_TRUSTWORDS_DUPLICATE_FPR: return "PEP_TRUSTWORDS_DUPLICATE_FPR";
  73. case PEP_CANNOT_CREATE_KEY: return "PEP_CANNOT_CREATE_KEY";
  74. case PEP_CANNOT_SEND_KEY: return "PEP_CANNOT_SEND_KEY";
  75. case PEP_PHRASE_NOT_FOUND: return "PEP_PHRASE_NOT_FOUND";
  76. case PEP_PASSPHRASE_REQUIRED: return "PEP_PASSPHRASE_REQUIRED";
  77. case PEP_WRONG_PASSPHRASE: return "PEP_WRONG_PASSPHRASE";
  78. case PEP_PASSPHRASE_FOR_NEW_KEYS_REQUIRED: return "PEP_PASSPHRASE_FOR_NEW_KEYS_REQUIRED";
  79. case PEP_SEND_FUNCTION_NOT_REGISTERED: return "PEP_SEND_FUNCTION_NOT_REGISTERED";
  80. case PEP_CONTRAINTS_VIOLATED: return "PEP_CONTRAINTS_VIOLATED";
  81. case PEP_CANNOT_ENCODE: return "PEP_CANNOT_ENCODE";
  82. case PEP_SYNC_NO_NOTIFY_CALLBACK: return "PEP_SYNC_NO_NOTIFY_CALLBACK";
  83. case PEP_SYNC_ILLEGAL_MESSAGE: return "PEP_SYNC_ILLEGAL_MESSAGE";
  84. case PEP_SYNC_NO_INJECT_CALLBACK: return "PEP_SYNC_NO_INJECT_CALLBACK";
  85. case PEP_SYNC_NO_CHANNEL: return "PEP_SYNC_NO_CHANNEL";
  86. case PEP_SYNC_CANNOT_ENCRYPT: return "PEP_SYNC_CANNOT_ENCRYPT";
  87. case PEP_SYNC_NO_MESSAGE_SEND_CALLBACK: return "PEP_SYNC_NO_MESSAGE_SEND_CALLBACK";
  88. case PEP_SYNC_CANNOT_START: return "PEP_SYNC_CANNOT_START";
  89. case PEP_CANNOT_INCREASE_SEQUENCE: return "PEP_CANNOT_INCREASE_SEQUENCE";
  90. case PEP_STATEMACHINE_ERROR: return "PEP_STATEMACHINE_ERROR";
  91. case PEP_NO_TRUST: return "PEP_NO_TRUST";
  92. case PEP_STATEMACHINE_INVALID_STATE: return "PEP_STATEMACHINE_INVALID_STATE";
  93. case PEP_STATEMACHINE_INVALID_EVENT: return "PEP_STATEMACHINE_INVALID_EVENT";
  94. case PEP_STATEMACHINE_INVALID_CONDITION: return "PEP_STATEMACHINE_INVALID_CONDITION";
  95. case PEP_STATEMACHINE_INVALID_ACTION: return "PEP_STATEMACHINE_INVALID_ACTION";
  96. case PEP_STATEMACHINE_INHIBITED_EVENT: return "PEP_STATEMACHINE_INHIBITED_EVENT";
  97. case PEP_STATEMACHINE_CANNOT_SEND: return "PEP_STATEMACHINE_CANNOT_SEND";
  98. case PEP_COMMIT_FAILED: return "PEP_COMMIT_FAILED";
  99. case PEP_MESSAGE_CONSUME: return "PEP_MESSAGE_CONSUME";
  100. case PEP_MESSAGE_IGNORE: return "PEP_MESSAGE_IGNORE";
  101. case PEP_RECORD_NOT_FOUND: return "PEP_RECORD_NOT_FOUND";
  102. case PEP_CANNOT_CREATE_TEMP_FILE: return "PEP_CANNOT_CREATE_TEMP_FILE";
  103. case PEP_ILLEGAL_VALUE: return "PEP_ILLEGAL_VALUE";
  104. case PEP_BUFFER_TOO_SMALL: return "PEP_BUFFER_TOO_SMALL";
  105. case PEP_OUT_OF_MEMORY: return "PEP_OUT_OF_MEMORY";
  106. case PEP_UNKNOWN_ERROR: return "PEP_UNKNOWN_ERROR";
  107. case PEP_VERSION_MISMATCH: return "PEP_VERSION_MISMATCH";
  108. default: return "unknown status code";
  109. }
  110. }
  111. /**
  112. * <!-- pEp_comm_type_to_string() -->
  113. *
  114. * @brief TODO
  115. *
  116. * @param[in] ct PEP_comm_type
  117. *
  118. */
  119. static inline const char *pEp_comm_type_to_string(PEP_comm_type ct) {
  120. switch (ct) {
  121. case PEP_ct_unknown: return "unknown";
  122. case PEP_ct_no_encryption: return "no_encryption";
  123. case PEP_ct_no_encrypted_channel: return "no_encrypted_channel";
  124. case PEP_ct_key_not_found: return "key_not_found";
  125. case PEP_ct_key_expired: return "key_expired";
  126. case PEP_ct_key_revoked: return "key_revoked";
  127. case PEP_ct_key_b0rken: return "key_b0rken";
  128. case PEP_ct_my_key_not_included: return "my_key_not_included";
  129. case PEP_ct_security_by_obscurity: return "security_by_obscurity";
  130. case PEP_ct_b0rken_crypto: return "b0rken_crypto";
  131. case PEP_ct_key_too_short: return "key_too_short";
  132. case PEP_ct_compromised: return "compromised";
  133. case PEP_ct_mistrusted: return "mistrusted";
  134. case PEP_ct_unconfirmed_encryption: return "unconfirmed_encryption";
  135. case PEP_ct_OpenPGP_weak_unconfirmed: return "OpenPGP_weak_unconfirmed";
  136. case PEP_ct_to_be_checked: return "to_be_checked";
  137. case PEP_ct_SMIME_unconfirmed: return "SMIME_unconfirmed";
  138. case PEP_ct_CMS_unconfirmed: return "CMS_unconfirmed";
  139. case PEP_ct_strong_but_unconfirmed: return "strong_but_unconfirmed";
  140. case PEP_ct_OpenPGP_unconfirmed: return "OpenPGP_unconfirmed";
  141. case PEP_ct_OTR_unconfirmed: return "OTR_unconfirmed";
  142. case PEP_ct_unconfirmed_enc_anon: return "unconfirmed_enc_anon";
  143. case PEP_ct_pEp_unconfirmed: return "pEp_unconfirmed";
  144. case PEP_ct_confirmed: return "confirmed";
  145. case PEP_ct_confirmed_encryption: return "confirmed_encryption";
  146. case PEP_ct_OpenPGP_weak: return "OpenPGP_weak";
  147. case PEP_ct_to_be_checked_confirmed: return "to_be_checked_confirmed";
  148. case PEP_ct_SMIME: return "SMIME";
  149. case PEP_ct_CMS: return "CMS";
  150. case PEP_ct_strong_encryption: return "strong_encryption";
  151. case PEP_ct_OpenPGP: return "OpenPGP";
  152. case PEP_ct_OTR: return "OTR";
  153. case PEP_ct_confirmed_enc_anon: return "confirmed_enc_anon";
  154. case PEP_ct_pEp: return "pEp";
  155. default: return "invalid comm type";
  156. }
  157. }
  158. #ifdef __cplusplus
  159. } // "C"
  160. #endif
  161. #endif