diff options
author | Michael Mann <mmann78@netscape.net> | 2012-10-31 20:09:05 +0000 |
---|---|---|
committer | Michael Mann <mmann78@netscape.net> | 2012-10-31 20:09:05 +0000 |
commit | 4b0a6ca955e0807354af2a0a67f5ef3ae4f91ebe (patch) | |
tree | 9ff8367b5fcb4878c9b33f0e641de56c71243c6d /epan/crc16-tvb.h | |
parent | 0c24f376ca2eaa6e8d609b25b3846855ba10c111 (diff) |
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
Diffstat (limited to 'epan/crc16-tvb.h')
-rw-r--r-- | epan/crc16-tvb.h | 16 |
1 files changed, 16 insertions, 0 deletions
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 } |