2 * Declaration of CRC-32 routine and table
6 * Wireshark - Network traffic analyzer
7 * By Gerald Combs <gerald@wireshark.org>
8 * Copyright 1998 Gerald Combs
10 * Copied from README.developer
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
32 #endif /* __cplusplus */
34 extern const guint32 crc32_ccitt_table[256];
36 /** Compute CRC32 CCITT checksum of a buffer of data.
37 @param buf The buffer containing the data.
38 @param len The number of bytes to include in the computation.
39 @return The CRC32 CCITT checksum. */
40 extern guint32 crc32_ccitt(const guint8 *buf, guint len);
42 /** Compute CRC32 CCITT checksum of a buffer of data. If computing the
43 * checksum over multiple buffers and you want to feed the partial CRC32
44 * back in, remember to take the 1's complement of the partial CRC32 first.
45 @param buf The buffer containing the data.
46 @param len The number of bytes to include in the computation.
47 @param seed The seed to use.
48 @return The CRC32 CCITT checksum (using the given seed). */
49 extern guint32 crc32_ccitt_seed(const guint8 *buf, guint len, guint32 seed);
51 /** Compute CRC32 CCITT checksum of a tv buffer.
52 @param tvb The tv buffer containing the data.
53 @param len The number of bytes to include in the computation.
54 @return The CRC32 CCITT checksum. */
55 extern guint32 crc32_ccitt_tvb(tvbuff_t *tvb, guint len);
57 /** Compute CRC32 CCITT checksum of a tv buffer.
58 @param tvb The tv buffer containing the data.
59 @param offset The offset into the tv buffer.
60 @param len The number of bytes to include in the computation.
61 @return The CRC32 CCITT checksum. */
62 extern guint32 crc32_ccitt_tvb_offset(tvbuff_t *tvb, guint offset, guint len);
64 /** Compute CRC32 CCITT checksum of a tv buffer. If computing the
65 * checksum over multiple tv buffers and you want to feed the partial CRC32
66 * back in, remember to take the 1's complement of the partial CRC32 first.
67 @param tvb The tv buffer containing the data.
68 @param len The number of bytes to include in the computation.
69 @param seed The seed to use.
70 @return The CRC32 CCITT checksum (using the given seed). */
71 extern guint32 crc32_ccitt_tvb_seed(tvbuff_t *tvb, guint len, guint32 seed);
73 /** Compute CRC32 CCITT checksum of a tv buffer. If computing the
74 * checksum over multiple tv buffers and you want to feed the partial CRC32
75 * back in, remember to take the 1's complement of the partial CRC32 first.
76 @param tvb The tv buffer containing the data.
77 @param offset The offset into the tv buffer.
78 @param len The number of bytes to include in the computation.
79 @param seed The seed to use.
80 @return The CRC32 CCITT checksum (using the given seed). */
81 extern guint32 crc32_ccitt_tvb_offset_seed(tvbuff_t *tvb, guint offset,
82 guint len, guint32 seed);
84 /** Compute IEEE 802.x CRC32 checksum of a tv buffer.
85 @param tvb The tv buffer containing the data.
86 @param len The number of bytes to include in the computation.
87 @return The IEEE 802.x CRC32 checksum. */
88 extern guint32 crc32_802_tvb(tvbuff_t *tvb, guint len);
92 #endif /* __cplusplus */