Diff for /libelwix/inc/elwix/acrc.h between versions 1.2.28.1 and 1.10.4.1

version 1.2.28.1, 2014/01/29 12:23:15 version 1.10.4.1, 2024/12/05 12:33:49
Line 12  terms: Line 12  terms:
 All of the documentation and software included in the ELWIX and AITNET  All of the documentation and software included in the ELWIX and AITNET
 Releases is copyrighted by ELWIX - Sofia/Bulgaria <info@elwix.org>  Releases is copyrighted by ELWIX - Sofia/Bulgaria <info@elwix.org>
   
Copyright 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013Copyright 2004 - 2024
         by Michael Pounov <misho@elwix.org>.  All rights reserved.          by Michael Pounov <misho@elwix.org>.  All rights reserved.
   
 Redistribution and use in source and binary forms, with or without  Redistribution and use in source and binary forms, with or without
Line 58  struct tagCRCPoly { Line 58  struct tagCRCPoly {
 };      /* size 24bytes */  };      /* size 24bytes */
 typedef struct tagCRCPoly crcPoly_t;  typedef struct tagCRCPoly crcPoly_t;
   
   #ifdef __cplusplus
   extern "C" {
   #endif
   
 /*  /*
  * crcReflect() - Reflect all bits of number    * crcReflect() - Reflect all bits of number 
  *   *
  * @crcNum = Number for reflection   * @crcNum = Number for reflection
  * @crcBits = Number width bits    * @crcBits = Number width bits 
 * return: -1 error, !=-1 reflecting number * return: reflecting number
  */   */
 unsigned int crcReflect(unsigned int crcNum, unsigned char crcBits);  unsigned int crcReflect(unsigned int crcNum, unsigned char crcBits);
 /*  /*
Line 76  unsigned int crcReflect(unsigned int crcNum, unsigned  Line 79  unsigned int crcReflect(unsigned int crcNum, unsigned 
  * @RevOpts = Options for computation (REVOPTS_REVERTBYTE, REVOPTS_REVERTCRC)   * @RevOpts = Options for computation (REVOPTS_REVERTBYTE, REVOPTS_REVERTCRC)
  * @initCRC = Initial CRC value   * @initCRC = Initial CRC value
  * @xorCRC = Last xor CRC value   * @xorCRC = Last xor CRC value
 * return: -1 error, !=-1 CRC checksum * return: CRC checksum
  */   */
 unsigned int crcCalc(unsigned char * __restrict psBuf, unsigned int bufLen,   unsigned int crcCalc(unsigned char * __restrict psBuf, unsigned int bufLen, 
                 unsigned char crcBits, unsigned char RevOpts,                   unsigned char crcBits, unsigned char RevOpts, 
                 unsigned int initCRC, unsigned int xorCRC);                  unsigned int initCRC, unsigned int xorCRC);
   #define crc_32(x, l)            crcCalc((x), (l), 32, REVOPTS_REVERTBYTE|REVOPTS_REVERTCRC, 0xFFFFFFFF, 0xFFFFFFFF)
   #define crc_16(x, l)            crcCalc((x), (l), 16, REVOPTS_REVERTBYTE|REVOPTS_REVERTCRC, 0x0, 0x0)
   #define crc_16_ccitt(x, l)      crcCalc((x), (l), 161, 0, 0x0, 0x0)
   #define crc_16_xmodem(x, l)     crcCalc((x), (l), 162, REVOPTS_REVERTBYTE|REVOPTS_REVERTCRC, 0x0, 0x0)
   #define crc_8(x, l)             crcCalc((x), (l), 8, 0, 0x0, 0x0)
   
 /*  /*
    * crc16_ccitt() - Checksum calculation
    *
    * @buf = Data for calculation
    * @bufLen = Length of data
    * return: Checksum
    */
   unsigned short crc16_ccitt(unsigned char * __restrict buf, int bufLen);
   /*
    * crc16_xy() - Checksum calculation in X/Y modem communication
    *
    * @buf = Data for calculation
    * @bufLen = Length of data
    * return: Checksum
    */
   unsigned short crc16_xy(unsigned char * __restrict buf, int bufLen);
   /*
  * crcIP() - Checksum in IP communication   * crcIP() - Checksum in IP communication
  *   *
  * @buf = Data for calculation   * @buf = Data for calculation
    * @len = Length of data in bytes
    * return: Checksum
    */
   unsigned short crcIP(unsigned short* __restrict buf, int len);
   /*
    * crcTCP() - Checksum for TCP v4 communication
    *
    * @buf = Data for calculation
  * @bufLen = Length of data   * @bufLen = Length of data
 * return: -1 error, !=-1 Checksum * @th = TCP header
  * return: Checksum
  */   */
unsigned short crcIP(unsigned char * __restrict buf, int bufLen);unsigned short crcTCP(struct in_addr src, struct in_addr dst, 
                 unsigned char * __restrict th);
 /*  /*
    * crcUDP() - Checksum for UDP v4 communication
    *
    * @buf = Data for calculation
    * @bufLen = Length of data
    * @uh = UDP header
    * return: Checksum
    */
   unsigned short crcUDP(struct in_addr src, struct in_addr dst, 
                   unsigned char * __restrict uh);
   
   /*
  * crcFletcher16() - Fletcher-16 Checksum computing   * crcFletcher16() - Fletcher-16 Checksum computing
  *   *
  * @nBuf = Data for calculation   * @nBuf = Data for calculation
  * @bufLen = Length of data   * @bufLen = Length of data
 * return: -1 error, !=-1 Checksum * return: Checksum
  */   */
 unsigned short crcFletcher16(unsigned short * __restrict nBuf, int bufLen);  unsigned short crcFletcher16(unsigned short * __restrict nBuf, int bufLen);
 /*  /*
Line 103  unsigned short crcFletcher16(unsigned short * __restri Line 148  unsigned short crcFletcher16(unsigned short * __restri
  *   *
  * @nBuf = Data for calculation   * @nBuf = Data for calculation
  * @bufLen = Length of data   * @bufLen = Length of data
 * return: -1 error, !=-1 Checksum * return: Checksum
  */   */
 unsigned int crcFletcher(unsigned short * __restrict nBuf, int bufLen);  unsigned int crcFletcher(unsigned short * __restrict nBuf, int bufLen);
 /*  /*
Line 111  unsigned int crcFletcher(unsigned short * __restrict n Line 156  unsigned int crcFletcher(unsigned short * __restrict n
  *   *
  * @psBuf = Data for calculation   * @psBuf = Data for calculation
  * @bufLen = Length of data   * @bufLen = Length of data
 * return: -1 error, !=-1 Checksum * return: Checksum
  */   */
 unsigned int crcAdler(unsigned char * __restrict psBuf, int bufLen);  unsigned int crcAdler(unsigned char * __restrict psBuf, int bufLen);
   
Line 120  unsigned int crcAdler(unsigned char * __restrict psBuf Line 165  unsigned int crcAdler(unsigned char * __restrict psBuf
  *   *
  * @psBuf = Data for calculation   * @psBuf = Data for calculation
  * @bufLen = Length of data   * @bufLen = Length of data
 * return: -1 error, !=-1 Checksum * return: Checksum
  */   */
 #define crcEther(psBuf, bufLen) crcCalc((psBuf), (bufLen), 32, 3, 0xFFFFFFFF, 0xFFFFFFFF)  #define crcEther(psBuf, bufLen) crcCalc((psBuf), (bufLen), 32, 3, 0xFFFFFFFF, 0xFFFFFFFF)
   
 /*  /*
 * crc32() - CRC32 calculation from table * crc8tbl() - CRC8 calculation from table
  *   *
  * @crc = Initial crc value   * @crc = Initial crc value
  * @buf = Data for calculation   * @buf = Data for calculation
  * @len = Length of data   * @len = Length of data
    * return: calculated CRC8
    */
   uint8_t crc8tbl(unsigned char crc, const unsigned char * __restrict buf, unsigned int len);
   /*
    * crc32tbl() - CRC32 calculation from table
    *
    * @crc = Initial crc value
    * @buf = Data for calculation
    * @len = Length of data
  * return: calculated CRC32   * return: calculated CRC32
  */   */
unsigned int crc32(unsigned int crc, const unsigned char * __restrict buf, unsigned int len);unsigned int crc32tbl(unsigned int crc, const unsigned char * __restrict buf, unsigned int len);
   
 /*  /*
  * crcPelco() - Calculate Pelco D/P CRC   * crcPelco() - Calculate Pelco D/P CRC
Line 207  unsigned int hash_fnv1(const char *csStr, int nStrLen, Line 261  unsigned int hash_fnv1(const char *csStr, int nStrLen,
 */  */
 #define hash_fnv(str, len)      hash_fnv1((str), (len), 1)  #define hash_fnv(str, len)      hash_fnv1((str), (len), 1)
   
   #ifdef __cplusplus
   }
   #endif
   
 #endif  #endif

Removed from v.1.2.28.1  
changed lines
  Added in v.1.10.4.1


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>