2 * Copyright (c) 2000 - 2014 Samsung Electronics Co., Ltd All Rights Reserved
4 * Contact: Bartlomiej Grzelewski <b.grzelewski@samsung.com>
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
10 * http://www.apache.org/licenses/LICENSE-2.0
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
18 * Security Manager library header
21 * @file security-manager.h
22 * @author Pawel Polawski (p.polawski@samsung.com)
24 * @brief This file contains header of security-manager API
27 #ifndef SECURITY_MANAGER_H_
28 #define SECURITY_MANAGER_H_
30 #include <sys/types.h>
36 /*! \brief return code of API functions */
38 SECURITY_MANAGER_SUCCESS,
39 SECURITY_MANAGER_ERROR_UNKNOWN,
40 SECURITY_MANAGER_ERROR_INPUT_PARAM,
41 SECURITY_MANAGER_ERROR_MEMORY,
42 SECURITY_MANAGER_ERROR_REQ_NOT_COMPLETE
45 /*! \brief accesses types for application installation paths*/
46 enum app_install_path_type {
47 //accessible read-write only for applications with same package id
48 SECURITY_MANAGER_PATH_PRIVATE,
49 //read-write access for all applications
50 SECURITY_MANAGER_PATH_PUBLIC,
51 //read only access for all applications
52 SECURITY_MANAGER_PATH_PUBLIC_RO,
53 //this is only for range limit
54 SECURITY_MANAGER_ENUM_END
57 /*! \brief data structure responsible for handling informations
58 * required to install / uninstall application */
60 typedef struct app_inst_req app_inst_req;
63 * This function is responsible for initialize app_inst_req data structure
64 * It uses dynamic allocation inside and user responsibility is to call
65 * app_inst_req_free() for freeing allocated resources
67 * \param[in] Address of pointer for handle app_inst_req structure
68 * \return API return code or error code
70 int security_manager_app_inst_req_new(app_inst_req **pp_req);
73 * This function is used to free resources allocated by calling app_inst_req_new()
74 * \param[in] Pointer handling allocated app_inst_req structure
76 void security_manager_app_inst_req_free(app_inst_req *p_req);
79 * This function is used to set up application identifier in app_inst_req structure
81 * \param[in] Pointer handling app_inst_req structure
82 * \param[in] Application identifier
83 * \return API return code or error code
85 int security_manager_app_inst_req_set_app_id(app_inst_req *p_req, const char *app_id);
88 * This function is used to set up package identifier in app_inst_req structure
90 * \param[in] Pointer handling app_inst_req structure
91 * \param[in] Package identifier
92 * \return API return code or error code
94 int security_manager_app_inst_req_set_pkg_id(app_inst_req *p_req, const char *pkg_id);
97 * This function is used to add allowed user to app_inst_req structure,
98 * it can be called multiple times
100 * \param[in] Pointer handling app_inst_req structure
101 * \param[in] Privileged user identifier
102 * \return API return code or error code
104 int security_manager_app_inst_req_add_allowed_user(app_inst_req *p_req, const uid_t user_id);
107 * This function is used to add privilege to app_inst_req structure,
108 * it can be called multiple times
110 * \param[in] Pointer handling app_inst_req structure
111 * \param[in] Application privilager
112 * \return API return code or error code
114 int security_manager_app_inst_req_add_privilege(app_inst_req *p_req, const char *privilege);
117 * This function is used to add application path to app_inst_req structure,
118 * it can be called multiple times
120 * \param[in] Pointer handling app_inst_req structure
121 * \param[in] Application path
122 * \param[in] Application path type
123 * \return API return code or error code
125 int security_manager_app_inst_req_add_path(app_inst_req *p_req, const char *path, const int path_type);
128 * This function is used to install application based on
129 * using filled up app_inst_req data structure
131 * \param[in] Pointer handling app_inst_req structure
132 * \return API return code or error code
134 int security_manager_app_install(const app_inst_req *p_req);
137 * This function is used to uninstall application based on
138 * using filled up app_inst_req data structure
140 * \param[in] Pointer handling app_inst_req structure
141 * \return API return code or error code
143 int security_manager_app_uninstall(const app_inst_req *p_req);
150 #endif /* SECURITY_MANAGER_H_ */