Remove temporary defined TIZEN_ERROR_KEY_MANAGER
[platform/core/security/key-manager.git] / src / include / ckmc / ckmc-error.h
index e93cca0..613e6f6 100644 (file)
  *
  * @file    ckmc-error.h
  * @version 1.0
- * @brief   This file contains error codes of the Key Manager
+ * @brief   This file contains error codes of the Key Manager.
 */
 #ifndef __TIZEN_CORE_CKMC_ERROR_H_
 #define __TIZEN_CORE_CKMC_ERROR_H_
 
+#include <tizen.h>
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -30,125 +32,34 @@ extern "C" {
  */
 
 /**
- * @brief Indicates the result of the one specific API is successful
- * @since_tizen 2.3
- */
-#define CKMC_SUCCESS 0
-
-/**
- * @brief Indicates the socket between client and Central Key Manager failed
- * @since_tizen 2.3
- */
-#define CKMC_ERROR_SOCKET -1
-
-/**
- * @brief Indicates the request from client is malformed
- * @since_tizen 2.3
- */
-#define CKMC_ERROR_BAD_REQUEST -2
-
-/**
- * @brief Indicates the response from Central Key Manager is malformed
- * @since_tizen 2.3
- */
-#define CKMC_ERROR_BAD_RESPONSE -3
-
-/**
- * @brief Indicates the transmitting request failed.
- * @since_tizen 2.3
- */
-#define CKMC_ERROR_SEND_FAILED -4
-
-/**
- * @brief Indicates the receiving response failed.
- * @since_tizen 2.3
- */
-#define CKMC_ERROR_RECV_FAILED -5
-
-/**
- * @brief Indicates the authentication between client and manager failed.
- * @since_tizen 2.3
- */
-#define CKMC_ERROR_AUTHENTICATION_FAILED -6
-
-/**
- * @brief Indicates the API's input parameter is malformed
- * @since_tizen 2.3
- */
-#define CKMC_ERROR_INPUT_PARAM -7
-
-/**
- * @brief Indicates the output buffer size which is passed as parameter is too small
- * @since_tizen 2.3
- */
-#define CKMC_ERROR_BUFFER_TOO_SMALL -8
-
-/**
- * @brief Indicates system is running out of memory state
- * @since_tizen 2.3
- */
-#define CKMC_ERROR_OUT_OF_MEMORY -9
-
-/**
- * @brief Indicates the access has been denied by Central Key Manager
- * @since_tizen 2.3
- */
-#define CKMC_ERROR_ACCESS_DENIED -10
-
-/**
- * @brief Indicates Central Key Manager has been failed for some reason
- * @since_tizen 2.3
- */
-#define CKMC_ERROR_SERVER_ERROR -11
-
-/**
- * @brief Indicates the database was not unlocked - user did not login
- * @since_tizen 2.3
- */
-#define CKMC_ERROR_DB_LOCKED -12
-
-/**
- * @brief Indicates an internal error inside the database
- * @since_tizen 2.3
- */
-#define CKMC_ERROR_DB_ERROR -13
-
-/**
- * @brief Indicates that provided alias already exists in the database
- * @since_tizen 2.3
- */
-#define CKMC_ERROR_DB_ALIAS_EXISTS -14
-
-/**
- * @brief Indicates that request given to database returned no result
- * @since_tizen 2.3
- */
-#define CKMC_ERROR_DB_ALIAS_UNKNOWN -15
-
-/**
- * @brief Indicates that CA certificate(s) were unknown and chain could not be created
- * @since_tizen 2.3
- */
-#define CKMC_ERROR_VERIFICATION_FAILED -16
-
-/**
- * @brief Indicates that a provided file or binary has not a valid format
- * @since_tizen 2.3
- */
-#define CKMC_ERROR_INVALID_FORMAT -17
-
-/**
- * @brief Indicates that provided file doesn't exists or cannot be accessed in the file system
- * @since_tizen 2.3
- */
-#define CKMC_ERROR_FILE_ACCESS_DENIED -18
-
-/**
- * @brief Indicates the error with unknown reason
- * @since_tizen 2.3
- */
-#define CKMC_ERROR_UNKNOWN -255
-
+ * @brief Enumeration for Key Manager Errors.
+ * @since_tizen 2.3
+ */
+typedef enum{
+       CKMC_ERROR_NONE                     = TIZEN_ERROR_NONE,               /**< Successful */
+       CKMC_ERROR_INVALID_PARAMETER        = TIZEN_ERROR_INVALID_PARAMETER,  /**< Invalid function parameter */
+       CKMC_ERROR_OUT_OF_MEMORY            = TIZEN_ERROR_OUT_OF_MEMORY,      /**< Out of memory */
+       CKMC_ERROR_PERMISSION_DENIED        = TIZEN_ERROR_PERMISSION_DENIED,  /**< Permission denied */
+
+       CKMC_ERROR_SOCKET                   = TIZEN_ERROR_KEY_MANAGER | 0x01, /**< Socket error between client and Central Key Manager */
+       CKMC_ERROR_BAD_REQUEST              = TIZEN_ERROR_KEY_MANAGER | 0x02,  /**< Invalid request from client */
+       CKMC_ERROR_BAD_RESPONSE             = TIZEN_ERROR_KEY_MANAGER | 0x03, /**< Invalid response from Central Key Manager */
+       CKMC_ERROR_SEND_FAILED              = TIZEN_ERROR_KEY_MANAGER | 0x04, /**< Transmitting request failed */
+       CKMC_ERROR_RECV_FAILED              = TIZEN_ERROR_KEY_MANAGER | 0x05, /**< Receiving response failed */
+       CKMC_ERROR_AUTHENTICATION_FAILED    = TIZEN_ERROR_KEY_MANAGER | 0x06, /**< Authentication between client and manager failed */
+       CKMC_ERROR_BUFFER_TOO_SMALL         = TIZEN_ERROR_KEY_MANAGER | 0x07, /**< The output buffer size which is passed as parameter is too small */
+       CKMC_ERROR_SERVER_ERROR             = TIZEN_ERROR_KEY_MANAGER | 0x08, /**< Central Key Manager has been failed for some reason */
+       CKMC_ERROR_DB_LOCKED                = TIZEN_ERROR_KEY_MANAGER | 0x09, /**< The database was not unlocked - user did not login */
+       CKMC_ERROR_DB_ERROR                 = TIZEN_ERROR_KEY_MANAGER | 0x0A, /**< An internal error inside the database */
+       CKMC_ERROR_DB_ALIAS_EXISTS          = TIZEN_ERROR_KEY_MANAGER | 0x0B, /**< Provided alias already exists in the database */
+       CKMC_ERROR_DB_ALIAS_UNKNOWN         = TIZEN_ERROR_KEY_MANAGER | 0x0C, /**< No data for given alias */
+       CKMC_ERROR_VERIFICATION_FAILED      = TIZEN_ERROR_KEY_MANAGER | 0x0D, /**< CA certificate(s) were unknown and chain could not be created */
+       CKMC_ERROR_INVALID_FORMAT           = TIZEN_ERROR_KEY_MANAGER | 0x0E, /**< A provided file or binary has not a valid format */
+       CKMC_ERROR_FILE_ACCESS_DENIED       = TIZEN_ERROR_KEY_MANAGER | 0x0F, /**< A provided file doesn't exist or cannot be accessed in the file system */
+       CKMC_ERROR_NOT_EXPORTABLE           = TIZEN_ERROR_KEY_MANAGER | 0x10, /**< Key is not exportable. It could not be returned to client */
+       CKMC_ERROR_FILE_SYSTEM              = TIZEN_ERROR_KEY_MANAGER | 0x11, /**< Save key/certificate/pkcs12 failed because of file system error */
+       CKMC_ERROR_UNKNOWN                  = TIZEN_ERROR_KEY_MANAGER | 0xFF, /**< The error with unknown reason */
+} key_manager_error_e;
 
 /**
  * @}