summaryrefslogtreecommitdiff
path: root/implementation/e2e_protection/include/e2e/profile/profile01
diff options
context:
space:
mode:
authorJuergen Gehring <juergen.gehring@bmw.de>2017-06-19 08:03:41 -0700
committerJuergen Gehring <juergen.gehring@bmw.de>2017-06-19 08:03:41 -0700
commitcf67875117ef7b1b9a25fe1f23e8b7ba1197c934 (patch)
treee6cb18195024eccf224ffd270a924aabf2768285 /implementation/e2e_protection/include/e2e/profile/profile01
parent5315798ff81796217b55eb8c622f154bb0a1c487 (diff)
downloadvSomeIP-cf67875117ef7b1b9a25fe1f23e8b7ba1197c934.tar.gz
vSomeIP 2.6.32.6.3
Diffstat (limited to 'implementation/e2e_protection/include/e2e/profile/profile01')
-rw-r--r--implementation/e2e_protection/include/e2e/profile/profile01/checker.hpp37
-rw-r--r--implementation/e2e_protection/include/e2e/profile/profile01/profile_01.hpp52
-rw-r--r--implementation/e2e_protection/include/e2e/profile/profile01/protector.hpp36
3 files changed, 125 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..bc97f0d
--- /dev/null
+++ b/implementation/e2e_protection/include/e2e/profile/profile01/checker.hpp
@@ -0,0 +1,37 @@
+// 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 E2E_PROFILE_PROFILE01_CHECKER_HPP
+#define E2E_PROFILE_PROFILE01_CHECKER_HPP
+
+#include "../profile01/profile_01.hpp"
+#include "../profile_interface/checker.hpp"
+
+namespace e2e {
+namespace profile {
+namespace profile01 {
+
+class profile_01_checker final : public e2e::profile::profile_interface::checker {
+
+ public:
+ profile_01_checker(void) = delete;
+
+ // [SWS_E2E_00389] initialize state
+ explicit profile_01_checker(const Config &_config) :
+ config(_config) {}
+
+ virtual void check(const buffer::e2e_buffer &_buffer,
+ e2e::profile::profile_interface::generic_check_status &_generic_check_status) override final;
+
+private:
+ Config config;
+ std::mutex check_mutex;
+
+};
+}
+}
+}
+
+#endif
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..4574ca3
--- /dev/null
+++ b/implementation/e2e_protection/include/e2e/profile/profile01/profile_01.hpp
@@ -0,0 +1,52 @@
+// 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 E2E_PROFILE_PROFILE01_PROFILE01_HPP
+#define E2E_PROFILE_PROFILE01_PROFILE01_HPP
+
+#include <cstdint>
+#include "../../../buffer/buffer.hpp"
+
+namespace e2e {
+namespace profile {
+namespace profile01 {
+
+struct Config;
+
+class profile_01 {
+ public:
+ static uint8_t compute_crc(const Config &_config, const buffer::e2e_buffer &_buffer);
+
+ static bool is_buffer_length_valid(const Config &_config, const buffer::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 Config {
+ // [SWS_E2E_00018]
+ uint16_t crc_offset;
+ uint16_t data_id;
+ p01_data_id_mode data_id_mode;
+ uint16_t data_length;
+
+#ifndef E2E_DEVELOPMENT
+ Config() = delete;
+#else
+ Config() = default;
+#endif
+ Config(uint16_t _crc_offset, uint16_t _data_id, p01_data_id_mode _data_id_mode, uint16_t _data_length)
+
+ : crc_offset(_crc_offset), data_id(_data_id),
+ data_id_mode(_data_id_mode), data_length(_data_length) {
+ }
+ Config(const Config &_config) = default;
+ Config &operator=(const Config &_config) = default;
+};
+}
+}
+}
+
+#endif
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..7c10f25
--- /dev/null
+++ b/implementation/e2e_protection/include/e2e/profile/profile01/protector.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 E2E_PROFILE_PROFILE01_PROTECTOR_HPP
+#define E2E_PROFILE_PROFILE01_PROTECTOR_HPP
+
+#include <mutex>
+#include "../profile01/profile_01.hpp"
+#include "../profile_interface/protector.hpp"
+
+namespace e2e {
+namespace profile {
+namespace profile01 {
+
+class protector final : public e2e::profile::profile_interface::protector {
+ public:
+ protector(void) = delete;
+
+ explicit protector(const Config &_config) : config(_config){};
+
+ void protect(buffer::e2e_buffer &_buffer) override final;
+
+ private:
+
+ void write_crc(buffer::e2e_buffer &_buffer, uint8_t _computed_crc);
+
+ private:
+ Config config;
+ std::mutex protect_mutex;
+};
+}
+}
+}
+#endif