91fbe32a95338078530ce6b649532abca92bb8ec
[platform/core/security/security-manager.git] / src / common / include / protocols.h
1 /*
2  *  Copyright (c) 2000 - 2014 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  *  Contact: Rafal Krypa <r.krypa@samsung.com>
5  *
6  *  Licensed under the Apache License, Version 2.0 (the "License");
7  *  you may not use this file except in compliance with the License.
8  *  You may obtain a copy of the License at
9  *
10  *      http://www.apache.org/licenses/LICENSE-2.0
11  *
12  *  Unless required by applicable law or agreed to in writing, software
13  *  distributed under the License is distributed on an "AS IS" BASIS,
14  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  *  See the License for the specific language governing permissions and
16  *  limitations under the License
17  */
18 /*
19  * @file        protocols.h
20  * @author      Bartlomiej Grzelewski (b.grzelewski@samsung.com)
21  * @version     1.0
22  * @brief       This file contains list of all protocols suported by security-manager.
23  */
24
25 #ifndef _SECURITY_MANAGER_PROTOCOLS_
26 #define _SECURITY_MANAGER_PROTOCOLS_
27
28 #include <vector>
29 #include <string>
30
31 /**
32  * \name Return Codes
33  * exported by the foundation API.
34  * result codes begin with the start error code and extend into negative direction.
35  * @{
36 */
37
38 /*! \brief   indicating the result of the one specific API is successful */
39 #define SECURITY_MANAGER_API_SUCCESS 0
40
41 /*! \brief   indicating the socket between client and Security Manager has been failed  */
42 #define SECURITY_MANAGER_API_ERROR_SOCKET -1
43
44 /*! \brief   indicating the request to Security Manager is malformed */
45 #define SECURITY_MANAGER_API_ERROR_BAD_REQUEST -2
46
47 /*! \brief   indicating the response from Security Manager is malformed */
48 #define SECURITY_MANAGER_API_ERROR_BAD_RESPONSE -3
49
50 /*! \brief   indicating the requested service does not exist */
51 #define SECURITY_MANAGER_API_ERROR_NO_SUCH_SERVICE -4
52
53 /*! \brief   indicating requesting object is not exist */
54 #define SECURITY_MANAGER_API_ERROR_NO_SUCH_OBJECT -6
55
56 /*! \brief   indicating the authentication between client and server has been failed */
57 #define SECURITY_MANAGER_API_ERROR_AUTHENTICATION_FAILED -7
58
59 /*! \brief   indicating the API's input parameter is malformed */
60 #define SECURITY_MANAGER_API_ERROR_INPUT_PARAM -8
61
62 /*! \brief   indicating the output buffer size which is passed as parameter is too small */
63 #define SECURITY_MANAGER_API_ERROR_BUFFER_TOO_SMALL -9
64
65 /*! \brief   indicating system  is running out of memory state */
66 #define SECURITY_MANAGER_API_ERROR_OUT_OF_MEMORY -10
67
68 /*! \brief   indicating the access has been denied by Security Manager */
69 #define SECURITY_MANAGER_API_ERROR_ACCESS_DENIED -11
70
71 /*! \brief   indicating Security Manager has been failed for some reason */
72 #define SECURITY_MANAGER_API_ERROR_SERVER_ERROR -12
73
74 /*! \brief   indicating getting smack label from socket failed  */
75 #define SECURITY_MANAGER_API_ERROR_GETTING_SOCKET_LABEL_FAILED -21
76
77 /*! \brief   indicating getting smack label from file failed  */
78 #define SECURITY_MANAGER_API_ERROR_GETTING_FILE_LABEL_FAILED -22
79
80 /*! \brief   indicating setting smack label for file failed  */
81 #define SECURITY_MANAGER_API_ERROR_SETTING_FILE_LABEL_FAILED -23
82
83 /*! \brief   indicating file already exists  */
84 #define SECURITY_MANAGER_API_ERROR_FILE_EXIST -24
85
86 /*! \brief   indicating file does not exist  */
87 #define SECURITY_MANAGER_API_ERROR_FILE_NOT_EXIST -25
88
89 /*! \brief   indicating file open error  */
90 #define SECURITY_MANAGER_API_ERROR_FILE_OPEN_FAILED -26
91
92 /*! \brief   indicating file creation error  */
93 #define SECURITY_MANAGER_API_ERROR_FILE_CREATION_FAILED -27
94
95 /*! \brief   indicating file deletion error  */
96 #define SECURITY_MANAGER_API_ERROR_FILE_DELETION_FAILED -28
97
98 /*! \brief   indicating the error with unknown reason */
99 #define SECURITY_MANAGER_API_ERROR_UNKNOWN -255
100 /** @}*/
101
102
103 struct app_inst_req {
104     std::string appId;
105     std::string pkgId;
106     std::vector<std::string> privileges;
107     std::vector<std::pair<std::string, int>> appPaths;
108 };
109
110 namespace SecurityManager {
111
112 extern char const * const SERVICE_SOCKET;
113
114 enum class SecurityModuleCall
115 {
116     APP_INSTALL,
117     APP_UNINSTALL,
118     APP_GET_PKGID,
119     APP_GET_GROUPS,
120 };
121
122 } // namespace SecurityManager
123
124 #endif // _SECURITY_MANAGER_PROTOCOLS_