From 4b0a6ca955e0807354af2a0a67f5ef3ae4f91ebe Mon Sep 17 00:00:00 2001 From: Michael Mann Date: Wed, 31 Oct 2012 20:09:05 +0000 Subject: Add CRC verification to Modbus RTU dissector. CRC algorithm is the same as the "crc16-plain" with a different initial CRC (0xFFFF instead of 0). Created crc16_plain_tvb_offset_seed to "replace" crc16_plain_tvb_offset, but didn't remove crc16_plain_tvb_offset for backwards compatibility worries. Updated only dissector that used crc16_plain_tvb_offset (profinet/packet-pn-rt.c) to use crc16_plain_tvb_offset_seed(..., 0) svn path=/trunk/; revision=45854 --- epan/crc16-tvb.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'epan/crc16-tvb.h') diff --git a/epan/crc16-tvb.h b/epan/crc16-tvb.h index 0a49bda326..bad28217e3 100644 --- a/epan/crc16-tvb.h +++ b/epan/crc16-tvb.h @@ -86,6 +86,22 @@ extern guint16 crc16_ccitt_tvb_offset_seed(tvbuff_t *tvb, guint offset, @return The CRC16 checksum. */ extern guint16 crc16_plain_tvb_offset(tvbuff_t *tvb, guint offset, guint len); +/** Compute the "plain" CRC16 checksum of a tv buffer using the following + * parameters: + * Width = 16 + * Poly = 0x8005 + * XorIn = 0x0000 + * ReflectIn = True + * XorOut = 0x0000 + * ReflectOut = True + * Algorithm = table-driven + * Direct = True + @param tvb The tv buffer containing the data. + @param offset The offset into the tv buffer. + @param len The number of bytes to include in the computation. + @param crc Starting CRC value + @return The CRC16 checksum. */ +extern guint16 crc16_plain_tvb_offset_seed(tvbuff_t *tvb, guint offset, guint len, guint16 crc); #ifdef __cplusplus } -- cgit v1.2.3