summaryrefslogtreecommitdiff
path: root/implementation/e2e_protection/include/e2e
diff options
context:
space:
mode:
Diffstat (limited to 'implementation/e2e_protection/include/e2e')
-rw-r--r--implementation/e2e_protection/include/e2e/profile/e2e_provider.hpp36
-rw-r--r--implementation/e2e_protection/include/e2e/profile/e2e_provider_impl.hpp67
-rw-r--r--implementation/e2e_protection/include/e2e/profile/profile01/checker.hpp12
-rw-r--r--implementation/e2e_protection/include/e2e/profile/profile01/profile_01.hpp10
-rw-r--r--implementation/e2e_protection/include/e2e/profile/profile01/protector.hpp10
-rw-r--r--implementation/e2e_protection/include/e2e/profile/profile_custom/checker.hpp19
-rw-r--r--implementation/e2e_protection/include/e2e/profile/profile_custom/profile_custom.hpp10
-rw-r--r--implementation/e2e_protection/include/e2e/profile/profile_custom/protector.hpp12
-rw-r--r--implementation/e2e_protection/include/e2e/profile/profile_interface/checker.hpp12
-rw-r--r--implementation/e2e_protection/include/e2e/profile/profile_interface/profile_interface.hpp14
-rw-r--r--implementation/e2e_protection/include/e2e/profile/profile_interface/protector.hpp10
11 files changed, 159 insertions, 53 deletions
diff --git a/implementation/e2e_protection/include/e2e/profile/e2e_provider.hpp b/implementation/e2e_protection/include/e2e/profile/e2e_provider.hpp
new file mode 100644
index 0000000..aa45829
--- /dev/null
+++ b/implementation/e2e_protection/include/e2e/profile/e2e_provider.hpp
@@ -0,0 +1,36 @@
+// Copyright (C) 2014-2017 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// This Source Code Form is subject to the terms of the Mozilla Public
+// License, v. 2.0. If a copy of the MPL was not distributed with this
+// file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+#ifndef VSOMEIP_V3_E2E_PROVIDER_HPP
+#define VSOMEIP_V3_E2E_PROVIDER_HPP
+
+#include <string>
+#include <memory>
+
+#include "../../buffer/buffer.hpp"
+#include "../../e2exf/config.hpp"
+#include "../../../../configuration/include/e2e.hpp"
+#include "profile_interface/profile_interface.hpp"
+
+namespace vsomeip_v3 {
+namespace e2e {
+
+class e2e_provider {
+public:
+ virtual bool add_configuration(std::shared_ptr<cfg::e2e> config) = 0;
+
+ virtual bool is_protected(e2exf::data_identifier_t id) const = 0;
+ virtual bool is_checked(e2exf::data_identifier_t id) const = 0;
+
+ virtual void protect(e2exf::data_identifier_t id, e2e_buffer &_buffer) = 0;
+ virtual void check(e2exf::data_identifier_t id, const e2e_buffer &_buffer,
+ e2e::profile_interface::check_status_t &_generic_check_status) = 0;
+};
+
+} // namespace e2e
+} // namespace vsomeip_v3
+
+#endif // VSOMEIP_V3_E2E_PROVIDER_HPP
+
diff --git a/implementation/e2e_protection/include/e2e/profile/e2e_provider_impl.hpp b/implementation/e2e_protection/include/e2e/profile/e2e_provider_impl.hpp
new file mode 100644
index 0000000..b7d41a6
--- /dev/null
+++ b/implementation/e2e_protection/include/e2e/profile/e2e_provider_impl.hpp
@@ -0,0 +1,67 @@
+// Copyright (C) 2014-2017 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// This Source Code Form is subject to the terms of the Mozilla Public
+// License, v. 2.0. If a copy of the MPL was not distributed with this
+// file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+#ifndef VSOMEIP_V3_E2E_PROVIDER_IMPL_HPP
+#define VSOMEIP_V3_E2E_PROVIDER_IMPL_HPP
+
+#include <map>
+#include <memory>
+
+#include "e2e_provider.hpp"
+#include "profile_interface/checker.hpp"
+#include "profile_interface/protector.hpp"
+
+#include "../../../../../interface/vsomeip/export.hpp"
+#include "../../../../../interface/vsomeip/plugin.hpp"
+
+namespace vsomeip_v3 {
+namespace e2e {
+
+class e2e_provider_impl :
+ public e2e_provider,
+ public plugin_impl<e2e_provider_impl>,
+ public std::enable_shared_from_this<e2e_provider_impl> {
+public:
+ VSOMEIP_EXPORT e2e_provider_impl();
+ VSOMEIP_EXPORT ~e2e_provider_impl();
+
+ VSOMEIP_EXPORT bool add_configuration(std::shared_ptr<cfg::e2e> config) override;
+
+ VSOMEIP_EXPORT bool is_protected(e2exf::data_identifier_t id) const override;
+ VSOMEIP_EXPORT bool is_checked(e2exf::data_identifier_t id) const override;
+
+ VSOMEIP_EXPORT void protect(e2exf::data_identifier_t id, e2e_buffer &_buffer) override;
+ VSOMEIP_EXPORT void check(e2exf::data_identifier_t id, const e2e_buffer &_buffer,
+ profile_interface::check_status_t &_generic_check_status) override;
+
+private:
+ std::map<e2exf::data_identifier_t, std::shared_ptr<profile_interface::protector>> custom_protectors;
+ std::map<e2exf::data_identifier_t, std::shared_ptr<profile_interface::checker>> custom_checkers;
+
+ template<typename config_t>
+ config_t make_e2e_profile_config(const std::shared_ptr<cfg::e2e>& config);
+
+ template<typename config_t, typename checker_t, typename protector_t>
+ void process_e2e_profile(std::shared_ptr<cfg::e2e> config) {
+ const e2exf::data_identifier_t data_identifier = {config->service_id, config->event_id};
+ config_t profile_config = make_e2e_profile_config<config_t>(config);
+
+ std::shared_ptr<e2e::profile_interface::checker> checker;
+ if ((config->variant == "checker") || (config->variant == "both")) {
+ custom_checkers[data_identifier] = std::make_shared<checker_t>(profile_config);
+ }
+
+ std::shared_ptr<e2e::profile_interface::protector> protector;
+ if ((config->variant == "protector") || (config->variant == "both")) {
+ custom_protectors[data_identifier] = std::make_shared<protector_t>(profile_config);
+ }
+ }
+};
+
+} // namespace e2e
+} // namespace vsomeip_v3
+
+#endif // VSOMEIP_V3_E2E_PROVIDER_IMPL_HPP
+
diff --git a/implementation/e2e_protection/include/e2e/profile/profile01/checker.hpp b/implementation/e2e_protection/include/e2e/profile/profile01/checker.hpp
index 5fa243a..3010949 100644
--- a/implementation/e2e_protection/include/e2e/profile/profile01/checker.hpp
+++ b/implementation/e2e_protection/include/e2e/profile/profile01/checker.hpp
@@ -3,13 +3,13 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
-#ifndef VSOMEIP_E2E_PROFILE01_CHECKER_HPP
-#define VSOMEIP_E2E_PROFILE01_CHECKER_HPP
+#ifndef VSOMEIP_V3_E2E_PROFILE01_CHECKER_HPP
+#define VSOMEIP_V3_E2E_PROFILE01_CHECKER_HPP
#include "../profile01/profile_01.hpp"
#include "../profile_interface/checker.hpp"
-namespace vsomeip {
+namespace vsomeip_v3 {
namespace e2e {
namespace profile01 {
@@ -23,7 +23,7 @@ class profile_01_checker final : public e2e::profile_interface::checker {
config_(_config) {}
virtual void check(const e2e_buffer &_buffer,
- e2e::profile_interface::generic_check_status &_generic_check_status) override final;
+ e2e::profile_interface::check_status_t &_generic_check_status) override final;
private:
profile_config config_;
@@ -33,6 +33,6 @@ private:
} // namespace profile01
} // namespace e2e
-} // namespace vsomeip
+} // namespace vsomeip_v3
-#endif // VSOMEIP_E2E_PROFILE01_CHECKER_HPP
+#endif // VSOMEIP_V3_E2E_PROFILE01_CHECKER_HPP
diff --git a/implementation/e2e_protection/include/e2e/profile/profile01/profile_01.hpp b/implementation/e2e_protection/include/e2e/profile/profile01/profile_01.hpp
index 810ec56..c6cd5cf 100644
--- a/implementation/e2e_protection/include/e2e/profile/profile01/profile_01.hpp
+++ b/implementation/e2e_protection/include/e2e/profile/profile01/profile_01.hpp
@@ -3,13 +3,13 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
-#ifndef VSOMEIP_E2E_PROFILE01_PROFILE01_HPP
-#define VSOMEIP_E2E_PROFILE01_PROFILE01_HPP
+#ifndef VSOMEIP_V3_E2E_PROFILE01_PROFILE01_HPP
+#define VSOMEIP_V3_E2E_PROFILE01_PROFILE01_HPP
#include <cstdint>
#include "../../../buffer/buffer.hpp"
-namespace vsomeip {
+namespace vsomeip_v3 {
namespace e2e {
namespace profile01 {
@@ -51,6 +51,6 @@ struct profile_config {
} // namespace profile01
} // namespace e2e
-} // namespace vsomeip
+} // namespace vsomeip_v3
-#endif // VSOMEIP_E2E_PROFILE01_PROFILE01_HPP
+#endif // VSOMEIP_V3_E2E_PROFILE01_PROFILE01_HPP
diff --git a/implementation/e2e_protection/include/e2e/profile/profile01/protector.hpp b/implementation/e2e_protection/include/e2e/profile/profile01/protector.hpp
index 204c7a1..fe8b603 100644
--- a/implementation/e2e_protection/include/e2e/profile/profile01/protector.hpp
+++ b/implementation/e2e_protection/include/e2e/profile/profile01/protector.hpp
@@ -3,14 +3,14 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
-#ifndef VSOMEIP_E2E_PROFILE01_PROTECTOR_HPP
-#define VSOMEIP_E2E_PROFILE01_PROTECTOR_HPP
+#ifndef VSOMEIP_V3_E2E_PROFILE01_PROTECTOR_HPP
+#define VSOMEIP_V3_E2E_PROFILE01_PROTECTOR_HPP
#include <mutex>
#include "../profile01/profile_01.hpp"
#include "../profile_interface/protector.hpp"
-namespace vsomeip {
+namespace vsomeip_v3 {
namespace e2e {
namespace profile01 {
@@ -41,6 +41,6 @@ class protector final : public e2e::profile_interface::protector {
} // namespace profile01
} // namespace e2e
-} // namespace vsomeip
+} // namespace vsomeip_v3
-#endif // VSOMEIP_E2E_PROFILE01_PROTECTOR_HPP
+#endif // VSOMEIP_V3_E2E_PROFILE01_PROTECTOR_HPP
diff --git a/implementation/e2e_protection/include/e2e/profile/profile_custom/checker.hpp b/implementation/e2e_protection/include/e2e/profile/profile_custom/checker.hpp
index 7080329..73f1bbb 100644
--- a/implementation/e2e_protection/include/e2e/profile/profile_custom/checker.hpp
+++ b/implementation/e2e_protection/include/e2e/profile/profile_custom/checker.hpp
@@ -3,27 +3,28 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
-#ifndef VSOMEIP_E2E_PROFILE_CUSTOM_CHECKER_HPP
-#define VSOMEIP_E2E_PROFILE_CUSTOM_CHECKER_HPP
+#ifndef VSOMEIP_V3_E2E_PROFILE_CUSTOM_CHECKER_HPP
+#define VSOMEIP_V3_E2E_PROFILE_CUSTOM_CHECKER_HPP
#include "../profile_custom/profile_custom.hpp"
#include "../profile_interface/checker.hpp"
#include <mutex>
-namespace vsomeip {
+namespace vsomeip_v3 {
namespace e2e {
namespace profile_custom {
-class profile_custom_checker final : public vsomeip::e2e::profile_interface::checker {
+class profile_custom_checker final
+ : public e2e::profile_interface::checker {
- public:
+public:
profile_custom_checker(void) = delete;
- explicit profile_custom_checker(const vsomeip::e2e::profile_custom::profile_config &_config) :
+ explicit profile_custom_checker(const e2e::profile_custom::profile_config &_config) :
config_(_config) {}
virtual void check(const e2e_buffer &_buffer,
- vsomeip::e2e::profile_interface::generic_check_status &_generic_check_status);
+ e2e::profile_interface::check_status_t &_generic_check_status);
private:
uint32_t read_crc(const e2e_buffer &_buffer) const;
@@ -36,6 +37,6 @@ private:
} // namespace profile_custom
} // namespace e2e
-} // namespace vsomeip
+} // namespace vsomeip_v3
-#endif // VSOMEIP_E2E_PROFILE_CUSTOM_CHECKER_HPP
+#endif // VSOMEIP_V3_E2E_PROFILE_CUSTOM_CHECKER_HPP
diff --git a/implementation/e2e_protection/include/e2e/profile/profile_custom/profile_custom.hpp b/implementation/e2e_protection/include/e2e/profile/profile_custom/profile_custom.hpp
index f41942c..1cabefa 100644
--- a/implementation/e2e_protection/include/e2e/profile/profile_custom/profile_custom.hpp
+++ b/implementation/e2e_protection/include/e2e/profile/profile_custom/profile_custom.hpp
@@ -3,13 +3,13 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
-#ifndef VSOMEIP_E2E_PROFILE_CUSTOM_PROFILE_CUSTOM_HPP
-#define VSOMEIP_E2E_PROFILE_CUSTOM_PROFILE_CUSTOM_HPP
+#ifndef VSOMEIP_V3_E2E_PROFILE_CUSTOM_PROFILE_CUSTOM_HPP
+#define VSOMEIP_V3_E2E_PROFILE_CUSTOM_PROFILE_CUSTOM_HPP
#include <cstdint>
#include "../../../buffer/buffer.hpp"
-namespace vsomeip {
+namespace vsomeip_v3 {
namespace e2e {
namespace profile_custom {
@@ -36,6 +36,6 @@ struct profile_config {
} // namespace profile_custom
} // namespace e2e
-} // namespace vsomeip
+} // namespace vsomeip_v3
-#endif // VSOMEIP_E2E_PROFILE_CUSTOM_PROFILE_CUSTOM_HPP
+#endif // VSOMEIP_V3_E2E_PROFILE_CUSTOM_PROFILE_CUSTOM_HPP
diff --git a/implementation/e2e_protection/include/e2e/profile/profile_custom/protector.hpp b/implementation/e2e_protection/include/e2e/profile/profile_custom/protector.hpp
index 4b6c3b4..31b976b 100644
--- a/implementation/e2e_protection/include/e2e/profile/profile_custom/protector.hpp
+++ b/implementation/e2e_protection/include/e2e/profile/profile_custom/protector.hpp
@@ -3,18 +3,18 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
-#ifndef VSOMEIP_E2E_PROFILE_CUSTOM_PROTECTOR_HPP
-#define VSOMEIP_E2E_PROFILE_CUSTOM_PROTECTOR_HPP
+#ifndef VSOMEIP_V3_E2E_PROFILE_CUSTOM_PROTECTOR_HPP
+#define VSOMEIP_V3_E2E_PROFILE_CUSTOM_PROTECTOR_HPP
#include <mutex>
#include "../profile_custom/profile_custom.hpp"
#include "../profile_interface/protector.hpp"
-namespace vsomeip {
+namespace vsomeip_v3 {
namespace e2e {
namespace profile_custom {
-class protector final : public vsomeip::e2e::profile_interface::protector {
+class protector final : public e2e::profile_interface::protector {
public:
protector(void) = delete;
@@ -33,6 +33,6 @@ class protector final : public vsomeip::e2e::profile_interface::protector {
} // namespace profile_custom
} // namespace e2e
-} // namespace vsomeip
+} // namespace vsomeip_v3
-#endif // VSOMEIP_E2E_PROFILE_CUSTOM_PROTECTOR_HPP
+#endif // VSOMEIP_V3_E2E_PROFILE_CUSTOM_PROTECTOR_HPP
diff --git a/implementation/e2e_protection/include/e2e/profile/profile_interface/checker.hpp b/implementation/e2e_protection/include/e2e/profile/profile_interface/checker.hpp
index c66d1b0..f160ea1 100644
--- a/implementation/e2e_protection/include/e2e/profile/profile_interface/checker.hpp
+++ b/implementation/e2e_protection/include/e2e/profile/profile_interface/checker.hpp
@@ -3,25 +3,25 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
-#ifndef VSOMEIP_E2E_PROFILE_INTERFACE_CHECKER_HPP
-#define VSOMEIP_E2E_PROFILE_INTERFACE_CHECKER_HPP
+#ifndef VSOMEIP_V3_E2E_PROFILE_INTERFACE_CHECKER_HPP
+#define VSOMEIP_V3_E2E_PROFILE_INTERFACE_CHECKER_HPP
#include "../profile_interface/profile_interface.hpp"
#include "../../../buffer/buffer.hpp"
#include <mutex>
-namespace vsomeip {
+namespace vsomeip_v3 {
namespace e2e {
namespace profile_interface {
class checker : public profile_interface {
public:
virtual void check(const e2e_buffer &_buffer,
- vsomeip::e2e::profile_interface::generic_check_status &_generic_check_status) = 0;
+ check_status_t &_generic_check_status) = 0;
};
} // namespace profile_interface
} // namespace e2e
-} // namespace vsomeip
+} // namespace vsomeip_v3
-#endif // VSOMEIP_E2E_PROFILE_INTERFACE_CHECKER_HPP
+#endif // VSOMEIP_V3_E2E_PROFILE_INTERFACE_CHECKER_HPP
diff --git a/implementation/e2e_protection/include/e2e/profile/profile_interface/profile_interface.hpp b/implementation/e2e_protection/include/e2e/profile/profile_interface/profile_interface.hpp
index 377bbee..dc72aac 100644
--- a/implementation/e2e_protection/include/e2e/profile/profile_interface/profile_interface.hpp
+++ b/implementation/e2e_protection/include/e2e/profile/profile_interface/profile_interface.hpp
@@ -3,16 +3,18 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
-#ifndef VSOMEIP_E2E_PROFILE_INTERFACE_PROFILE_INTERFACE_HPP
-#define VSOMEIP_E2E_PROFILE_INTERFACE_PROFILE_INTERFACE_HPP
+#ifndef VSOMEIP_V3_E2E_PROFILE_INTERFACE_PROFILE_INTERFACE_HPP
+#define VSOMEIP_V3_E2E_PROFILE_INTERFACE_PROFILE_INTERFACE_HPP
#include <cstdint>
-namespace vsomeip {
+namespace vsomeip_v3 {
namespace e2e {
namespace profile_interface {
-enum class generic_check_status : uint8_t { E2E_OK, E2E_WRONG_CRC, E2E_ERROR};
+typedef uint8_t check_status_t;
+enum generic_check_status : check_status_t { E2E_OK, E2E_WRONG_CRC, E2E_ERROR};
+
class profile_interface {
public:
@@ -22,6 +24,6 @@ public:
} // namespace profile_interface
} // namespace e2e
-} // namespace vsomeip
+} // namespace vsomeip_v3
-#endif // VSOMEIP_E2E_PROFILE_INTERFACE_PROFILE_INTERFACE_HPP
+#endif // VSOMEIP_V3_E2E_PROFILE_INTERFACE_PROFILE_INTERFACE_HPP
diff --git a/implementation/e2e_protection/include/e2e/profile/profile_interface/protector.hpp b/implementation/e2e_protection/include/e2e/profile/profile_interface/protector.hpp
index a031a9e..5bae188 100644
--- a/implementation/e2e_protection/include/e2e/profile/profile_interface/protector.hpp
+++ b/implementation/e2e_protection/include/e2e/profile/profile_interface/protector.hpp
@@ -3,13 +3,13 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
-#ifndef VSOMEIP_E2E_PROFILE_INTERFACE_PROTECTOR_HPP
-#define VSOMEIP_E2E_PROFILE_INTERFACE_PROTECTOR_HPP
+#ifndef VSOMEIP_V3_E2E_PROFILE_INTERFACE_PROTECTOR_HPP
+#define VSOMEIP_V3_E2E_PROFILE_INTERFACE_PROTECTOR_HPP
#include "../../../buffer/buffer.hpp"
#include "../profile_interface/profile_interface.hpp"
-namespace vsomeip {
+namespace vsomeip_v3 {
namespace e2e {
namespace profile_interface {
@@ -20,6 +20,6 @@ class protector : public profile_interface {
} // namespace profile_interface
} // namespace e2e
-} // namespace vsomeip
+} // namespace vsomeip_v3
-#endif // VSOMEIP_E2E_PROFILE_INTERFACE_PROTECTOR_HPP
+#endif // VSOMEIP_V3_E2E_PROFILE_INTERFACE_PROTECTOR_HPP