Rename /tests to /ckm to align with tizen branch
[platform/core/test/security-tests.git] / src / cynara-tests / plugins / plugins.h
1 /*
2  * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
3  *
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
7  *
8  *        http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16 /**
17  * @file        plugins.h
18  * @author      Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
19  * @brief       Definition of types, constants and functions common for both tests and plugins
20  */
21
22 #ifndef CYNARA_TEST_PLUGINS_H
23 #define CYNARA_TEST_PLUGINS_H
24
25 #include <cstdint>
26 #include <vector>
27 #include <map>
28 #include <string>
29
30 #include <cynara-plugin.h>
31 #include <cynara/types/PolicyDescription.h>
32 #include <cynara/types/PolicyType.h>
33
34 namespace CynaraTestPlugins {
35
36 typedef std::vector<Cynara::PolicyDescription> Descriptions;
37 typedef std::pair<std::string, Descriptions> DescriptionsPair;
38 typedef std::map<std::string, Descriptions> DescriptionsMap;
39
40 static const std::string TEST_PLUGIN_PATH("/usr/lib/security-tests/cynara-tests/plugins/");
41
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");
46
47 static const DescriptionsMap POLICY_DESCRIPTIONS = {
48     DescriptionsPair(DEFAULT_POLICY, {
49         { Cynara::PredefinedPolicyType::DENY, "Deny" },
50         { Cynara::PredefinedPolicyType::ALLOW, "Allow" },
51     }),
52     DescriptionsPair(SINGLE_POLICY, {
53         { 2001, "Single Policy Type 1" }
54     }),
55     DescriptionsPair(MULTIPLE_POLICY, {
56         { 3001, "Multiple Policy Type 1" },
57         { 3002, "Multiple Policy Type 2" },
58         { 3003, "Multiple Policy Type 3" },
59     }),
60     DescriptionsPair(TEST_AGENT, {
61         { 4001, "Test Agent Type 1" }
62     }),
63 };
64
65 static const std::string TEST_AGENT_TYPE("SecurityCynaraTestsAgentType");
66
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");
71
72 typedef std::vector<std::string> AgentDataVector;
73
74 Cynara::PluginData wrapAgentData(const AgentDataVector &data);
75 bool unwrapAgentData(const Cynara::PluginData &wrappedData, AgentDataVector& data);
76
77 } // namespace CynaraTestPlugins
78
79 #endif // CYNARA_TEST_PLUGINS_H