Remove trailing whitespace
[metze/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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23  */
24
25 #ifndef __CRC32_TVB_H__
26 #define __CRC32_TVB_H__
27
28 #include "ws_symbol_export.h"
29
30 #ifdef __cplusplus
31 extern "C" {
32 #endif /* __cplusplus */
33
34 /** Compute CRC32 CCITT checksum of a tv buffer.
35  @param tvb The tv buffer containing the data.
36  @param len The number of bytes to include in the computation.
37  @return The CRC32 CCITT checksum. */
38 WS_DLL_PUBLIC guint32 crc32_ccitt_tvb(tvbuff_t *tvb, guint len);
39
40 /** Compute CRC32 CCITT checksum of a tv buffer.
41  @param tvb The tv buffer containing the data.
42  @param offset The offset into the tv buffer.
43  @param len The number of bytes to include in the computation.
44  @return The CRC32 CCITT checksum. */
45 WS_DLL_PUBLIC guint32 crc32_ccitt_tvb_offset(tvbuff_t *tvb, guint offset, guint len);
46
47 /** Compute CRC32 CCITT checksum of a tv buffer.  If computing the
48  *  checksum over multiple tv buffers and you want to feed the partial CRC32
49  *  back in, remember to take the 1's complement of the partial CRC32 first.
50  @param tvb The tv buffer containing the data.
51  @param len The number of bytes to include in the computation.
52  @param seed The seed to use.
53  @return The CRC32 CCITT checksum (using the given seed). */
54 WS_DLL_PUBLIC guint32 crc32_ccitt_tvb_seed(tvbuff_t *tvb, guint len, guint32 seed);
55
56 /** Compute CRC32 CCITT checksum of a tv buffer.  If computing the
57  *  checksum over multiple tv buffers and you want to feed the partial CRC32
58  *  back in, remember to take the 1's complement of the partial CRC32 first.
59  @param tvb The tv buffer containing the data.
60  @param offset The offset into the tv buffer.
61  @param len The number of bytes to include in the computation.
62  @param seed The seed to use.
63  @return The CRC32 CCITT checksum (using the given seed). */
64 WS_DLL_PUBLIC guint32 crc32_ccitt_tvb_offset_seed(tvbuff_t *tvb, guint offset,
65                                            guint len, guint32 seed);
66
67 /** Compute IEEE 802.x CRC32 checksum of a tv buffer.
68  @param tvb The tv buffer containing the data.
69  @param len The number of bytes to include in the computation.
70  @return The IEEE 802.x CRC32 checksum. */
71 WS_DLL_PUBLIC guint32 crc32_802_tvb(tvbuff_t *tvb, guint len);
72
73
74 /** Compute MPEG-2 CRC32 checksum of a tv buffer.
75  @param tvb The tv buffer containing the data.
76  @param len The number of bytes to include in the computation.
77  @return The MPEG-2 CRC32 checksum. */
78 WS_DLL_PUBLIC guint32 crc32_mpeg2_tvb(tvbuff_t *tvb, guint len);
79
80 /** Compute MPEG-2 CRC32 checksum of a tv buffer.
81  @param tvb The tv buffer containing the data.
82  @param offset The offset into the tv buffer.
83  @param len The number of bytes to include in the computation.
84  @return The MPEG-2 CRC32 checksum. */
85 WS_DLL_PUBLIC guint32 crc32_mpeg2_tvb_offset(tvbuff_t *tvb, guint offset, guint len);
86
87 /** Compute MPEG-2 CRC32 checksum of a buffer of data.
88  @param tvb The tv buffer containing the data.
89  @param len The number of bytes to include in the computation.
90  @param seed The seed to use.
91  @return The CRC32 MPEG-2 checksum (using the given seed). */
92 WS_DLL_PUBLIC guint32 crc32_mpeg2_tvb_seed(tvbuff_t *tvb, guint len, guint32 seed);
93
94 /** Compute MPEG-2 CRC32 checksum of a buffer of data.
95  @param tvb The tv buffer containing the data.
96  @param offset The offset into the tv buffer.
97  @param len The number of bytes to include in the computation.
98  @param seed The seed to use.
99  @return The CRC32 MPEG-2 checksum (using the given seed). */
100 WS_DLL_PUBLIC guint32 crc32_mpeg2_tvb_offset_seed(tvbuff_t *tvb, guint offset,
101                                            guint len, guint32 seed);
102
103 /** Compute CRC32 checksum of a tv buffer using the parameters
104  *    Width        = 32 bits
105  *    Poly         = 0x0AA725CF
106  *    Reflection   = true
107  *    Algorithm    = table-driven
108  @param tvb The tv buffer containing the data.
109  @param offset The offset into the tv buffer.
110  @param len The number of bytes to include in the computation.
111  @param seed The seed to use.
112  @return The CRC32 checksum. */
113 WS_DLL_PUBLIC guint32 crc32_0x0AA725CF_tvb_offset_seed(tvbuff_t *tvb,
114                                             guint offset, guint len, guint32 seed);
115
116 #ifdef __cplusplus
117 }
118 #endif /* __cplusplus */
119
120 #endif /* crc32-tvb.h */