summaryrefslogtreecommitdiff
path: root/implementation/e2e_protection/src/e2e
diff options
context:
space:
mode:
Diffstat (limited to 'implementation/e2e_protection/src/e2e')
-rw-r--r--implementation/e2e_protection/src/e2e/profile/e2e_provider_impl.cpp2
-rw-r--r--implementation/e2e_protection/src/e2e/profile/profile01/checker.cpp10
-rw-r--r--implementation/e2e_protection/src/e2e/profile/profile01/profile_01.cpp10
-rw-r--r--implementation/e2e_protection/src/e2e/profile/profile01/protector.cpp10
-rw-r--r--implementation/e2e_protection/src/e2e/profile/profile04/checker.cpp27
-rw-r--r--implementation/e2e_protection/src/e2e/profile/profile04/profile_04.cpp11
-rw-r--r--implementation/e2e_protection/src/e2e/profile/profile04/protector.cpp32
-rw-r--r--implementation/e2e_protection/src/e2e/profile/profile_custom/checker.cpp10
-rw-r--r--implementation/e2e_protection/src/e2e/profile/profile_custom/profile_custom.cpp10
-rw-r--r--implementation/e2e_protection/src/e2e/profile/profile_custom/protector.cpp11
10 files changed, 61 insertions, 72 deletions
diff --git a/implementation/e2e_protection/src/e2e/profile/e2e_provider_impl.cpp b/implementation/e2e_protection/src/e2e/profile/e2e_provider_impl.cpp
index 111e126..0d05fca 100644
--- a/implementation/e2e_protection/src/e2e/profile/e2e_provider_impl.cpp
+++ b/implementation/e2e_protection/src/e2e/profile/e2e_provider_impl.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2017 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// Copyright (C) 2014-2021 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/.
diff --git a/implementation/e2e_protection/src/e2e/profile/profile01/checker.cpp b/implementation/e2e_protection/src/e2e/profile/profile01/checker.cpp
index a5d75d8..d70dac6 100644
--- a/implementation/e2e_protection/src/e2e/profile/profile01/checker.cpp
+++ b/implementation/e2e_protection/src/e2e/profile/profile01/checker.cpp
@@ -1,16 +1,14 @@
-// Copyright (C) 2014-2017 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// Copyright (C) 2014-2021 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/.
-#include "../../../../../e2e_protection/include/e2e/profile/profile01/checker.hpp"
-#include <vsomeip/internal/logger.hpp>
-#include <iostream>
-#include <sstream>
-#include <string>
#include <iomanip>
#include <algorithm>
+#include <vsomeip/internal/logger.hpp>
+#include "../../../../include/e2e/profile/profile01/checker.hpp"
+
namespace vsomeip_v3 {
namespace e2e {
namespace profile01 {
diff --git a/implementation/e2e_protection/src/e2e/profile/profile01/profile_01.cpp b/implementation/e2e_protection/src/e2e/profile/profile01/profile_01.cpp
index 358dd4e..032bac0 100644
--- a/implementation/e2e_protection/src/e2e/profile/profile01/profile_01.cpp
+++ b/implementation/e2e_protection/src/e2e/profile/profile01/profile_01.cpp
@@ -1,14 +1,10 @@
-// Copyright (C) 2014-2017 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// Copyright (C) 2014-2021 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/.
-#include "../../../../../e2e_protection/include/e2e/profile/profile01/profile_01.hpp"
-#include "../../../../../e2e_protection/include/crc/crc.hpp"
-#include <iostream>
-#include <sstream>
-#include <string>
-#include <iomanip>
+#include "../../../../include/e2e/profile/profile01/profile_01.hpp"
+#include "../../../../include/crc/crc.hpp"
namespace vsomeip_v3 {
namespace e2e {
diff --git a/implementation/e2e_protection/src/e2e/profile/profile01/protector.cpp b/implementation/e2e_protection/src/e2e/profile/profile01/protector.cpp
index e5cb4ba..0f514a0 100644
--- a/implementation/e2e_protection/src/e2e/profile/profile01/protector.cpp
+++ b/implementation/e2e_protection/src/e2e/profile/profile01/protector.cpp
@@ -1,16 +1,14 @@
-// Copyright (C) 2014-2017 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// Copyright (C) 2014-2021 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/.
-#include "../../../../../e2e_protection/include/e2e/profile/profile01/protector.hpp"
-#include <vsomeip/internal/logger.hpp>
-#include <iostream>
-#include <sstream>
-#include <string>
#include <iomanip>
+#include <vsomeip/internal/logger.hpp>
+#include "../../../../include/e2e/profile/profile01/protector.hpp"
+
namespace vsomeip_v3 {
namespace e2e {
namespace profile01 {
diff --git a/implementation/e2e_protection/src/e2e/profile/profile04/checker.cpp b/implementation/e2e_protection/src/e2e/profile/profile04/checker.cpp
index c9761ca..88c0192 100644
--- a/implementation/e2e_protection/src/e2e/profile/profile04/checker.cpp
+++ b/implementation/e2e_protection/src/e2e/profile/profile04/checker.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2020 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// Copyright (C) 2020-2021 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/.
@@ -6,10 +6,9 @@
#include <iomanip>
#include <vsomeip/internal/logger.hpp>
-#include "../../utility/include/byteorder.hpp"
-
-#include "../../../../../e2e_protection/include/e2e/profile/profile04/checker.hpp"
+#include "../../../../include/e2e/profile/profile04/checker.hpp"
+#include "../../../../../utility/include/byteorder.hpp"
namespace vsomeip_v3 {
namespace e2e {
@@ -51,10 +50,9 @@ void profile_04_checker::check(const e2e_buffer &_buffer, instance_t _instance,
uint32_t its_data_id(uint32_t(_instance) << 24 | config_.data_id_);
if (its_received_data_id == its_data_id
&& static_cast<size_t>(its_received_length) == _buffer.size()
- && verify_counter(its_received_counter)) {
- _generic_check_status = e2e::profile_interface::generic_check_status::E2E_OK;
+ && verify_counter(_instance, its_received_counter)) {
+ _generic_check_status = e2e::profile_interface::generic_check_status::E2E_OK;
}
- counter_ = its_received_counter;
}
}
}
@@ -72,18 +70,19 @@ profile_04_checker::verify_input(const e2e_buffer &_buffer) const {
}
bool
-profile_04_checker::verify_counter(uint16_t _received_counter) const {
+profile_04_checker::verify_counter(instance_t _instance, uint16_t _received_counter) {
- static bool has_counter(false);
uint16_t its_delta(0);
- if (has_counter) {
- if (counter_ < _received_counter)
- its_delta = uint16_t(_received_counter - counter_);
+ auto find_counter = counter_.find(_instance);
+ if (find_counter != counter_.end()) {
+ uint16_t its_counter = find_counter->second;
+ if (its_counter < _received_counter)
+ its_delta = uint16_t(_received_counter - its_counter);
else
- its_delta = uint16_t(uint16_t(0xffff) - counter_ + _received_counter);
+ its_delta = uint16_t(uint16_t(0xffff) - its_counter + _received_counter);
} else {
- has_counter = true;
+ counter_[_instance] = _received_counter;
}
return (its_delta <= config_.max_delta_counter_);
diff --git a/implementation/e2e_protection/src/e2e/profile/profile04/profile_04.cpp b/implementation/e2e_protection/src/e2e/profile/profile04/profile_04.cpp
index 05ab5e9..43a9380 100644
--- a/implementation/e2e_protection/src/e2e/profile/profile04/profile_04.cpp
+++ b/implementation/e2e_protection/src/e2e/profile/profile04/profile_04.cpp
@@ -1,15 +1,10 @@
-// Copyright (C) 2014-2017 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// Copyright (C) 2014-2021 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/.
-#include <iomanip>
-#include <iostream>
-#include <sstream>
-#include <string>
-
-#include "../../../../../e2e_protection/include/e2e/profile/profile04/profile_04.hpp"
-#include "../../../../../e2e_protection/include/crc/crc.hpp"
+#include "../../../../include/crc/crc.hpp"
+#include "../../../../include/e2e/profile/profile04/profile_04.hpp"
namespace vsomeip_v3 {
namespace e2e {
diff --git a/implementation/e2e_protection/src/e2e/profile/profile04/protector.cpp b/implementation/e2e_protection/src/e2e/profile/profile04/protector.cpp
index a9287f2..bc7d0db 100644
--- a/implementation/e2e_protection/src/e2e/profile/profile04/protector.cpp
+++ b/implementation/e2e_protection/src/e2e/profile/profile04/protector.cpp
@@ -1,14 +1,13 @@
-// Copyright (C) 2020 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// Copyright (C) 2020-2021 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/.
#include <iomanip>
-#include "../../../../../e2e_protection/include/e2e/profile/profile04/protector.hpp"
-
#include <vsomeip/internal/logger.hpp>
-#include "../../utility/include/byteorder.hpp"
+#include "../../../../include/e2e/profile/profile04/protector.hpp"
+#include "../../../../../utility/include/byteorder.hpp"
namespace vsomeip_v3 {
namespace e2e {
@@ -31,7 +30,7 @@ protector::protect(e2e_buffer &_buffer, instance_t _instance) {
write_16(_buffer, static_cast<uint16_t>(_buffer.size()), 0);
/** @req [SWS_E2E_00365] */
- write_16(_buffer, counter_, 2);
+ write_16(_buffer, get_counter(_instance), 2);
/** @req [SWS_E2E_00366] */
uint32_t its_data_id(uint32_t(_instance) << 24 | config_.data_id_);
@@ -44,7 +43,7 @@ protector::protect(e2e_buffer &_buffer, instance_t _instance) {
write_32(_buffer, its_crc, 8);
/** @req [SWS_E2E_00369] */
- increment_counter();
+ increment_counter(_instance);
}
}
@@ -71,9 +70,26 @@ protector::write_32(e2e_buffer &_buffer, uint32_t _data, size_t _index) {
_buffer[config_.offset_ + _index + 3] = VSOMEIP_LONG_BYTE0(_data);
}
+uint16_t
+protector::get_counter(instance_t _instance) const {
+
+ uint16_t its_counter(0);
+
+ auto find_counter = counter_.find(_instance);
+ if (find_counter != counter_.end())
+ its_counter = find_counter->second;
+
+ return (its_counter);
+}
+
void
-protector::increment_counter() {
- counter_++;
+protector::increment_counter(instance_t _instance) {
+
+ auto find_counter = counter_.find(_instance);
+ if (find_counter != counter_.end())
+ find_counter->second++;
+ else
+ counter_[_instance] = 1;
}
} // namespace profile04
diff --git a/implementation/e2e_protection/src/e2e/profile/profile_custom/checker.cpp b/implementation/e2e_protection/src/e2e/profile/profile_custom/checker.cpp
index 9916a2f..bce5af9 100644
--- a/implementation/e2e_protection/src/e2e/profile/profile_custom/checker.cpp
+++ b/implementation/e2e_protection/src/e2e/profile/profile_custom/checker.cpp
@@ -1,16 +1,14 @@
-// Copyright (C) 2014-2017 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// Copyright (C) 2014-2021 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/.
-#include "../../../../../e2e_protection/include/e2e/profile/profile_custom/checker.hpp"
-#include <vsomeip/internal/logger.hpp>
-#include <iostream>
-#include <sstream>
-#include <string>
#include <iomanip>
#include <algorithm>
+#include <vsomeip/internal/logger.hpp>
+#include "../../../../include/e2e/profile/profile_custom/checker.hpp"
+
namespace vsomeip_v3 {
namespace e2e {
namespace profile_custom {
diff --git a/implementation/e2e_protection/src/e2e/profile/profile_custom/profile_custom.cpp b/implementation/e2e_protection/src/e2e/profile/profile_custom/profile_custom.cpp
index 5ab53ca..4e2936e 100644
--- a/implementation/e2e_protection/src/e2e/profile/profile_custom/profile_custom.cpp
+++ b/implementation/e2e_protection/src/e2e/profile/profile_custom/profile_custom.cpp
@@ -1,14 +1,10 @@
-// Copyright (C) 2014-2017 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// Copyright (C) 2014-2021 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/.
-#include "../../../../../e2e_protection/include/e2e/profile/profile_custom/profile_custom.hpp"
-#include "../../../../../e2e_protection/include/crc/crc.hpp"
-#include <iostream>
-#include <sstream>
-#include <string>
-#include <iomanip>
+#include "../../../../include/crc/crc.hpp"
+#include "../../../../include/e2e/profile/profile_custom/profile_custom.hpp"
namespace vsomeip_v3 {
namespace e2e {
diff --git a/implementation/e2e_protection/src/e2e/profile/profile_custom/protector.cpp b/implementation/e2e_protection/src/e2e/profile/profile_custom/protector.cpp
index c71f91f..1fd0ccb 100644
--- a/implementation/e2e_protection/src/e2e/profile/profile_custom/protector.cpp
+++ b/implementation/e2e_protection/src/e2e/profile/profile_custom/protector.cpp
@@ -1,16 +1,9 @@
-// Copyright (C) 2014-2017 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// Copyright (C) 2014-2021 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/.
-#include "../../../../../e2e_protection/include/e2e/profile/profile_custom/protector.hpp"
-
-#include <iostream>
-#include <sstream>
-#include <string>
-#include <iomanip>
-#include <iostream>
-#include <sstream>
+#include "../../../../include/e2e/profile/profile_custom/protector.hpp"
namespace vsomeip_v3 {
namespace e2e {