- Move setting _U_ into config.h, because
[obnox/wireshark/wip.git] / epan / crc32-tvb.h
1 /* crc32-tvb.h
2  * Declaration of CRC-32 tvbuff routines
3  *
4  * $Id$
5  *
6  * Wireshark - Network traffic analyzer
7  * By Gerald Combs <gerald@wireshark.org>
8  * Copyright 1998 Gerald Combs
9  *
10  * This program is free software; you can redistribute it and/or
11  * modify it under the terms of the GNU General Public License
12  * as published by the Free Software Foundation; either version 2
13  * of the License, or (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program; if not, write to the Free Software
22  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23  */
24
25 #ifndef __CRC32_TVB_H__
26 #define __CRC32_TVB_H__
27
28 #ifdef __cplusplus
29 extern "C" {
30 #endif /* __cplusplus */
31
32 /** Compute CRC32 CCITT checksum of a tv buffer.
33  @param tvb The tv buffer containing the data.
34  @param len The number of bytes to include in the computation.
35  @return The CRC32 CCITT checksum. */
36 extern guint32 crc32_ccitt_tvb(tvbuff_t *tvb, guint len);
37
38 /** Compute CRC32 CCITT checksum of a tv buffer.
39  @param tvb The tv buffer containing the data.
40  @param offset The offset into the tv buffer.
41  @param len The number of bytes to include in the computation.
42  @return The CRC32 CCITT checksum. */
43 extern guint32 crc32_ccitt_tvb_offset(tvbuff_t *tvb, guint offset, guint len);
44
45 /** Compute CRC32 CCITT checksum of a tv buffer.  If computing the
46  *  checksum over multiple tv buffers and you want to feed the partial CRC32
47  *  back in, remember to take the 1's complement of the partial CRC32 first.
48  @param tvb The tv buffer containing the data.
49  @param len The number of bytes to include in the computation.
50  @param seed The seed to use.
51  @return The CRC32 CCITT checksum (using the given seed). */
52 extern guint32 crc32_ccitt_tvb_seed(tvbuff_t *tvb, guint len, guint32 seed);
53
54 /** Compute CRC32 CCITT checksum of a tv buffer.  If computing the
55  *  checksum over multiple tv buffers and you want to feed the partial CRC32
56  *  back in, remember to take the 1's complement of the partial CRC32 first.
57  @param tvb The tv buffer containing the data.
58  @param offset The offset into the tv buffer.
59  @param len The number of bytes to include in the computation.
60  @param seed The seed to use.
61  @return The CRC32 CCITT checksum (using the given seed). */
62 extern guint32 crc32_ccitt_tvb_offset_seed(tvbuff_t *tvb, guint offset,
63                                            guint len, guint32 seed);
64
65 /** Compute IEEE 802.x CRC32 checksum of a tv buffer.
66  @param tvb The tv buffer containing the data.
67  @param len The number of bytes to include in the computation.
68  @return The IEEE 802.x CRC32 checksum. */
69 extern guint32 crc32_802_tvb(tvbuff_t *tvb, guint len);
70
71 #ifdef __cplusplus
72 }
73 #endif /* __cplusplus */
74
75 #endif /* crc32-tvb.h */