MAC LTE: upgrade dissector to v13.1.0
[metze/wireshark/wip.git] / epan / crc32-tvb.h
1 /* crc32-tvb.h
2  * Declaration of CRC-32 tvbuff routines
3  *
4  * Wireshark - Network traffic analyzer
5  * By Gerald Combs <gerald@wireshark.org>
6  * Copyright 1998 Gerald Combs
7  *
8  * This program is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License
10  * as published by the Free Software Foundation; either version 2
11  * of the License, or (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21  */
22
23 #ifndef __CRC32_TVB_H__
24 #define __CRC32_TVB_H__
25
26 #include "ws_symbol_export.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 WS_DLL_PUBLIC 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 WS_DLL_PUBLIC 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 WS_DLL_PUBLIC guint32 crc32_ccitt_tvb_seed(tvbuff_t *tvb, guint len, guint32 seed);
53
54 /** Compute CRC32C 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 CRC32C checksum (using the given seed). */
62 WS_DLL_PUBLIC guint32 crc32c_tvb_offset_calculate(tvbuff_t *tvb, guint offset,
63                                            guint len, guint32 seed);
64
65 /** Compute CRC32 CCITT checksum of a tv buffer.  If computing the
66  *  checksum over multiple tv buffers and you want to feed the partial CRC32
67  *  back in, remember to take the 1's complement of the partial CRC32 first.
68  @param tvb The tv buffer containing the data.
69  @param offset The offset into the tv buffer.
70  @param len The number of bytes to include in the computation.
71  @param seed The seed to use.
72  @return The CRC32 CCITT checksum (using the given seed). */
73 WS_DLL_PUBLIC guint32 crc32_ccitt_tvb_offset_seed(tvbuff_t *tvb, guint offset,
74                                            guint len, guint32 seed);
75
76 /** Compute IEEE 802.x CRC32 checksum of a tv buffer.
77  @param tvb The tv buffer containing the data.
78  @param len The number of bytes to include in the computation.
79  @return The IEEE 802.x CRC32 checksum. */
80 WS_DLL_PUBLIC guint32 crc32_802_tvb(tvbuff_t *tvb, guint len);
81
82
83 /** Compute MPEG-2 CRC32 checksum of a tv buffer.
84  @param tvb The tv buffer containing the data.
85  @param len The number of bytes to include in the computation.
86  @return The MPEG-2 CRC32 checksum. */
87 WS_DLL_PUBLIC guint32 crc32_mpeg2_tvb(tvbuff_t *tvb, guint len);
88
89 /** Compute MPEG-2 CRC32 checksum of a tv buffer.
90  @param tvb The tv buffer containing the data.
91  @param offset The offset into the tv buffer.
92  @param len The number of bytes to include in the computation.
93  @return The MPEG-2 CRC32 checksum. */
94 WS_DLL_PUBLIC guint32 crc32_mpeg2_tvb_offset(tvbuff_t *tvb, guint offset, guint len);
95
96 /** Compute MPEG-2 CRC32 checksum of a buffer of data.
97  @param tvb The tv buffer containing the data.
98  @param len The number of bytes to include in the computation.
99  @param seed The seed to use.
100  @return The CRC32 MPEG-2 checksum (using the given seed). */
101 WS_DLL_PUBLIC guint32 crc32_mpeg2_tvb_seed(tvbuff_t *tvb, guint len, guint32 seed);
102
103 /** Compute MPEG-2 CRC32 checksum of a buffer of data.
104  @param tvb The tv buffer containing the data.
105  @param offset The offset into the tv buffer.
106  @param len The number of bytes to include in the computation.
107  @param seed The seed to use.
108  @return The CRC32 MPEG-2 checksum (using the given seed). */
109 WS_DLL_PUBLIC guint32 crc32_mpeg2_tvb_offset_seed(tvbuff_t *tvb, guint offset,
110                                            guint len, guint32 seed);
111
112 /** Compute CRC32 checksum of a tv buffer using the parameters
113  *    Width        = 32 bits
114  *    Poly         = 0x0AA725CF
115  *    Reflection   = true
116  *    Algorithm    = table-driven
117  @param tvb The tv buffer containing the data.
118  @param offset The offset into the tv buffer.
119  @param len The number of bytes to include in the computation.
120  @param seed The seed to use.
121  @return The CRC32 checksum. */
122 WS_DLL_PUBLIC guint32 crc32_0x0AA725CF_tvb_offset_seed(tvbuff_t *tvb,
123                                             guint offset, guint len, guint32 seed);
124
125 #ifdef __cplusplus
126 }
127 #endif /* __cplusplus */
128
129 #endif /* crc32-tvb.h */