summaryrefslogtreecommitdiff
path: root/implementation/e2e_protection/include/e2e/profile/profile04/protector.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'implementation/e2e_protection/include/e2e/profile/profile04/protector.hpp')
-rw-r--r--implementation/e2e_protection/include/e2e/profile/profile04/protector.hpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/implementation/e2e_protection/include/e2e/profile/profile04/protector.hpp b/implementation/e2e_protection/include/e2e/profile/profile04/protector.hpp
index fd4a6e7..eab0a9a 100644
--- a/implementation/e2e_protection/include/e2e/profile/profile04/protector.hpp
+++ b/implementation/e2e_protection/include/e2e/profile/profile04/protector.hpp
@@ -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,7 +6,9 @@
#ifndef VSOMEIP_V3_E2E_PROFILE04_PROTECTOR_HPP
#define VSOMEIP_V3_E2E_PROFILE04_PROTECTOR_HPP
+#include <map>
#include <mutex>
+
#include "../profile04/profile_04.hpp"
#include "../profile_interface/protector.hpp"
@@ -19,20 +21,21 @@ public:
protector(void) = delete;
explicit protector(const profile_config &_config)
- : config_(_config), counter_(0) {};
+ : config_(_config) {}
void protect(e2e_buffer &_buffer, instance_t _instance) override final;
private:
bool verify_inputs(e2e_buffer &_buffer);
- void increment_counter();
+ uint16_t get_counter(instance_t _instance) const;
+ void increment_counter(instance_t _instance);
void write_16(e2e_buffer &_buffer, uint16_t _data, size_t _index);
void write_32(e2e_buffer &_buffer, uint32_t _data, size_t _index);
private:
profile_config config_;
- uint16_t counter_;
+ std::map<instance_t, uint16_t> counter_;
std::mutex protect_mutex_;
};