regen pidl all: rm epan/dissectors/pidl/*-stamp; pushd epan/dissectors/pidl/ && make...
[wireshark-sm.git] / wsutil / crc7.h
blob7364d0431523356732b01dd8a3ec6b2c8a88a11d
1 /** @file
3 * Functions and types for CRC checks.
5 * Wireshark - Network traffic analyzer
6 * By Gerald Combs <gerald@wireshark.org>
7 * Copyright 1998 Gerald Combs
9 * SPDX-License-Identifier: GPL-2.0-or-later
11 * Generated on Wed Jul 11 17:24:57 2012,
12 * by pycrc v0.7.10, http://www.tty1.net/pycrc/
13 * using the configuration:
14 * Width = 7
15 * Poly = 0x45
16 * XorIn = 0x00
17 * ReflectIn = False
18 * XorOut = 0x00
19 * ReflectOut = False
20 * Algorithm = table-driven
21 ****************************************************************************
23 #ifndef __CRC7__H__
24 #define __CRC7__H__
26 #include <wireshark.h>
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
33 /**
34 * The definition of the used algorithm.
35 *****************************************************************************/
36 #define CRC_ALGO_TABLE_DRIVEN 1
38 /**
39 * Calculate the initial crc value.
41 * \return The initial crc value.
42 *****************************************************************************/
43 static inline uint8_t crc7init(void)
45 return 0x00 << 1;
49 /**
50 * Update the crc value with new data.
52 * \param crc The current crc value.
53 * \param data Pointer to a buffer of \a data_len bytes.
54 * \param data_len Number of bytes in the \a data buffer.
55 * \return The updated crc value.
56 *****************************************************************************/
57 WS_DLL_PUBLIC uint8_t crc7update(uint8_t crc, const unsigned char *data, int data_len);
60 /**
61 * Calculate the final crc value.
63 * \param crc The current crc value.
64 * \return The final crc value.
65 *****************************************************************************/
66 static inline uint8_t crc7finalize(uint8_t crc)
68 return (crc >> 1) ^ 0x00;
72 #ifdef __cplusplus
73 } /* closing brace for extern "C" */
74 #endif
76 #endif /* __CRC7__H__ */