summaryrefslogtreecommitdiff
path: root/implementation/e2e_protection/include/e2e/profile/profile01
diff options
context:
space:
mode:
authorJuergen Gehring <juergen.gehring@bmw.de>2018-05-22 02:56:40 -0700
committerJuergen Gehring <juergen.gehring@bmw.de>2018-05-22 02:56:40 -0700
commit2f0fdc596d24621c2bd4223cc63c8c1fb5b4c2d8 (patch)
tree9bcfdaa7f58c4928b21964e00fdc995929032738 /implementation/e2e_protection/include/e2e/profile/profile01
parent3f591262507bbce2a57e182ef8a1c40951a31018 (diff)
downloadvSomeIP-2f0fdc596d24621c2bd4223cc63c8c1fb5b4c2d8.tar.gz
vsomeip 2.10.112.10.11
Diffstat (limited to 'implementation/e2e_protection/include/e2e/profile/profile01')
-rw-r--r--implementation/e2e_protection/include/e2e/profile/profile01/checker.hpp38
-rw-r--r--implementation/e2e_protection/include/e2e/profile/profile01/profile_01.hpp56
-rw-r--r--implementation/e2e_protection/include/e2e/profile/profile01/protector.hpp46
3 files changed, 140 insertions, 0 deletions
diff --git a/implementation/e2e_protection/include/e2e/profile/profile01/checker.hpp b/implementation/e2e_protection/include/e2e/profile/profile01/checker.hpp
new file mode 100644
index 0000000..5fa243a
--- /dev/null
+++ b/implementation/e2e_protection/include/e2e/profile/profile01/checker.hpp
@@ -0,0 +1,38 @@
+// 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_E2E_PROFILE01_CHECKER_HPP
+#define VSOMEIP_E2E_PROFILE01_CHECKER_HPP
+
+#include "../profile01/profile_01.hpp"
+#include "../profile_interface/checker.hpp"
+
+namespace vsomeip {
+namespace e2e {
+namespace profile01 {
+
+class profile_01_checker final : public e2e::profile_interface::checker {
+
+ public:
+ profile_01_checker(void) = delete;
+
+ // [SWS_E2E_00389] initialize state
+ explicit profile_01_checker(const profile_config &_config) :
+ config_(_config) {}
+
+ virtual void check(const e2e_buffer &_buffer,
+ e2e::profile_interface::generic_check_status &_generic_check_status) override final;
+
+private:
+ profile_config config_;
+ std::mutex check_mutex_;
+
+};
+
+} // namespace profile01
+} // namespace e2e
+} // namespace vsomeip
+
+#endif // VSOMEIP_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
new file mode 100644
index 0000000..810ec56
--- /dev/null
+++ b/implementation/e2e_protection/include/e2e/profile/profile01/profile_01.hpp
@@ -0,0 +1,56 @@
+// 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_E2E_PROFILE01_PROFILE01_HPP
+#define VSOMEIP_E2E_PROFILE01_PROFILE01_HPP
+
+#include <cstdint>
+#include "../../../buffer/buffer.hpp"
+
+namespace vsomeip {
+namespace e2e {
+namespace profile01 {
+
+struct profile_config;
+
+class profile_01 {
+ public:
+ static uint8_t compute_crc(const profile_config &_config, const e2e_buffer &_buffer);
+
+ static bool is_buffer_length_valid(const profile_config &_config, const e2e_buffer &_buffer);
+};
+
+// [SWS_E2E_00200]
+enum class p01_data_id_mode : uint8_t {E2E_P01_DATAID_BOTH, E2E_P01_DATAID_ALT, E2E_P01_DATAID_LOW, E2E_P01_DATAID_NIBBLE};
+
+struct profile_config {
+ // [SWS_E2E_00018]
+ uint16_t crc_offset_;
+ uint16_t data_id_;
+ p01_data_id_mode data_id_mode_;
+ uint16_t data_length_;
+ uint16_t counter_offset_;
+ uint16_t data_id_nibble_offset_;
+
+ profile_config() = delete;
+
+ profile_config(uint16_t _crc_offset, uint16_t _data_id,
+ p01_data_id_mode _data_id_mode, uint16_t _data_length,
+ uint16_t _counter_offset, uint16_t _data_id_nibble_offset)
+
+ : crc_offset_(_crc_offset), data_id_(_data_id),
+ data_id_mode_(_data_id_mode), data_length_(_data_length),
+ counter_offset_(_counter_offset),
+ data_id_nibble_offset_(_data_id_nibble_offset) {
+ }
+ profile_config(const profile_config &_config) = default;
+ profile_config &operator=(const profile_config &_config) = default;
+};
+
+} // namespace profile01
+} // namespace e2e
+} // namespace vsomeip
+
+#endif // VSOMEIP_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
new file mode 100644
index 0000000..204c7a1
--- /dev/null
+++ b/implementation/e2e_protection/include/e2e/profile/profile01/protector.hpp
@@ -0,0 +1,46 @@
+// 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_E2E_PROFILE01_PROTECTOR_HPP
+#define VSOMEIP_E2E_PROFILE01_PROTECTOR_HPP
+
+#include <mutex>
+#include "../profile01/profile_01.hpp"
+#include "../profile_interface/protector.hpp"
+
+namespace vsomeip {
+namespace e2e {
+namespace profile01 {
+
+class protector final : public e2e::profile_interface::protector {
+ public:
+ protector(void) = delete;
+
+ explicit protector(const profile_config &_config) : config_(_config), counter_(0){};
+
+ void protect(e2e_buffer &_buffer) override final;
+
+ private:
+
+ void write_counter(e2e_buffer &_buffer);
+
+ void write_data_id(e2e_buffer &_buffer);
+
+ void write_crc(e2e_buffer &_buffer, uint8_t _computed_crc);
+
+ void increment_counter(void);
+
+
+ private:
+ profile_config config_;
+ uint8_t counter_;
+ std::mutex protect_mutex_;
+};
+
+} // namespace profile01
+} // namespace e2e
+} // namespace vsomeip
+
+#endif // VSOMEIP_E2E_PROFILE01_PROTECTOR_HPP