aboutsummaryrefslogtreecommitdiffstats
path: root/epan/crc16-tvb.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2014-08-08 08:57:31 -0700
committerGuy Harris <guy@alum.mit.edu>2014-08-08 15:58:06 +0000
commit22ad90cdc8c4487072e2152cbca8112afaeaa59f (patch)
tree868fb343a8dcf01d5ae625f4fa91dc3d3d58c5b1 /epan/crc16-tvb.c
parent8da72cd43dcd597c9f03754831d55211a17f077c (diff)
Add routines for CRC-16 with a polynomial of 0x3D65.
There are routines that take a buffer and a length and that take a tvbuff, offset, and length; use those routines in the DNP dissector (which no longer needs its own table and loop), and use the tvbuff routine instead of calling tvb_get_ptr(). Change-Id: Ic67b0f3b65b94ea47c0fdc2f3d3b6f88df77f9c6 Reviewed-on: https://code.wireshark.org/review/3505 Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'epan/crc16-tvb.c')
-rw-r--r--epan/crc16-tvb.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/epan/crc16-tvb.c b/epan/crc16-tvb.c
index 2b0479c060..10854c4401 100644
--- a/epan/crc16-tvb.c
+++ b/epan/crc16-tvb.c
@@ -122,3 +122,13 @@ guint16 crc16_0x9949_tvb_offset_seed(tvbuff_t *tvb, guint offset, guint len, gui
return crc16_0x9949_seed(buf, len, seed);
}
+
+guint16 crc16_0x3D65_tvb_offset_seed(tvbuff_t *tvb, guint offset, guint len, guint16 seed)
+{
+ const guint8 *buf;
+
+ tvb_ensure_bytes_exist(tvb, offset, len); /* len == -1 not allowed */
+ buf = tvb_get_ptr(tvb, offset, len);
+
+ return crc16_0x3D65_seed(buf, len, seed);
+}