2 * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 * @author Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
19 * @brief Definition of types, constants and functions common for both tests and plugins
22 #ifndef CYNARA_TEST_PLUGINS_H
23 #define CYNARA_TEST_PLUGINS_H
30 #include <cynara-plugin.h>
31 #include <cynara/types/PolicyDescription.h>
32 #include <cynara/types/PolicyType.h>
34 namespace CynaraTestPlugins {
36 typedef std::vector<Cynara::PolicyDescription> Descriptions;
37 typedef std::pair<std::string, Descriptions> DescriptionsPair;
38 typedef std::map<std::string, Descriptions> DescriptionsMap;
40 static const std::string TEST_PLUGIN_PATH("/usr/lib/security-tests/cynara-tests/plugins/");
42 static const std::string DEFAULT_POLICY("");
43 static const std::string SINGLE_POLICY("single-policy");
44 static const std::string MULTIPLE_POLICY("multiple-policy");
45 static const std::string TEST_AGENT("test-agent");
47 static const DescriptionsMap POLICY_DESCRIPTIONS = {
48 DescriptionsPair(DEFAULT_POLICY, {
49 { Cynara::PredefinedPolicyType::DENY, "Deny" },
50 { Cynara::PredefinedPolicyType::ALLOW, "Allow" },
52 DescriptionsPair(SINGLE_POLICY, {
53 { 2001, "Single Policy Type 1" }
55 DescriptionsPair(MULTIPLE_POLICY, {
56 { 3001, "Multiple Policy Type 1" },
57 { 3002, "Multiple Policy Type 2" },
58 { 3003, "Multiple Policy Type 3" },
60 DescriptionsPair(TEST_AGENT, {
61 { 4001, "Test Agent Type 1" }
65 static const std::string TEST_AGENT_TYPE("SecurityCynaraTestsAgentType");
67 static const std::string AGENT_DATA_UNIT_SEPARATOR("\31");
68 static const std::string AGENT_DATA_RECORD_SEPARATOR("\30");
69 static const std::string AGENT_DATA_ALLOW("Allow");
70 static const std::string AGENT_DATA_DENY("Deny");
72 typedef std::vector<std::string> AgentDataVector;
74 Cynara::PluginData wrapAgentData(const AgentDataVector &data);
75 bool unwrapAgentData(const Cynara::PluginData &wrappedData, AgentDataVector& data);
77 } // namespace CynaraTestPlugins
79 #endif // CYNARA_TEST_PLUGINS_H