Integration with CryptoService class.
[platform/core/security/key-manager.git] / src / manager / client / client-error.cpp
1 /* Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd All Rights Reserved
2  *
3  *  Licensed under the Apache License, Version 2.0 (the "License");
4  *  you may not use this file except in compliance with the License.
5  *  You may obtain a copy of the License at
6  *
7  *      http://www.apache.org/licenses/LICENSE-2.0
8  *
9  *  Unless required by applicable law or agreed to in writing, software
10  *  distributed under the License is distributed on an "AS IS" BASIS,
11  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  *  See the License for the specific language governing permissions and
13  *  limitations under the License
14  *
15  *
16  * @file        client-error.cpp
17  * @author      Bartlomiej Grzelewski (b.grzelewski@samsung.com)
18  * @version     1.0
19  * @brief       This file contains example of key-manager client implementation
20  */
21 #include <ckm/ckm-error.h>
22
23 #define ERRORDESCRIBE(name) case name: return #name
24
25 namespace CKM {
26 __attribute__ ((visibility ("default")))
27 const char * ErrorToString(int error) {
28     switch(error) {
29         ERRORDESCRIBE(KEY_MANAGER_API_SUCCESS);
30         ERRORDESCRIBE(KEY_MANAGER_API_ERROR_SOCKET);
31         ERRORDESCRIBE(KEY_MANAGER_API_ERROR_BAD_REQUEST);
32         ERRORDESCRIBE(KEY_MANAGER_API_ERROR_BAD_RESPONSE);
33         ERRORDESCRIBE(KEY_MANAGER_API_ERROR_SEND_FAILED);
34         ERRORDESCRIBE(KEY_MANAGER_API_ERROR_RECV_FAILED);
35         ERRORDESCRIBE(KEY_MANAGER_API_ERROR_AUTHENTICATION_FAILED);
36         ERRORDESCRIBE(KEY_MANAGER_API_ERROR_INPUT_PARAM);
37         ERRORDESCRIBE(KEY_MANAGER_API_ERROR_BUFFER_TOO_SMALL);
38         ERRORDESCRIBE(KEY_MANAGER_API_ERROR_OUT_OF_MEMORY);
39         ERRORDESCRIBE(KEY_MANAGER_API_ERROR_ACCESS_DENIED);
40         ERRORDESCRIBE(KEY_MANAGER_API_ERROR_SERVER_ERROR);
41         ERRORDESCRIBE(KEY_MANAGER_API_ERROR_DB_LOCKED);
42         ERRORDESCRIBE(KEY_MANAGER_API_ERROR_DB_BAD_REQUEST);
43         ERRORDESCRIBE(KEY_MANAGER_API_ERROR_DB_ERROR);
44         ERRORDESCRIBE(KEY_MANAGER_API_ERROR_DB_ALIAS_EXISTS);
45         ERRORDESCRIBE(KEY_MANAGER_API_ERROR_UNKNOWN);
46     default:
47         return "Error not defined";
48     }
49 }
50
51 } // namespace CKM
52