summaryrefslogtreecommitdiffstats
path: root/wsutil/crc5.h
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-10 20:34:10 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-10 20:34:10 +0000
commite4ba6dbc3f1e76890b22773807ea37fe8fa2b1bc (patch)
tree68cb5ef9081156392f1dd62a00c6ccc1451b93df /wsutil/crc5.h
parentInitial commit. (diff)
downloadwireshark-e4ba6dbc3f1e76890b22773807ea37fe8fa2b1bc.tar.xz
wireshark-e4ba6dbc3f1e76890b22773807ea37fe8fa2b1bc.zip
Adding upstream version 4.2.2.upstream/4.2.2
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--wsutil/crc5.h40
1 files changed, 40 insertions, 0 deletions
diff --git a/wsutil/crc5.h b/wsutil/crc5.h
new file mode 100644
index 00000000..4f834d53
--- /dev/null
+++ b/wsutil/crc5.h
@@ -0,0 +1,40 @@
+/** @file
+ * Declaration of CRC-5 routines and table
+ *
+ * 2019 Tomasz Mon <desowin@gmail.com>
+ *
+ * Wireshark - Network traffic analyzer
+ * By Gerald Combs <gerald@wireshark.org>
+ * Copyright 1998 Gerald Combs
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+*/
+
+#ifndef __CRC5_H__
+#define __CRC5_H__
+
+#include <wireshark.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/** Compute the 5-bit CRC value of a input value matching the CRC-5
+ defined in USB 2.0 Specification. This function calculates the CRC
+ on low 11 bits of the input value. High bits are ignored.
+ @param input Source data for which the CRC-5 should be calculated.
+ @return the CRC5 checksum for input value */
+WS_DLL_PUBLIC uint8_t crc5_usb_11bit_input(uint16_t input);
+
+/** Compute the 5-bit CRC value of a input value matching the CRC-5
+ defined in USB 2.0 Specification. This function calculates the CRC
+ on low 19 bits of the input value. High bits are ignored.
+ @param input Source data for which the CRC-5 should be calculated.
+ @return the CRC5 checksum for input value */
+WS_DLL_PUBLIC uint8_t crc5_usb_19bit_input(uint32_t input);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* __CRC5_H__ */