Wireshark-dev: Re: [Wireshark-dev] [Wireshark-commits] rev 27748: /trunk/plugins/profinet/ /tru
From: Guy Harris <[email protected]>
Date: Mon, 16 Mar 2009 16:18:06 -0700
On Mar 16, 2009, at 3:45 PM, Joerg Mayer wrote:

On Mon, Mar 16, 2009 at 09:40:03PM +0000, [email protected] wrote:
http://anonsvn.wireshark.org/viewvc/viewvc.cgi? view=rev&revision=27748
crc16 algorithm copied from Linux sources (GPL V2 only!)
So far the wireshark sources are v2 or later - so adding a gplv2  
only file
is not something that should be done without asking *first*, because  
has effects for all of Wireshark. Or maybe there already were files  
are v2 only and I missed that?
Is the only difference between the CRC16 in PROFINET and the ITU-T  
CRC16 implemented in epan/crc16.c the polynomial?  It looks as if the  
algorithm is the same in the PROFINET CRC16 and the "reflected" ITU-T  
	crc = initial value;
	for (all bytes in the buffer)
		crc = (crc >> 8) ^ table[(crc ^ byte from buffer) & 0xff];
	return crc;

so it might just be the table. If so, could we just generate the appropriate table for the PROFINET polynomial, have epan/crc16.c export crc16_reflected(), and have the PROFINET CRC16 routine use crc16_reflected() and the appropriate table?