MSWSP: * add parse_lcid()
[wireshark-wip.git] / wsutil / crc7.h
blob2afc9fb1099f8c7cfef70846e6aa40998e6750f8
1 /*
2 * crc7.h
3 *
4 * $Id$
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:
29 * Width = 7
30 * Poly = 0x45
31 * XorIn = 0x00
32 * ReflectIn = False
33 * XorOut = 0x00
34 * ReflectOut = False
35 * Algorithm = table-driven
36 ****************************************************************************
38 #ifndef __CRC7__H__
39 #define __CRC7__H__
41 #include "ws_symbol_export.h"
43 #ifdef __cplusplus
44 extern "C" {
45 #endif
48 /**
49 * The definition of the used algorithm.
50 *****************************************************************************/
51 #define CRC_ALGO_TABLE_DRIVEN 1
53 /**
54 * Calculate the initial crc value.
56 * \return The initial crc value.
57 *****************************************************************************/
58 static inline guint8 crc7init(void)
60 return 0x00 << 1;
64 /**
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);
75 /**
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;
87 #ifdef __cplusplus
88 } /* closing brace for extern "C" */
89 #endif
91 #endif /* __CRC7__H__ */