Remove trailing whitespace
[metze/wireshark/wip.git] / wsutil / crc7.h
1 /*
2  * crc7.h
3  *
4  * $Id$
5  *
6  * Functions and types for CRC checks.
7  *
8  * Wireshark - Network traffic analyzer
9  * By Gerald Combs <gerald@wireshark.org>
10  * Copyright 1998 Gerald Combs
11  *
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.
16  *
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.
21  *
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.
25  *
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  ****************************************************************************
37  */
38 #ifndef __CRC7__H__
39 #define __CRC7__H__
40
41 #include "ws_symbol_export.h"
42
43 #ifdef __cplusplus
44 extern "C" {
45 #endif
46
47
48 /**
49  * The definition of the used algorithm.
50  *****************************************************************************/
51 #define CRC_ALGO_TABLE_DRIVEN 1
52
53 /**
54  * Calculate the initial crc value.
55  *
56  * \return     The initial crc value.
57  *****************************************************************************/
58 static inline guint8 crc7init(void)
59 {
60     return 0x00 << 1;
61 }
62
63
64 /**
65  * Update the crc value with new data.
66  *
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);
73
74
75 /**
76  * Calculate the final crc value.
77  *
78  * \param crc  The current crc value.
79  * \return     The final crc value.
80  *****************************************************************************/
81 static inline guint8 crc7finalize(guint8 crc)
82 {
83     return (crc >> 1) ^ 0x00;
84 }
85
86
87 #ifdef __cplusplus
88 }           /* closing brace for extern "C" */
89 #endif
90
91 #endif      /* __CRC7__H__ */