aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--epan/crc8-tvb.c13
-rw-r--r--epan/crc8-tvb.h5
2 files changed, 16 insertions, 2 deletions
diff --git a/epan/crc8-tvb.c b/epan/crc8-tvb.c
index da5affd530..8e7497b4df 100644
--- a/epan/crc8-tvb.c
+++ b/epan/crc8-tvb.c
@@ -61,7 +61,7 @@ static const guint8 crctable[256] = { /*reversed, 8-bit, poly=0x07*/
gboolean check_fcs(tvbuff_t *p, guint8 len, guint8 offset, guint8 received_fcs){
/*Init*/
- guint8 FCS=0xFF;
+ guint8 FCS = 0xFF;
guint8 tmp = 0;
/*len is the number of bytes in the message, p points to message*/
while (len--) {
@@ -82,4 +82,15 @@ gboolean check_fcs(tvbuff_t *p, guint8 len, guint8 offset, guint8 received_fcs){
}
}
+guint8 get_crc8_ieee8023_epon(tvbuff_t *p, guint8 len, guint8 offset) {
+ guint8 FCS = 0x00;
+ guint8 tmp = 0;
+ while (len--) {
+ tmp = FCS^tvb_get_guint8(p,offset);
+ offset++;
+ FCS=crctable[tmp];
+ }
+
+ return FCS;
+}
diff --git a/epan/crc8-tvb.h b/epan/crc8-tvb.h
index 667a1b4354..1d0a632b99 100644
--- a/epan/crc8-tvb.h
+++ b/epan/crc8-tvb.h
@@ -8,7 +8,9 @@
* Polynom: (x^8 + x^2 + x^1 + 1)
*
* 2011 Hans-Christoph Schemmel <hans-christoph.schemmel[AT]cinterion.com>
- *
+ * 2014 Philip Rosenberg-Watt <p.rosenberg-watt[at]cablelabs.com>
+ * + Added CRC-8 for IEEE 802.3 EPON, with shift register initialized to 0x00
+ * See IEEE Std 802.3-2012 Section 5, Clause 65.1.3.2.3.
*
* Wireshark - Network traffic analyzer
* By Gerald Combs <gerald@wireshark.org>
@@ -44,5 +46,6 @@
#define __CRC8_TVB_H__
extern gboolean check_fcs(tvbuff_t *p, guint8 len, guint8 offset, guint8 received_fcs);
+extern guint8 get_crc8_ieee8023_epon(tvbuff_t *p, guint8 len, guint8 offset);
#endif /* __CRC8_TVB_H__ */