1 // Copyright (C) 2020 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_PROFILE04_CHECKER_HPP
7 #define VSOMEIP_V3_E2E_PROFILE04_CHECKER_HPP
8 
9 #include "../profile04/profile_04.hpp"
10 #include "../profile_interface/checker.hpp"
11 
12 namespace vsomeip_v3 {
13 namespace e2e {
14 namespace profile04 {
15 
16 class profile_04_checker final : public e2e::profile_interface::checker {
17 
18 public:
19     profile_04_checker(void) = delete;
20 
21     // [SWS_E2E_00389] initialize state
profile_04_checker(const profile_config & _config)22     explicit profile_04_checker(const profile_config &_config) :
23             config_(_config), counter_(0xffff) {}
24 
25     void check(const e2e_buffer &_buffer, instance_t _instance,
26             e2e::profile_interface::check_status_t &_generic_check_status) override final;
27 
28 private:
29     bool verify_input(const e2e_buffer &_buffer) const;
30     bool verify_counter(uint16_t _received_counter) const;
31 
32     bool read_16(const e2e_buffer &_buffer, uint16_t &_data, size_t _index) const;
33     bool read_32(const e2e_buffer &_buffer, uint32_t &_data, size_t _index) const;
34 
35     std::mutex check_mutex_;
36 
37     profile_config config_;
38     uint16_t counter_;
39 };
40 
41 } // namespace profile_04
42 } // namespace e2e
43 } // namespace vsomeip_v3
44 
45 #endif // VSOMEIP_V3_E2E_PROFILE04_CHECKER_HPP
46