Wireshark  4.3.0
The Wireshark network protocol analyzer
crc16-plain.h
Go to the documentation of this file.
1 
30 #ifndef __CRC____PLAIN_H__
31 #define __CRC____PLAIN_H__
32 
33 #include <stddef.h>
34 #include <stdint.h>
35 
36 #include "ws_symbol_export.h"
37 
38 #ifdef __cplusplus
39 extern "C" {
40 #endif
41 
45 #define CRC_ALGO_TABLE_DRIVEN 1
46 
52 typedef uint16_t crc16_plain_t;
53 
61 long crc16_plain_reflect(long data, size_t data_len);
62 
68 static inline crc16_plain_t crc16_plain_init(void)
69 {
70  return 0x0000;
71 }
72 
81 WS_DLL_PUBLIC
82 crc16_plain_t crc16_plain_update(crc16_plain_t crc, const unsigned char *data, size_t data_len);
83 
90 static inline crc16_plain_t crc16_plain_finalize(crc16_plain_t crc)
91 {
92  return crc ^ 0x0000;
93 }
94 
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:
98  * Width = 16
99  * Poly = 0x8005
100  * XorIn = 0x0000
101  * ReflectIn = False
102  * XorOut = 0x0000
103  * ReflectOut = False
104  * Algorithm = table-driven
105  *
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.
108  *
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  *****************************************************************************/
113 WS_DLL_PUBLIC
114 uint16_t crc16_8005_noreflect_noxor(const uint8_t *data, uint64_t data_len);
115 
116 
117 #ifdef __cplusplus
118 } /* closing brace for extern "C" */
119 #endif
120 
121 #endif /* __CRC____PLAIN_H__ */
long crc16_plain_reflect(long data, size_t data_len)
Definition: crc16-plain.c:79
uint16_t crc16_plain_t
Definition: crc16-plain.h:52
WS_DLL_PUBLIC uint16_t crc16_8005_noreflect_noxor(const uint8_t *data, uint64_t 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