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_PROFILE04_HPP 7 #define VSOMEIP_V3_E2E_PROFILE04_PROFILE04_HPP 8 9 #include <cstdint> 10 11 #include <vsomeip/defines.hpp> 12 13 #include "../../../buffer/buffer.hpp" 14 15 // The MSB of the dataID is the instance identifier. 16 // Therefore, the instance identifier must fit into a single byte. 17 #define VSOMEIP_E2E_PROFILE04_MAX_INSTANCE 0x00ff 18 19 namespace vsomeip_v3 { 20 namespace e2e { 21 namespace profile04 { 22 23 struct profile_config; 24 25 class profile_04 { 26 public: 27 static uint32_t compute_crc(const profile_config &_config, const e2e_buffer &_buffer); 28 }; 29 30 // [SWS_E2E_00200] 31 struct profile_config { 32 profile_config() = delete; 33 profile_configvsomeip_v3::e2e::profile04::profile_config34 profile_config(uint32_t _data_id, size_t _offset, 35 size_t _min_data_length, size_t _max_data_length, 36 uint16_t _max_delta_counter) 37 : data_id_(_data_id), offset_(_offset), 38 min_data_length_(_min_data_length), max_data_length_(_max_data_length), 39 max_delta_counter_(_max_delta_counter), 40 base_(VSOMEIP_SOMEIP_HEADER_SIZE) { 41 } 42 profile_config(const profile_config &_config) = default; 43 profile_config &operator=(const profile_config &_config) = default; 44 45 // [SWS_E2E_00334] 46 uint32_t data_id_; 47 size_t offset_; // This must be configured in bit but as a multiple of 8. 48 // As we must use it as an index, we do the math once at 49 // configuration time and use the correct data type here. 50 // Thus, this value is always the byte where the CRC starts. 51 size_t min_data_length_; 52 size_t max_data_length_; 53 uint16_t max_delta_counter_; 54 55 // SOME/IP base 56 size_t base_; 57 }; 58 59 } // namespace profile_04 60 } // namespace e2e 61 } // namespace vsomeip_v3 62 63 #endif // VSOMEIP_V3_E2E_PROFILE04_PROFILE04_HPP 64