crc.c File Reference

CRC - 32 + 16 BIT ANSI X3.66 + CCITT CRC checksum files More...

#include <stdio.h>
#include "str.h"
#include "ut.h"
#include "crc.h"

Include dependency graph for crc.c:

Go to the source code of this file.

Defines

#define UPDC16(ch, crc)   (crc_16_tab[((crc) ^ (ch)) & 0xff] ^ ((crc) >> 8))
#define UPDC32(ch, crc)   (crc_32_tab[((crc) ^ (ch)) & 0xff] ^ ((crc) >> 8))
#define UPDCIT(ch, crc)   (ccitt_tab[((crc) ^ (ch)) & 0xff] ^ ((crc) >> 8))

Functions

void crc32_uint (str *source_string, unsigned int *hash_ret)
 CRC32 value from source string.
unsigned short crcitt_string (char *s, int len)
 Return CCITT value from string.
void crcitt_string_array (char *dst, str src[], int size)
 CCITT value from array.

Variables

unsigned short int ccitt_tab []
unsigned short int crc_16_tab []
unsigned long int crc_32_tab []


Detailed Description

CRC - 32 + 16 BIT ANSI X3.66 + CCITT CRC checksum files

Definition in file crc.c.


Define Documentation

#define UPDC16 ( ch,
crc   )     (crc_16_tab[((crc) ^ (ch)) & 0xff] ^ ((crc) >> 8))

Definition at line 82 of file crc.c.

#define UPDC32 ( ch,
crc   )     (crc_32_tab[((crc) ^ (ch)) & 0xff] ^ ((crc) >> 8))

Definition at line 80 of file crc.c.

#define UPDCIT ( ch,
crc   )     (ccitt_tab[((crc) ^ (ch)) & 0xff] ^ ((crc) >> 8))

Definition at line 81 of file crc.c.

Referenced by crcitt_string(), and crcitt_string_array().


Function Documentation

void crc32_uint ( str source_string,
unsigned int *  hash_ret 
)

CRC32 value from source string.

Parameters:
source_string source string
hash_ret calulated CRC32

Definition at line 270 of file crc.c.

References crc_32_tab, hash, _str::len, len, and _str::s.

Referenced by hash_func().

unsigned short crcitt_string ( char *  s,
int  len 
)

Return CCITT value from string.

Parameters:
s intput char
len input length
Returns:
CCITT string

Definition at line 213 of file crc.c.

References UPDCIT.

void crcitt_string_array ( char *  dst,
str  src[],
int  size 
)

CCITT value from array.

Parameters:
dst destination
src source array
size array size

Definition at line 233 of file crc.c.

References CRC16_LEN, int2reverse_hex(), _str::len, len, LM_CRIT, _str::s, and UPDCIT.

Referenced by calc_crc_suffix(), and generate_fromtag().


Variable Documentation

unsigned short int ccitt_tab[]

CRC polynomial 0x8408

Definition at line 134 of file crc.c.

unsigned short int crc_16_tab[]

CRC polynomial 0xA001

Definition at line 171 of file crc.c.

unsigned long int crc_32_tab[]

CRC polynomial 0xedb88320

Definition at line 86 of file crc.c.

Referenced by crc32_uint().


Generated on Mon May 21 18:00:38 2012 for Kamailio - The Open Source SIP Server by  doxygen 1.5.6