Adapt application file labeling to new requirements
[platform/core/security/security-manager.git] / src / common / include / smack-labels.h
index e45b085..1a68f1e 100644 (file)
 
 #include <string>
 #include <utility>
-
-#include "security-manager.h"
+#include <smack-exceptions.h>
+#include <security-manager.h>
 
 namespace SecurityManager {
+namespace SmackLabels {
 
 /**
  * Sets Smack labels on a directory and its contents, recursively.
@@ -40,30 +41,53 @@ namespace SecurityManager {
  * @param path[in] path to a file or directory to setup
  * @param pathType[in] type of path to setup. See description of
  *         app_install_path_type in security-manager.h for details
+ * @param zoneId[in] ID of zone for which label should be set
+ */
+void setupPath(const std::string &pkgId, const std::string &path,
+    app_install_path_type pathType, const std::string &zoneId);
+
+/**
+ * Sets Smack labels on a <ROOT_APP>/<pkg_id> non-recursively
  *
- * @return true on success, false on error.
+ * @param pkgId[in] package identifier
+ * @param basePath[in] <ROOT_APP> path
  */
-bool setupPath(const std::string &pkgId, const std::string &path,
-    app_install_path_type pathType);
+void setupAppBasePath(const std::string &pkgId, const std::string &basePath);
+
+/**
+ * Generates application name for a label fetched from Cynara
+ *
+ * @param[in] label string to fetch application name for
+ * @return application name on success, empty string on error.
+*/
+std::string generateAppNameFromLabel(const std::string &label);
 
 /**
- * Generates label for an application with a specific application ID
- * read from @ref appId and assigns it to @ref label.
+ * Generates label for an application with an application ID read from @ref appId.
  *
  * @param[in] appId application's identifier
- * @param[out] label string in which application's label will be stored
- * @return true on success, false on error.
+ * @return resulting Smack label
 */
-bool generateAppLabel(const std::string &appId, std::string &label);
+std::string generateAppLabel(const std::string &appId);
+
+/**
+ * Generates label for an application with a package ID read from @ref pkgId.
+ *
+ * @param[in] pkgId
+ * @return resulting Smack label
+ */
+std::string generatePkgLabel(const std::string &pkgId);
+
 /**
- * Generates label for an application with a package ID
- * read from @ref appPkgId and assigns it to @ref label.
+ * Generates label for private application RO files with package ID @ref pkgId
  *
  * @param[in] pkgId
- * @param[out] label
- * @return true on success, false on error.
+ * @return resulting Smack label
  */
-bool generatePkgLabel(const std::string &pkgId, std::string &label);
+std::string generatePkgROLabel(const std::string &pkgId);
+
+
+} // namespace SmackLabels
 } // namespace SecurityManager
 
 #endif /* _SMACK_LABELS_H_ */