Wireshark  2.9.0-477-g68ec514b
The Wireshark network protocol analyzer
crc16-plain.h
Go to the documentation of this file.
1 /*
2  * crc16-plain.h
3  * http://www.tty1.net/pycrc/faq_en.html#code-ownership
4  *
5  * Wireshark - Network traffic analyzer
6  * By Gerald Combs <gerald@wireshark.org>
7  * Copyright 1998 Gerald Combs
8  *
9  * SPDX-License-Identifier: GPL-2.0-or-later
10  */
11 
31 #ifndef __CRC____PLAIN_H__
32 #define __CRC____PLAIN_H__
33 
34 #include "ws_symbol_export.h"
35 
36 #include <glib.h>
37 #include <stdlib.h>
38 
39 #ifdef __cplusplus
40 extern "C" {
41 #endif
42 
46 #define CRC_ALGO_TABLE_DRIVEN 1
47 
53 typedef guint16 crc16_plain_t;
54 
62 long crc16_plain_reflect(long data, size_t data_len);
63 
69 static inline crc16_plain_t crc16_plain_init(void)
70 {
71  return 0x0000;
72 }
73 
82 WS_DLL_PUBLIC
83 crc16_plain_t crc16_plain_update(crc16_plain_t crc, const unsigned char *data, size_t data_len);
84 
91 static inline crc16_plain_t crc16_plain_finalize(crc16_plain_t crc)
92 {
93  return crc ^ 0x0000;
94 }
95 
96 /* Generated on Tue Jul 24 09:08:46 2012,
97  * by pycrc v0.7.10, http://www.tty1.net/pycrc/
98  * using the configuration:
99  * Width = 16
100  * Poly = 0x8005
101  * XorIn = 0x0000
102  * ReflectIn = False
103  * XorOut = 0x0000
104  * ReflectOut = False
105  * Algorithm = table-driven
106  *
107  * Calculate the crc-16 (x^16 + x^15 + x^2 + 1) value for data. Note that this
108  * CRC is not equal to crc16_plain.
109  *
110  * \param data Pointer to a buffer of \a data_len bytes.
111  * \param data_len Number of bytes in the \a data buffer.
112  * \return The crc value.
113  *****************************************************************************/
114 WS_DLL_PUBLIC
115 guint16 crc16_8005_noreflect_noxor(const guint8 *data, guint64 data_len);
116 
117 
118 #ifdef __cplusplus
119 } /* closing brace for extern "C" */
120 #endif
121 
122 #endif /* __CRC____PLAIN_H__ */
long crc16_plain_reflect(long data, size_t data_len)
Definition: crc16-plain.c:79
guint16 crc16_plain_t
Definition: crc16-plain.h:53
WS_DLL_PUBLIC guint16 crc16_8005_noreflect_noxor(const guint8 *data, guint64 data_len)
Definition: crc16-plain.c:169
WS_DLL_PUBLIC crc16_plain_t crc16_plain_update(crc16_plain_t crc, const unsigned char *data, size_t data_len)
Definition: crc16-plain.c:102