1 // Copyright (C) 2014-2017 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) 2 // This Source Code Form is subject to the terms of the Mozilla Public 3 // License, v. 2.0. If a copy of the MPL was not distributed with this 4 // file, You can obtain one at http://mozilla.org/MPL/2.0/. 5 6 #ifndef VSOMEIP_V3_E2E_PROFILE01_PROTECTOR_HPP 7 #define VSOMEIP_V3_E2E_PROFILE01_PROTECTOR_HPP 8 9 #include <mutex> 10 11 #include "../profile01/profile_01.hpp" 12 #include "../profile_interface/protector.hpp" 13 14 namespace vsomeip_v3 { 15 namespace e2e { 16 namespace profile01 { 17 18 class protector final : public e2e::profile_interface::protector { 19 public: 20 protector(void) = delete; 21 protector(const profile_config & _config)22 explicit protector(const profile_config &_config) : config_(_config), counter_(0) {}; 23 24 void protect(e2e_buffer &_buffer, instance_t _instance) override final; 25 26 private: 27 28 void write_counter(e2e_buffer &_buffer); 29 30 void write_data_id(e2e_buffer &_buffer); 31 32 void write_crc(e2e_buffer &_buffer, uint8_t _computed_crc); 33 34 void increment_counter(void); 35 36 private: 37 profile_config config_; 38 uint8_t counter_; 39 std::mutex protect_mutex_; 40 }; 41 42 } // namespace profile01 43 } // namespace e2e 44 } // namespace vsomeip_v3 45 46 #endif // VSOMEIP_V3_E2E_PROFILE01_PROTECTOR_HPP 47