2 * Samsung Ukraine R&D Center (SRK under a contract between)
3 * LLC "Samsung Electronics Co", Ltd (Seoul, Republic of Korea)
4 * Copyright (C) 2018 Samsung Electronics Co., Ltd. All rights reserved.
7 * @file policy_enforce.h
8 * @brief Policy group agregator
9 * @date Created Jul 01, 2016
10 * @author Mail to: <A HREF="mailto:a.volkov@samsung.com">Aleksey Volkov, a.volkov@samsung.com</A>
13 #ifndef POLICY_ENFORCE_H
14 #define POLICY_ENFORCE_H
19 #include <jsoncpp/json/value.h>
28 using IPolicyPtr = IPolicy*;
32 * @brief Map of policy appliers instances
34 using PolicyMap = std::map<std::string, IPolicyPtr>;
37 * @class PolicyEnforce
38 * @brief Parses Policy Config xml string and apply policy groups to related parsers
44 * @brief Return enum type for PolicyEnforce errors and policy appliers
47 SUCCESS = 0, /**< Success result */
48 ERROR_PARSING, /**< json data parsing error */
49 ERROR_TYPE, /**< Invalid policy type */
50 ERROR_DATA, /**< Empty or invalid policy data array */
51 ERROR_DPM, /**< Error recived from DPM modules */
52 ERROR_UNKNOWN, /**< Other errors */
56 * @brief Singleton instance recieving method
57 * @return Link to PolicyEnforce instance
59 static PolicyEnforce& GetInstance();
62 * @brief Register policy applier object instance for defined policy
63 * @param policy_name [in] name of the policy
64 * @param policy_applier [in] pointer to the applier instance
66 void registerPolicy(const std::string& policy_name, IPolicyPtr policy_applier);
69 * @brief Parse policy and apply policy nodes to related policy appliers instances
70 * @param policy [in] JSON string with policy configuration
73 Result applyPolicy(const std::string& jsonString);
76 * @brief Parse policy and receive policy states
77 * @param policy [in/out] JSON object with policy configuration
80 Result getStates(Json::Value& policy);
88 * @brief Copy constructor
90 PolicyEnforce(const PolicyEnforce&) = delete;
95 virtual ~PolicyEnforce();
98 * @brief Copy operator
100 PolicyEnforce& operator=(const PolicyEnforce&) = delete;
102 PolicyMap m_policy_map;
110 #endif // POLICY_ENFORCE_H