6 * Functions and types for CRC checks.
8 * Wireshark - Network traffic analyzer
9 * By Gerald Combs <gerald@wireshark.org>
10 * Copyright 1998 Gerald Combs
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
26 * Generated on Wed Jul 11 17:24:57 2012,
27 * by pycrc v0.7.10, http://www.tty1.net/pycrc/
28 * using the configuration:
35 * Algorithm = table-driven
36 ****************************************************************************
41 #include "ws_symbol_export.h"
49 * The definition of the used algorithm.
50 *****************************************************************************/
51 #define CRC_ALGO_TABLE_DRIVEN 1
54 * Calculate the initial crc value.
56 * \return The initial crc value.
57 *****************************************************************************/
58 static inline guint8
crc7init(void)
65 * Update the crc value with new data.
67 * \param crc The current crc value.
68 * \param data Pointer to a buffer of \a data_len bytes.
69 * \param data_len Number of bytes in the \a data buffer.
70 * \return The updated crc value.
71 *****************************************************************************/
72 WS_DLL_PUBLIC guint8
crc7update(guint8 crc
, const unsigned char *data
, int data_len
);
76 * Calculate the final crc value.
78 * \param crc The current crc value.
79 * \return The final crc value.
80 *****************************************************************************/
81 static inline guint8
crc7finalize(guint8 crc
)
83 return (crc
>> 1) ^ 0x00;
88 } /* closing brace for extern "C" */
91 #endif /* __CRC7__H__ */