9f6f9ccf48e96ef16f37516fc579a17f6a3da960
[platform/core/security/security-server.git] / src / server / common / protocols.h
1 /*
2  *  Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  *  Contact: Bartlomiej Grzelewski <b.grzelewski@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-sever.
23  */
24
25 #ifndef _SECURITY_SERVER_PROTOCOLS_
26 #define _SECURITY_SERVER_PROTOCOLS_
27
28 #include <cstddef>
29 #include <time.h>
30 #include <vector>
31 #include <utility>
32 #include <string>
33
34 struct app_inst_req {
35     std::string appId;
36     std::string pkgId;
37     std::vector<uid_t> allowedUsers;
38     std::vector<std::string> privileges;
39     std::vector<std::pair<std::string, int>> appPaths;
40 };
41
42 namespace SecurityServer {
43
44 extern char const * const SERVICE_SOCKET_SHARED_MEMORY;
45 extern char const * const SERVICE_SOCKET_GET_GID;
46 extern char const * const SERVICE_SOCKET_PRIVILEGE_BY_PID;
47 extern char const * const SERVICE_SOCKET_APP_PRIVILEGE_BY_NAME;
48 extern char const * const SERVICE_SOCKET_COOKIE_GET;
49 extern char const * const SERVICE_SOCKET_COOKIE_CHECK;
50 extern char const * const SERVICE_SOCKET_PASSWD_CHECK;
51 extern char const * const SERVICE_SOCKET_PASSWD_SET;
52 extern char const * const SERVICE_SOCKET_PASSWD_RESET;
53 extern char const * const SERVICE_SOCKET_INSTALLER;
54
55 enum class AppPermissionsAction { ENABLE, DISABLE };
56
57 enum class CookieCall
58 {
59     GET_COOKIE,
60     CHECK_PID,
61     CHECK_SMACKLABEL,
62     CHECK_PRIVILEGE_GID,
63     CHECK_PRIVILEGE,
64     CHECK_GID,
65     CHECK_UID
66 };
67
68 extern const size_t COOKIE_SIZE;
69
70 enum class PasswordHdrs
71 {
72     HDR_IS_PWD_VALID,
73     HDR_CHK_PWD,
74     HDR_SET_PWD,
75     HDR_SET_PWD_VALIDITY,
76     HDR_SET_PWD_MAX_CHALLENGE,
77     HDR_RST_PWD,
78     HDR_SET_PWD_HISTORY
79 };
80
81 enum class SecurityModuleCall
82 {
83     APP_INSTALL,
84     APP_UNINSTALL
85 };
86
87 extern const size_t MAX_PASSWORD_LEN;
88 extern const unsigned int MAX_PASSWORD_HISTORY;
89 extern const unsigned int PASSWORD_INFINITE_EXPIRATION_DAYS;
90 extern const unsigned int PASSWORD_INFINITE_ATTEMPT_COUNT;
91 extern const unsigned int PASSWORD_API_NO_EXPIRATION;
92
93 extern const int SECURITY_SERVER_MAX_OBJ_NAME;
94
95 } // namespace SecuritySever
96
97 #endif // _SECURITY_SERVER_PROTOCOLS_
98