nexmon – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | /* crc32.h |
2 | * Declaration of CRC-32 routine and table |
||
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_H__ |
||
24 | #define __CRC32_H__ |
||
25 | |||
26 | #include "ws_symbol_export.h" |
||
27 | |||
28 | #ifdef __cplusplus |
||
29 | extern "C" { |
||
30 | #endif /* __cplusplus */ |
||
31 | |||
32 | #define CRC32_CCITT_SEED 0xFFFFFFFF |
||
33 | #define CRC32C_PRELOAD 0xffffffff |
||
34 | #define CRC32_MPEG2_SEED 0xFFFFFFFF |
||
35 | |||
36 | /* |
||
37 | * Byte swap fix contributed by Dave Wysochanski <davidw@netapp.com>. |
||
38 | */ |
||
39 | #define CRC32C_SWAP(crc32c_value) \ |
||
40 | (((crc32c_value & 0xff000000) >> 24) | \ |
||
41 | ((crc32c_value & 0x00ff0000) >> 8) | \ |
||
42 | ((crc32c_value & 0x0000ff00) << 8) | \ |
||
43 | ((crc32c_value & 0x000000ff) << 24)) |
||
44 | |||
45 | /** Lookup the crc value in the crc32_ccitt_table |
||
46 | @param pos Position in the table. */ |
||
47 | WS_DLL_PUBLIC guint32 crc32_ccitt_table_lookup (guchar pos); |
||
48 | |||
49 | /** Lookup the crc value in the crc32c_table |
||
50 | @param pos Position in the table. */ |
||
51 | WS_DLL_PUBLIC guint32 crc32c_table_lookup (guchar pos); |
||
52 | |||
53 | /** Compute CRC32C checksum of a buffer of data. |
||
54 | @param buf The buffer containing the data. |
||
55 | @param len The number of bytes to include in the computation. |
||
56 | @param crc The preload value for the CRC32C computation. |
||
57 | @return The CRC32C checksum. */ |
||
58 | WS_DLL_PUBLIC guint32 crc32c_calculate(const void *buf, int len, guint32 crc); |
||
59 | |||
60 | /** Compute CRC32C checksum of a buffer of data without swapping seed crc |
||
61 | or completed checksum |
||
62 | @param buf The buffer containing the data. |
||
63 | @param len The number of bytes to include in the computation. |
||
64 | @param crc The preload value for the CRC32C computation. |
||
65 | @return The CRC32C checksum. */ |
||
66 | WS_DLL_PUBLIC guint32 crc32c_calculate_no_swap(const void *buf, int len, guint32 crc); |
||
67 | |||
68 | /** Compute CRC32 CCITT checksum of a buffer of data. |
||
69 | @param buf The buffer containing the data. |
||
70 | @param len The number of bytes to include in the computation. |
||
71 | @return The CRC32 CCITT checksum. */ |
||
72 | WS_DLL_PUBLIC guint32 crc32_ccitt(const guint8 *buf, guint len); |
||
73 | |||
74 | /** Compute CRC32 CCITT checksum of a buffer of data. If computing the |
||
75 | * checksum over multiple buffers and you want to feed the partial CRC32 |
||
76 | * back in, remember to take the 1's complement of the partial CRC32 first. |
||
77 | @param buf The buffer containing the data. |
||
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 | WS_DLL_PUBLIC guint32 crc32_ccitt_seed(const guint8 *buf, guint len, guint32 seed); |
||
82 | |||
83 | /** Compute MPEG-2 CRC32 checksum of a buffer of data. |
||
84 | @param buf The buffer containing the data. |
||
85 | @param len The number of bytes to include in the computation. |
||
86 | @param seed The seed to use. |
||
87 | @return The CRC32 MPEG-2 checksum (using the given seed). */ |
||
88 | WS_DLL_PUBLIC guint32 crc32_mpeg2_seed(const guint8 *buf, guint len, guint32 seed); |
||
89 | |||
90 | /** Computes CRC32 checksum for the given data with the polynom 0x0AA725CF using |
||
91 | * precompiled CRC table |
||
92 | * @param buf a pointer to a buffer of the given length |
||
93 | * @param len the length of the given buffer |
||
94 | * @param seed The seed to use. |
||
95 | * @return the CRC32 checksum for the buffer |
||
96 | */ |
||
97 | WS_DLL_PUBLIC guint32 crc32_0x0AA725CF_seed(const guint8 *buf, guint len, guint32 seed); |
||
98 | |||
99 | WS_DLL_PUBLIC int AirPDcapWepDecrypt( |
||
100 | const guchar *seed, |
||
101 | const size_t seed_len, |
||
102 | guchar *cypher_text, |
||
103 | const size_t data_len); |
||
104 | |||
105 | #ifdef __cplusplus |
||
106 | } |
||
107 | #endif /* __cplusplus */ |
||
108 | |||
109 | #endif /* crc32.h */ |