summaryrefslogtreecommitdiff
path: root/implementation/e2e_protection/include/crc/crc.hpp
blob: 1a54312a4f65cf9cdfef6ba2c49dcd493545300e (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-2017 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_E2E_CRC_HPP
#define VSOMEIP_E2E_CRC_HPP

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

namespace vsomeip {

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

#endif // VSOMEIP_E2E_CRC_HPP