Fix smack labeling for lib rpk
[platform/core/appfw/app-installers.git] / src / common / security_registration.h
index 73feb28..cf0ed35 100644 (file)
 #include <sys/types.h>
 
 #include <string>
+#include <vector>
 
-#include "common/context_installer.h"
+#include "common/installer_context.h"
 
 namespace common_installer {
 
-bool RegisterSecurityContext(const std::string& pkg_id,
-                             const boost::filesystem::path& path,
-                             manifest_x* manifest);
-bool UnregisterSecurityContext(const std::string& pkg_id);
+/**
+ * Adapter interface for external Security module.
+ *
+ * Adapter interface for external Security module used for registering
+ * package to security context
+ *
+ * \param context installer context contains necessary information
+ * \param error_message extra/detailed error message
+ *
+ * \return true if success
+ */
+bool RegisterSecurityContextForManifest(
+        const common_installer::InstallerContext* context,
+        std::string* error_message);
+
+/**
+ * Adapter interface for external Security module.
+ *
+ * Adapter interface for external Security module used for unregistering
+ * package from security context
+ *
+ * \param pkg_id pkgid of given package
+ * \param pkg_type type of given package*
+ * \param uid uid
+ * \param manifest pointer to manifest structure
+ * \param error_message extra/detailed error message
+ *
+ * \return true if success
+ */
+bool UnregisterSecurityContextForManifest(const std::string& pkg_id,
+    const std::string& pkg_type, uid_t uid, manifest_x* manifest,
+    std::string* error_message);
+
+/**
+ * Adapter interface for external Security module.
+ *
+ * Adapter interface for external Security module used for unregistering
+ * package from security context
+ *
+ * \param pkg_id pkgid of given package
+ * \param pkg_type type of given package
+ * \param uid uid
+ * \param error_message extra/detailed error message
+ * \param ignore_data_absence optional, default set to false, indicate if
+ *                            failure of querying appids for pkgid should return
+ *                            false or true
+ *
+ * \return true if success
+ */
+bool UnregisterSecurityContextForPkgId(const std::string& pkg_id,
+    const std::string& pkg_type, uid_t uid, std::string* error_message,
+    bool ignore_data_absence = false);
+
+/**
+ * Adapter interface for external Security module.
+ *
+ * Adapter interface for external Security module used for registering
+ * package path to security context
+ *
+ * \param pkg_id pkgid of given package
+ * \param pkg_type pkg type of given package
+ * \param path path for registering
+ * \param uid uid
+ * \param is_readonly_pkg RO package flag
+ * \param error_message extra/detailed error message
+ *
+ * \return true if success
+ */
+bool RegisterSecurityContextForPath(const std::string &pkg_id,
+    const std::string& pkg_type, const boost::filesystem::path& path,
+    uid_t uid, bool is_readonly_pkg, std::string* error_message);
+
+/**
+ * Adapter interface for external Security module.
+ *
+ * Adapter interface for external Security module used for registering
+ * package external paths to security context
+ *
+ * \param pkg_id pkgid of given package
+ * \param pkg_type pkg type of given package
+ * \param path path for registering
+ * \param uid uid
+ * \param error_message extra/detailed error message
+ *
+ * \return true if success
+ */
+bool RegisterSecurityContextForPathExternalOnly(const std::string &pkg_id,
+    const std::string &pkg_type, const boost::filesystem::path& path,
+    uid_t uid, std::string* error_message);
+
+bool HasOwnerRwOtherRoPaths(const boost::filesystem::path& path);
 
 }  // namespace common_installer