2 * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
4 * Contact: Rafal Krypa <r.krypa@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
19 * @file smack-labels.h
20 * @author Jan Cybulski <j.cybulski@samsung.com>
21 * @author Rafal Krypa <r.krypa@samsung.com>
23 * @brief Header file of functions managing smack labels
26 #ifndef _SMACK_LABELS_H_
27 #define _SMACK_LABELS_H_
32 #include "security-manager.h"
34 namespace SecurityManager {
37 * Sets Smack labels on a directory and its contents, recursively.
39 * @param appId[in] application's identifier
40 * @param path[in] path to a file or directory to setup
41 * @param pathType[in] type of path to setup. See description of
42 * app_install_path_type in security-manager.h for details
44 * @return true on success, false on error.
46 bool setupPath(const std::string &appId, const std::string &path,
47 app_install_path_type pathType);
50 * Generates application name for a label fetched from Cynara
52 * @param[in] label string to fetch application name for
53 * @return application name on success, empty string on error.
55 std::string generateAppNameFromLabel(const std::string &label);
58 * Sets Smack labels on a <ROOT_APP>/<pkg_id> and <ROOT_APP>/<pkg_id>/<app_id>
61 * @param pkgID[in] package identifier
62 * @param appID[in] application's identifier
63 * @param path[in] <ROOT_APP> path
65 bool setupCorrectPath(const std::string &pkgID, const std::string &appID,
66 const std::string &path);
69 * Generates label for an application with a specific application ID
70 * read from @ref appId and assigns it to @ref label.
72 * @param[in] appId application's identifier
73 * @param[out] label string in which application's label will be stored
74 * @return true on success, false on error.
76 bool generateAppLabel(const std::string &appId, std::string &label);
78 * Generates label for an application with a package ID
79 * read from @ref appPkgId and assigns it to @ref label.
83 * @return true on success, false on error.
85 bool generatePkgLabel(const std::string &pkgId, std::string &label);
86 } // namespace SecurityManager
88 #endif /* _SMACK_LABELS_H_ */