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_PROFILE_CUSTOM_PROTECTOR_HPP
7 #define VSOMEIP_V3_E2E_PROFILE_CUSTOM_PROTECTOR_HPP
8 
9 #include <mutex>
10 #include "../profile_custom/profile_custom.hpp"
11 #include "../profile_interface/protector.hpp"
12 
13 namespace vsomeip_v3 {
14 namespace e2e {
15 namespace profile_custom {
16 
17 class protector final : public e2e::profile_interface::protector {
18 public:
19     protector(void) = delete;
20 
protector(const profile_config & _config)21     explicit protector(const profile_config &_config) : config_(_config){};
22 
23     void protect(e2e_buffer &_buffer, instance_t _instance) override final;
24 
25 private:
26 
27     void write_crc(e2e_buffer &_buffer, uint32_t _computed_crc);
28 
29 private:
30     profile_config config_;
31     std::mutex protect_mutex_;
32 };
33 
34 } // namespace profile_custom
35 } // namespace e2e
36 } // namespace vsomeip_v3
37 
38 #endif // VSOMEIP_V3_E2E_PROFILE_CUSTOM_PROTECTOR_HPP
39