| Wireshark 4.7.3 The Wireshark network protocol analyzer

Loading...
Searching...
No Matches
crc16-plain.h
Go to the documentation of this file.
1
10
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
81WS_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
114WS_DLL_PUBLIC
115uint16_t crc16_8005_noreflect_noxor(const uint8_t *data, uint64_t data_len);
116
117
118#ifdef __cplusplus
119} /* closing brace for extern "C" */
120#endif
121
122#endif /* __CRC____PLAIN_H__ */
crc16_plain_reflect
long crc16_plain_reflect(long data, size_t data_len)
Reflect all bits of a data word of data_len bytes.
Definition crc16-plain.c:79
crc16_plain_t
uint16_t crc16_plain_t
Definition crc16-plain.h:52
crc16_8005_noreflect_noxor
WS_DLL_PUBLIC uint16_t crc16_8005_noreflect_noxor(const uint8_t *data, uint64_t data_len)
Calculate the crc-16 (x^16 + x^15 + x^2 + 1) value for data. Note that this CRC is not equal to crc16...
Definition crc16-plain.c:169
crc16_plain_update
WS_DLL_PUBLIC crc16_plain_t crc16_plain_update(crc16_plain_t crc, const unsigned char *data, size_t data_len)
Update the crc value with new data.
Definition crc16-plain.c:102