summaryrefslogtreecommitdiff
path: root/src/manager/common/ckm-error.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/manager/common/ckm-error.cpp')
-rw-r--r--src/manager/common/ckm-error.cpp66
1 files changed, 66 insertions, 0 deletions
diff --git a/src/manager/common/ckm-error.cpp b/src/manager/common/ckm-error.cpp
new file mode 100644
index 00000000..520bcbed
--- /dev/null
+++ b/src/manager/common/ckm-error.cpp
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ */
+/*
+ * @file ckm-zero-memory.cpp
+ * @author Tomasz Swierczek (t.swierczek@samsung.com)
+ * @version 1.0
+ */
+
+#include <ckm/ckm-error.h>
+
+namespace CKM {
+
+#define CKM_CODE_DESCRIBE(name) case name: return #name
+const char * APICodeToString(int error) {
+ switch (error) {
+ CKM_CODE_DESCRIBE(CKM_API_SUCCESS);
+ CKM_CODE_DESCRIBE(CKM_API_ERROR_SOCKET);
+ CKM_CODE_DESCRIBE(CKM_API_ERROR_BAD_REQUEST);
+ CKM_CODE_DESCRIBE(CKM_API_ERROR_BAD_RESPONSE);
+ CKM_CODE_DESCRIBE(CKM_API_ERROR_SEND_FAILED);
+ CKM_CODE_DESCRIBE(CKM_API_ERROR_RECV_FAILED);
+ CKM_CODE_DESCRIBE(CKM_API_ERROR_AUTHENTICATION_FAILED);
+ CKM_CODE_DESCRIBE(CKM_API_ERROR_INPUT_PARAM);
+ CKM_CODE_DESCRIBE(CKM_API_ERROR_BUFFER_TOO_SMALL);
+ CKM_CODE_DESCRIBE(CKM_API_ERROR_OUT_OF_MEMORY);
+ CKM_CODE_DESCRIBE(CKM_API_ERROR_ACCESS_DENIED);
+ CKM_CODE_DESCRIBE(CKM_API_ERROR_SERVER_ERROR);
+ CKM_CODE_DESCRIBE(CKM_API_ERROR_DB_LOCKED);
+ CKM_CODE_DESCRIBE(CKM_API_ERROR_DB_ERROR);
+ CKM_CODE_DESCRIBE(CKM_API_ERROR_DB_ALIAS_EXISTS);
+ CKM_CODE_DESCRIBE(CKM_API_ERROR_DB_ALIAS_UNKNOWN);
+ CKM_CODE_DESCRIBE(CKM_API_ERROR_VERIFICATION_FAILED);
+ CKM_CODE_DESCRIBE(CKM_API_ERROR_INVALID_FORMAT);
+ CKM_CODE_DESCRIBE(CKM_API_ERROR_FILE_ACCESS_DENIED);
+ CKM_CODE_DESCRIBE(CKM_API_ERROR_NOT_EXPORTABLE);
+ CKM_CODE_DESCRIBE(CKM_API_ERROR_FILE_SYSTEM);
+ CKM_CODE_DESCRIBE(CKM_API_ERROR_NOT_SUPPORTED);
+ CKM_CODE_DESCRIBE(CKM_API_OCSP_STATUS_GOOD);
+ CKM_CODE_DESCRIBE(CKM_API_OCSP_STATUS_UNSUPPORTED);
+ CKM_CODE_DESCRIBE(CKM_API_OCSP_STATUS_UNKNOWN);
+ CKM_CODE_DESCRIBE(CKM_API_OCSP_STATUS_REVOKED);
+ CKM_CODE_DESCRIBE(CKM_API_OCSP_STATUS_NET_ERROR);
+ CKM_CODE_DESCRIBE(CKM_API_OCSP_STATUS_INVALID_URL);
+ CKM_CODE_DESCRIBE(CKM_API_OCSP_STATUS_INVALID_RESPONSE);
+ CKM_CODE_DESCRIBE(CKM_API_OCSP_STATUS_REMOTE_ERROR);
+ CKM_CODE_DESCRIBE(CKM_API_OCSP_STATUS_INTERNAL_ERROR);
+ CKM_CODE_DESCRIBE(CKM_API_ERROR_UNKNOWN);
+ default: return "Code not defined";
+ }
+}
+#undef CKM_CODE_DESCRIBE
+
+} // namespace CKM