/usr/include/spandsp/crc.h is in libspandsp-dev 0.0.6~pre20-3.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 | /*
* SpanDSP - a series of DSP components for telephony
*
* crc.h
*
* Written by Steve Underwood <steveu@coppice.org>
*
* Copyright (C) 2003 Steve Underwood
*
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 2.1,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/*! \file */
/*! \page crc_page CRC
\section crc_page_sec_1 What does it do?
\section crc_page_sec_2 How does it work?
*/
#if !defined(_SPANDSP_CRC_H_)
#define _SPANDSP_CRC_H_
#if defined(__cplusplus)
extern "C"
{
#endif
/*! \brief Calculate the ITU/CCITT CRC-32 value in buffer.
\param buf The buffer containing the data.
\param len The length of the frame.
\param crc The initial CRC value. This is usually 0xFFFFFFFF, or 0 for a new block (it depends on
the application). It is previous returned CRC value for the continuation of a block.
\return The CRC value.
*/
SPAN_DECLARE(uint32_t) crc_itu32_calc(const uint8_t *buf, int len, uint32_t crc);
/*! \brief Append an ITU/CCITT CRC-32 value to a frame.
\param buf The buffer containing the frame. This must be at least 2 bytes longer than
the frame it contains, to allow room for the CRC value.
\param len The length of the frame.
\return The new length of the frame.
*/
SPAN_DECLARE(int) crc_itu32_append(uint8_t *buf, int len);
/*! \brief Check the ITU/CCITT CRC-32 value in a frame.
\param buf The buffer containing the frame.
\param len The length of the frame.
\return TRUE if the CRC is OK, else FALSE.
*/
SPAN_DECLARE(int) crc_itu32_check(const uint8_t *buf, int len);
/*! \brief Calculate the ITU/CCITT CRC-16 value in buffer by whole bytes.
\param buf The buffer containing the data.
\param len The length of the frame.
\param crc The initial CRC value. This is usually 0xFFFF, or 0 for a new block (it depends on
the application). It is previous returned CRC value for the continuation of a block.
\return The CRC value.
*/
SPAN_DECLARE(uint16_t) crc_itu16_calc(const uint8_t *buf, int len, uint16_t crc);
/*! \brief Calculate the ITU/CCITT CRC-16 value of some bits from a byte.
\param buf The buffer containing the byte of data.
\param len The number of bits, starting from the LSB.
\param crc The initial CRC value. This is usually 0xFFFF, or 0 for a new block (it depends on
the application). It is previous returned CRC value for the continuation of a block.
\return The CRC value.
*/
SPAN_DECLARE(uint16_t) crc_itu16_bits(uint8_t buf, int len, uint16_t crc);
/*! \brief Append an ITU/CCITT CRC-16 value to a frame.
\param buf The buffer containing the frame. This must be at least 2 bytes longer than
the frame it contains, to allow room for the CRC value.
\param len The length of the frame.
\return The new length of the frame.
*/
SPAN_DECLARE(int) crc_itu16_append(uint8_t *buf, int len);
/*! \brief Check the ITU/CCITT CRC-16 value in a frame.
\param buf The buffer containing the frame.
\param len The length of the frame.
\return TRUE if the CRC is OK, else FALSE.
*/
SPAN_DECLARE(int) crc_itu16_check(const uint8_t *buf, int len);
#if defined(__cplusplus)
}
#endif
#endif
/*- End of file ------------------------------------------------------------*/
|