summaryrefslogtreecommitdiff
path: root/epan/crc32-tvb.c
diff options
context:
space:
mode:
authorAnders Broman <anders.broman@ericsson.com>2012-03-13 08:57:04 +0000
committerAnders Broman <anders.broman@ericsson.com>2012-03-13 08:57:04 +0000
commit45c342dfdb999404e356724ca8b594af3529a0a7 (patch)
tree2ecfd3bf12ce2d4a345ab9280a92db6066f6719c /epan/crc32-tvb.c
parentbb611755e98a63e40357723cfa53b2cbd263dd3f (diff)
downloadwireshark-45c342dfdb999404e356724ca8b594af3529a0a7.tar.gz
From Weston Schmidt:
Update packet-mpeg-sect to support CRCs & simpler header processing for subdissectors. https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=6941 svn path=/trunk/; revision=41523
Diffstat (limited to 'epan/crc32-tvb.c')
-rw-r--r--epan/crc32-tvb.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/epan/crc32-tvb.c b/epan/crc32-tvb.c
index 91cd7c13f2..7df0f38520 100644
--- a/epan/crc32-tvb.c
+++ b/epan/crc32-tvb.c
@@ -105,3 +105,33 @@ crc32_802_tvb(tvbuff_t *tvb, guint len)
return ( c_crc );
}
+
+guint32
+crc32_mpeg2_tvb_offset_seed(tvbuff_t *tvb, guint offset,
+ guint len, guint32 seed)
+{
+ const guint8* buf;
+
+ tvb_ensure_bytes_exist(tvb, offset, len); /* len == -1 not allowed */
+ buf = tvb_get_ptr(tvb, offset, len);
+
+ return ( crc32_mpeg2_seed(buf, len, seed) );
+}
+
+guint32
+crc32_mpeg2_tvb(tvbuff_t *tvb, guint len)
+{
+ return ( crc32_mpeg2_tvb_offset_seed(tvb, 0, len, CRC32_MPEG2_SEED) );
+}
+
+guint32
+crc32_mpeg2_tvb_offset(tvbuff_t *tvb, guint offset, guint len)
+{
+ return ( crc32_mpeg2_tvb_offset_seed(tvb, offset, len, CRC32_MPEG2_SEED) );
+}
+
+guint32
+crc32_mpeg2_tvb_seed(tvbuff_t *tvb, guint len, guint32 seed)
+{
+ return ( crc32_mpeg2_tvb_offset_seed(tvb, 0, len, seed) );
+}