epan: use json_dumper for json outputs.
[metze/wireshark/wip.git] / wsutil / crc7.h
1 /*
2  * crc7.h
3  *
4  * Functions and types for CRC checks.
5  *
6  * Wireshark - Network traffic analyzer
7  * By Gerald Combs <gerald@wireshark.org>
8  * Copyright 1998 Gerald Combs
9  *
10  * SPDX-License-Identifier: GPL-2.0-or-later
11  *
12  * Generated on Wed Jul 11 17:24:57 2012,
13  * by pycrc v0.7.10, http://www.tty1.net/pycrc/
14  * using the configuration:
15  *    Width        = 7
16  *    Poly         = 0x45
17  *    XorIn        = 0x00
18  *    ReflectIn    = False
19  *    XorOut       = 0x00
20  *    ReflectOut   = False
21  *    Algorithm    = table-driven
22  ****************************************************************************
23  */
24 #ifndef __CRC7__H__
25 #define __CRC7__H__
26
27 #include "ws_symbol_export.h"
28
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32
33
34 /**
35  * The definition of the used algorithm.
36  *****************************************************************************/
37 #define CRC_ALGO_TABLE_DRIVEN 1
38
39 /**
40  * Calculate the initial crc value.
41  *
42  * \return     The initial crc value.
43  *****************************************************************************/
44 static inline guint8 crc7init(void)
45 {
46     return 0x00 << 1;
47 }
48
49
50 /**
51  * Update the crc value with new data.
52  *
53  * \param crc      The current crc value.
54  * \param data     Pointer to a buffer of \a data_len bytes.
55  * \param data_len Number of bytes in the \a data buffer.
56  * \return         The updated crc value.
57  *****************************************************************************/
58 WS_DLL_PUBLIC guint8 crc7update(guint8 crc, const unsigned char *data, int data_len);
59
60
61 /**
62  * Calculate the final crc value.
63  *
64  * \param crc  The current crc value.
65  * \return     The final crc value.
66  *****************************************************************************/
67 static inline guint8 crc7finalize(guint8 crc)
68 {
69     return (crc >> 1) ^ 0x00;
70 }
71
72
73 #ifdef __cplusplus
74 }           /* closing brace for extern "C" */
75 #endif
76
77 #endif      /* __CRC7__H__ */