2 * Declaration of CRC-32 tvbuff routines
4 * Wireshark - Network traffic analyzer
5 * By Gerald Combs <gerald@wireshark.org>
6 * Copyright 1998 Gerald Combs
8 * SPDX-License-Identifier: GPL-2.0-or-later
11 #ifndef __CRC32_TVB_H__
12 #define __CRC32_TVB_H__
14 #include "ws_symbol_export.h"
18 #endif /* __cplusplus */
20 /** Compute CRC32 CCITT checksum of a tv buffer.
21 @param tvb The tv buffer containing the data.
22 @param len The number of bytes to include in the computation.
23 @return The CRC32 CCITT checksum. */
24 WS_DLL_PUBLIC
uint32_t crc32_ccitt_tvb(tvbuff_t
*tvb
, unsigned len
);
26 /** Compute CRC32 CCITT checksum of a tv buffer.
27 @param tvb The tv buffer containing the data.
28 @param offset The offset into the tv buffer.
29 @param len The number of bytes to include in the computation.
30 @return The CRC32 CCITT checksum. */
31 WS_DLL_PUBLIC
uint32_t crc32_ccitt_tvb_offset(tvbuff_t
*tvb
, unsigned offset
, unsigned len
);
33 /** Compute CRC32 CCITT checksum of a tv buffer. If computing the
34 * checksum over multiple tv buffers and you want to feed the partial CRC32
35 * back in, remember to take the 1's complement of the partial CRC32 first.
36 @param tvb The tv buffer containing the data.
37 @param len The number of bytes to include in the computation.
38 @param seed The seed to use.
39 @return The CRC32 CCITT checksum (using the given seed). */
40 WS_DLL_PUBLIC
uint32_t crc32_ccitt_tvb_seed(tvbuff_t
*tvb
, unsigned len
, uint32_t seed
);
42 /** Compute CRC32C checksum of a tv buffer. If computing the
43 * checksum over multiple tv 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 tvb The tv buffer containing the data.
46 @param offset The offset into the tv buffer.
47 @param len The number of bytes to include in the computation.
48 @param seed The seed to use.
49 @return The CRC32C checksum (using the given seed). */
50 WS_DLL_PUBLIC
uint32_t crc32c_tvb_offset_calculate(tvbuff_t
*tvb
, unsigned offset
,
51 unsigned len
, uint32_t seed
);
53 /** Compute CRC32 CCITT checksum of a tv buffer. If computing the
54 * checksum over multiple tv buffers and you want to feed the partial CRC32
55 * back in, remember to take the 1's complement of the partial CRC32 first.
56 @param tvb The tv buffer containing the data.
57 @param offset The offset into the tv buffer.
58 @param len The number of bytes to include in the computation.
59 @param seed The seed to use.
60 @return The CRC32 CCITT checksum (using the given seed). */
61 WS_DLL_PUBLIC
uint32_t crc32_ccitt_tvb_offset_seed(tvbuff_t
*tvb
, unsigned offset
,
62 unsigned len
, uint32_t seed
);
64 /** Compute IEEE 802.x CRC32 checksum of a tv buffer.
65 @param tvb The tv buffer containing the data.
66 @param len The number of bytes to include in the computation.
67 @return The IEEE 802.x CRC32 checksum. */
68 WS_DLL_PUBLIC
uint32_t crc32_802_tvb(tvbuff_t
*tvb
, unsigned len
);
71 /** Compute MPEG-2 CRC32 checksum of a tv buffer.
72 @param tvb The tv buffer containing the data.
73 @param len The number of bytes to include in the computation.
74 @return The MPEG-2 CRC32 checksum. */
75 WS_DLL_PUBLIC
uint32_t crc32_mpeg2_tvb(tvbuff_t
*tvb
, unsigned len
);
77 /** Compute MPEG-2 CRC32 checksum of a tv buffer.
78 @param tvb The tv buffer containing the data.
79 @param offset The offset into the tv buffer.
80 @param len The number of bytes to include in the computation.
81 @return The MPEG-2 CRC32 checksum. */
82 WS_DLL_PUBLIC
uint32_t crc32_mpeg2_tvb_offset(tvbuff_t
*tvb
, unsigned offset
, unsigned len
);
84 /** Compute MPEG-2 CRC32 checksum of a buffer of data.
85 @param tvb The tv buffer containing the data.
86 @param len The number of bytes to include in the computation.
87 @param seed The seed to use.
88 @return The CRC32 MPEG-2 checksum (using the given seed). */
89 WS_DLL_PUBLIC
uint32_t crc32_mpeg2_tvb_seed(tvbuff_t
*tvb
, unsigned len
, uint32_t seed
);
91 /** Compute MPEG-2 CRC32 checksum of a buffer of data.
92 @param tvb The tv buffer containing the data.
93 @param offset The offset into the tv buffer.
94 @param len The number of bytes to include in the computation.
95 @param seed The seed to use.
96 @return The CRC32 MPEG-2 checksum (using the given seed). */
97 WS_DLL_PUBLIC
uint32_t crc32_mpeg2_tvb_offset_seed(tvbuff_t
*tvb
, unsigned offset
,
98 unsigned len
, uint32_t seed
);
100 /** Compute CRC32 checksum of a tv buffer using the parameters
104 * Algorithm = table-driven
105 @param tvb The tv buffer containing the data.
106 @param offset The offset into the tv buffer.
107 @param len The number of bytes to include in the computation.
108 @param seed The seed to use.
109 @return The CRC32 checksum. */
110 WS_DLL_PUBLIC
uint32_t crc32_0x0AA725CF_tvb_offset_seed(tvbuff_t
*tvb
,
111 unsigned offset
, unsigned len
, uint32_t seed
);
115 #endif /* __cplusplus */
117 #endif /* crc32-tvb.h */