aboutsummaryrefslogtreecommitdiffstats
path: root/epan/crc32.h
diff options
context:
space:
mode:
authorstig <stig@f5534014-38df-0310-8fa8-9805f1628bb7>2008-04-12 12:31:53 +0000
committerstig <stig@f5534014-38df-0310-8fa8-9805f1628bb7>2008-04-12 12:31:53 +0000
commitdaeb15669a09afc7edc952c333493809e9b618de (patch)
tree215d99e3cb9d10b3733385f522b6f30463a28b8b /epan/crc32.h
parent7f722226cc6ffa6d7508b84989a358537bf7653c (diff)
From Philip Frey (bug 2420):
Merge of the CRC32C calculation out of packet-iscsi.c and packet-sctp.c into the already existing crc32.c and crc32.h files. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@24930 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'epan/crc32.h')
-rw-r--r--epan/crc32.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/epan/crc32.h b/epan/crc32.h
index b497b04290..8de3148e38 100644
--- a/epan/crc32.h
+++ b/epan/crc32.h
@@ -31,6 +31,28 @@
extern "C" {
#endif /* __cplusplus */
+#define CRC32C_PRELOAD 0xffffffff
+
+/*
+ * Byte swap fix contributed by Dave Wysochanski <davidw@netapp.com>.
+ */
+#define CRC32C_SWAP(crc32c_value) \
+ (((crc32c_value & 0xff000000) >> 24) | \
+ ((crc32c_value & 0x00ff0000) >> 8) | \
+ ((crc32c_value & 0x0000ff00) << 8) | \
+ ((crc32c_value & 0x000000ff) << 24))
+
+#define CRC32C(c,d) (c=(c>>8)^crc32c_table[(c^(d))&0xFF])
+
+extern const guint32 crc32c_table[256];
+
+/** Compute CRC32C checksum of a buffer of data.
+ @param buf The buffer containing the data.
+ @param len The number of bytes to include in the computation.
+ @param crc The preload value for the CRC32C computation.
+ @return The CRC32C checksum. */
+extern guint32 calculate_crc32c(const void *buf, int len, guint32 crc);
+
extern const guint32 crc32_ccitt_table[256];
/** Compute CRC32 CCITT checksum of a buffer of data.