summaryrefslogtreecommitdiff
path: root/implementation/e2e_protection/include/crc/crc.hpp
blob: de0ccec1bb2fe3e52cf24fca035d58195b4e37f4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// Copyright (C) 2014-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/.

#ifndef VSOMEIP_V3_E2E_CRC_HPP
#define VSOMEIP_V3_E2E_CRC_HPP

#include <cstdint>
#include "../buffer/buffer.hpp"

namespace vsomeip_v3 {

class e2e_crc {
  public:
    static uint8_t calculate_profile_01(buffer_view _buffer_view,
            const uint8_t _start_value = 0x00U);
    static uint32_t calculate_profile_04(buffer_view _buffer_view,
            const uint32_t _start_value = 0x00000000U);

    static uint32_t calculate_profile_custom(buffer_view _buffer_view);

  private:
    static const uint8_t  lookup_table_profile_01_[256];
    static const uint32_t lookup_table_profile_04_[256];
    static const uint32_t lookup_table_profile_custom_[256];

};

} // namespace vsomeip_v3

#endif // VSOMEIP_V3_E2E_CRC_HPP