Replace private implemetation with interface.
[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 ckm-manager client implementation
20  */
21 #include <ckm/ckm-error.h>
22 #include <ckm/ckm-type.h>
23
24 #define ERRORDESCRIBE(name) case name: return #name
25
26 namespace CKM {
27 __attribute__ ((visibility ("default")))
28 const char * ErrorToString(int error) {
29     switch(error) {
30         ERRORDESCRIBE(CKM_API_SUCCESS);
31         ERRORDESCRIBE(CKM_API_ERROR_SOCKET);
32         ERRORDESCRIBE(CKM_API_ERROR_BAD_REQUEST);
33         ERRORDESCRIBE(CKM_API_ERROR_BAD_RESPONSE);
34         ERRORDESCRIBE(CKM_API_ERROR_SEND_FAILED);
35         ERRORDESCRIBE(CKM_API_ERROR_RECV_FAILED);
36         ERRORDESCRIBE(CKM_API_ERROR_AUTHENTICATION_FAILED);
37         ERRORDESCRIBE(CKM_API_ERROR_INPUT_PARAM);
38         ERRORDESCRIBE(CKM_API_ERROR_BUFFER_TOO_SMALL);
39         ERRORDESCRIBE(CKM_API_ERROR_OUT_OF_MEMORY);
40         ERRORDESCRIBE(CKM_API_ERROR_ACCESS_DENIED);
41         ERRORDESCRIBE(CKM_API_ERROR_SERVER_ERROR);
42         ERRORDESCRIBE(CKM_API_ERROR_DB_LOCKED);
43         ERRORDESCRIBE(CKM_API_ERROR_DB_ERROR);
44         ERRORDESCRIBE(CKM_API_ERROR_DB_ALIAS_EXISTS);
45         ERRORDESCRIBE(CKM_API_ERROR_DB_ALIAS_UNKNOWN);
46         ERRORDESCRIBE(CKM_API_ERROR_VERIFICATION_FAILED);
47         ERRORDESCRIBE(CKM_API_ERROR_INVALID_FORMAT);
48         ERRORDESCRIBE(CKM_API_ERROR_FILE_ACCESS_DENIED);
49         ERRORDESCRIBE(CKM_API_ERROR_UNKNOWN);
50     default:
51         return "Error not defined";
52     }
53 }
54
55 } // namespace CKM
56