2 * http://www.tty1.net/pycrc/faq_en.html#code-ownership
4 * Wireshark - Network traffic analyzer
5 * By Gerald Combs <gerald@wireshark.org>
6 * Copyright 1998 Gerald Combs
8 * SPDX-License-Identifier: GPL-2.0-or-later
13 * Functions and types for CRC checks.
15 * Generated on Wed Mar 18 14:12:15 2009,
16 * by pycrc v0.7, http://www.tty1.net/pycrc/
17 * using the configuration:
24 * Algorithm = table-driven
27 * Modified 2009-03-16 not to include <stdint.h> as our Win32 environment
28 * appears not to have it; we're using GLib types, instead.
29 *****************************************************************************/
30 #ifndef __CRC____PLAIN_H__
31 #define __CRC____PLAIN_H__
36 #include "ws_symbol_export.h"
43 * The definition of the used algorithm.
44 *****************************************************************************/
45 #define CRC_ALGO_TABLE_DRIVEN 1
48 * The type of the CRC values.
50 * This type must be big enough to contain at least 16 bits.
51 *****************************************************************************/
52 typedef uint16_t crc16_plain_t
;
55 * Reflect all bits of a \a data word of \a data_len bytes.
57 * \param data The data word to be reflected.
58 * \param data_len The width of \a data expressed in number of bits.
59 * \return The reflected data.
60 *****************************************************************************/
61 long crc16_plain_reflect(long data
, size_t data_len
);
64 * Calculate the initial crc value.
66 * \return The initial crc value.
67 *****************************************************************************/
68 static inline crc16_plain_t
crc16_plain_init(void)
74 * Update the crc value with new data.
76 * \param crc The current crc value.
77 * \param data Pointer to a buffer of \a data_len bytes.
78 * \param data_len Number of bytes in the \a data buffer.
79 * \return The updated crc value.
80 *****************************************************************************/
82 crc16_plain_t
crc16_plain_update(crc16_plain_t crc
, const unsigned char *data
, size_t data_len
);
85 * Calculate the final crc value.
87 * \param crc The current crc value.
88 * \return The final crc value.
89 *****************************************************************************/
90 static inline crc16_plain_t
crc16_plain_finalize(crc16_plain_t crc
)
95 /* Generated on Tue Jul 24 09:08:46 2012,
96 * by pycrc v0.7.10, http://www.tty1.net/pycrc/
97 * using the configuration:
104 * Algorithm = table-driven
106 * Calculate the crc-16 (x^16 + x^15 + x^2 + 1) value for data. Note that this
107 * CRC is not equal to crc16_plain.
109 * \param data Pointer to a buffer of \a data_len bytes.
110 * \param data_len Number of bytes in the \a data buffer.
111 * \return The crc value.
112 *****************************************************************************/
114 uint16_t crc16_8005_noreflect_noxor(const uint8_t *data
, uint64_t data_len
);
118 } /* closing brace for extern "C" */
121 #endif /* __CRC____PLAIN_H__ */