ROHC compression/decompression library
|
ROHC CRC routines. More...
Functions | |
static unsigned char static unsigned char static unsigned char static unsigned char static unsigned char static unsigned char int | crc_get_polynom (int type) |
Get the polynom for the given CRC type. | |
void | crc_init_table (unsigned char *table, unsigned char poly) |
Initialize a CRC table given a 256-byte table and the polynom to use. | |
bool | rohc_crc_init_table (unsigned char *const table, const int crc_type) |
Initialize a CRC table given a 256-byte table and the CRC type to use. | |
unsigned int | crc_calculate (const int crc_type, const unsigned char *const data, const int length, const unsigned int init_val, const unsigned char *const crc_table) |
Calculate the checksum for the given data. | |
unsigned int | compute_crc_static (const unsigned char *const ip, const unsigned char *const ip2, const unsigned char *const next_header, const unsigned int crc_type, const unsigned int init_val, const unsigned char *const crc_table) |
Compute the CRC-STATIC part of an IP header. | |
unsigned int | compute_crc_dynamic (const unsigned char *const ip, const unsigned char *const ip2, const unsigned char *const next_header, const unsigned int crc_type, const unsigned int init_val, const unsigned char *const crc_table) |
Compute the CRC-DYNAMIC part of an IP header. | |
unsigned int | udp_compute_crc_static (const unsigned char *const ip, const unsigned char *const ip2, const unsigned char *const next_header, const unsigned int crc_type, const unsigned int init_val, const unsigned char *const crc_table) |
Compute the CRC-STATIC part of an UDP or UDP-Lite header. | |
unsigned int | udp_compute_crc_dynamic (const unsigned char *const ip, const unsigned char *const ip2, const unsigned char *const next_header, const unsigned int crc_type, const unsigned int init_val, const unsigned char *const crc_table) |
Compute the CRC-DYNAMIC part of an UDP or UDP-Lite header. | |
unsigned int | rtp_compute_crc_static (const unsigned char *const ip, const unsigned char *const ip2, const unsigned char *const next_header, const unsigned int crc_type, const unsigned int init_val, const unsigned char *const crc_table) |
Compute the CRC-STATIC part of a RTP header. | |
unsigned int | rtp_compute_crc_dynamic (const unsigned char *const ip, const unsigned char *const ip2, const unsigned char *const next_header, const unsigned int crc_type, const unsigned int init_val, const unsigned char *const crc_table) |
Compute the CRC-DYNAMIC part of a RTP header. | |
unsigned int | ipv6_ext_compute_crc_static (const unsigned char *const ip, const unsigned int crc_type, const unsigned int init_val, const unsigned char *const crc_table) |
Compute the CRC-STATIC part of IPv6 extensions. | |
unsigned int | ipv6_ext_compute_crc_dynamic (const unsigned char *const ip, const unsigned int crc_type, const unsigned int init_val, const unsigned char *const crc_table) |
Compute the CRC-DYNAMIC part of IPv6 extensions. | |
Variables | |
unsigned char | crc_table_8 [256] |
unsigned char | crc_table_7 [256] |
unsigned char | crc_table_6 [256] |
unsigned char | crc_table_3 [256] |
unsigned char | crc_table_2 [256] |
static bool | warn_unused_result |
ROHC CRC routines.
unsigned int compute_crc_dynamic | ( | const unsigned char *const | ip, |
const unsigned char *const | ip2, | ||
const unsigned char *const | next_header, | ||
const unsigned int | crc_type, | ||
const unsigned int | init_val, | ||
const unsigned char *const | crc_table | ||
) |
Compute the CRC-DYNAMIC part of an IP header.
Concerned fields are:
ip | The outer IP packet |
ip2 | The inner IP packet if there is 2 IP headers, NULL otherwise |
next_header | The next header located after the IP header(s) |
crc_type | The type of CRC |
init_val | The initial CRC value |
crc_table | The pre-computed table for fast CRC computation |
References crc_calculate(), get_ip_version(), IPV4, ipv6_ext_compute_crc_dynamic(), and version.
Referenced by c_generic_create(), d_generic_create(), and udp_compute_crc_dynamic().
unsigned int compute_crc_static | ( | const unsigned char *const | ip, |
const unsigned char *const | ip2, | ||
const unsigned char *const | next_header, | ||
const unsigned int | crc_type, | ||
const unsigned int | init_val, | ||
const unsigned char *const | crc_table | ||
) |
Compute the CRC-STATIC part of an IP header.
Concerned fields are: all fields expect those for CRC-DYNAMIC
This function is one of the functions that must exist in one profile for the framework to work.
ip | The outer IP packet |
ip2 | The inner IP packet if there is 2 IP headers, NULL otherwise |
next_header | The next header located after the IP header(s) |
crc_type | The type of CRC |
init_val | The initial CRC value |
crc_table | The pre-computed table for fast CRC computation |
References crc_calculate(), get_ip_version(), IPV4, ipv6_ext_compute_crc_static(), and version.
Referenced by c_generic_create(), d_generic_create(), and udp_compute_crc_static().
unsigned int crc_calculate | ( | const int | crc_type, |
const unsigned char *const | data, | ||
const int | length, | ||
const unsigned int | init_val, | ||
const unsigned char *const | crc_table | ||
) |
Calculate the checksum for the given data.
crc_type | The CRC type among CRC_TYPE_2, CRC_TYPE_3, CRC_TYPE_6, CRC_TYPE_7 or CRC_TYPE_8 |
data | The data to calculate the checksum on |
length | The length of the data |
init_val | The initial CRC value |
crc_table | The pre-computed table for fast CRC computation |
References CRC_TYPE_2, CRC_TYPE_3, CRC_TYPE_6, CRC_TYPE_7, and CRC_TYPE_8.
Referenced by c_generic_feedback(), code_IR_DYN_packet(), code_IR_packet(), compute_crc_dynamic(), compute_crc_static(), f_wrap_feedback(), ipv6_ext_compute_crc_dynamic(), ipv6_ext_compute_crc_static(), rtp_compute_crc_dynamic(), rtp_compute_crc_static(), udp_compute_crc_dynamic(), and udp_compute_crc_static().
unsigned int ipv6_ext_compute_crc_dynamic | ( | const unsigned char *const | ip, |
const unsigned int | crc_type, | ||
const unsigned int | init_val, | ||
const unsigned char *const | crc_table | ||
) |
Compute the CRC-DYNAMIC part of IPv6 extensions.
Only entire AH header is concerned.
ip | The IPv6 packet |
crc_type | The type of CRC |
init_val | The initial CRC value |
crc_table | The pre-computed table for fast CRC computation |
References crc_calculate(), ip_get_extension_size(), ip_get_next_ext_header_from_ext(), and IPV6_EXT_AUTH.
Referenced by compute_crc_dynamic().
unsigned int ipv6_ext_compute_crc_static | ( | const unsigned char *const | ip, |
const unsigned int | crc_type, | ||
const unsigned int | init_val, | ||
const unsigned char *const | crc_table | ||
) |
Compute the CRC-STATIC part of IPv6 extensions.
All extensions are concerned except entire AH header.
ip | The IPv6 packet |
crc_type | The type of CRC |
init_val | The initial CRC value |
crc_table | The pre-computed table for fast CRC computation |
References crc_calculate(), ip_get_extension_size(), ip_get_next_ext_header_from_ext(), and IPV6_EXT_AUTH.
Referenced by compute_crc_static().
bool rohc_crc_init_table | ( | unsigned char *const | table, |
const int | crc_type | ||
) |
Initialize a CRC table given a 256-byte table and the CRC type to use.
table | IN/OUT: The 256-byte table to initialize |
crc_type | The type of CRC to initialize the table for |
Referenced by rohc_alloc_compressor(), and rohc_alloc_decompressor().
unsigned int rtp_compute_crc_dynamic | ( | const unsigned char *const | ip, |
const unsigned char *const | ip2, | ||
const unsigned char *const | next_header, | ||
const unsigned int | crc_type, | ||
const unsigned int | init_val, | ||
const unsigned char *const | crc_table | ||
) |
Compute the CRC-DYNAMIC part of a RTP header.
Concerned fields are:
ip | The outer IP packet |
ip2 | The inner IP packet if there is 2 IP headers, NULL otherwise |
next_header | The next header located after the IP header(s) |
crc_type | The type of CRC |
init_val | The initial CRC value |
crc_table | The pre-computed table for fast CRC computation |
References crc_calculate(), and udp_compute_crc_dynamic().
Referenced by c_rtp_create(), and d_rtp_create().
unsigned int rtp_compute_crc_static | ( | const unsigned char *const | ip, |
const unsigned char *const | ip2, | ||
const unsigned char *const | next_header, | ||
const unsigned int | crc_type, | ||
const unsigned int | init_val, | ||
const unsigned char *const | crc_table | ||
) |
Compute the CRC-STATIC part of a RTP header.
Concerned fields are: all fields expect those for CRC-DYNAMIC
ip | The outer IP packet |
ip2 | The inner IP packet if there is 2 IP headers, NULL otherwise |
next_header | The next header located after the IP header(s) |
crc_type | The type of CRC |
init_val | The initial CRC value |
crc_table | The pre-computed table for fast CRC computation |
References crc_calculate(), and udp_compute_crc_static().
Referenced by c_rtp_create(), and d_rtp_create().
unsigned int udp_compute_crc_dynamic | ( | const unsigned char *const | ip, |
const unsigned char *const | ip2, | ||
const unsigned char *const | next_header, | ||
const unsigned int | crc_type, | ||
const unsigned int | init_val, | ||
const unsigned char *const | crc_table | ||
) |
Compute the CRC-DYNAMIC part of an UDP or UDP-Lite header.
Concerned fields are:
ip | The outer IP packet |
ip2 | The inner IP packet if there is 2 IP headers, NULL otherwise |
next_header | The next header located after the IP header(s) |
crc_type | The type of CRC |
init_val | The initial CRC value |
crc_table | The pre-computed table for fast CRC computation |
References compute_crc_dynamic(), and crc_calculate().
Referenced by c_udp_create(), c_udp_lite_create(), d_udp_create(), d_udp_lite_create(), and rtp_compute_crc_dynamic().
unsigned int udp_compute_crc_static | ( | const unsigned char *const | ip, |
const unsigned char *const | ip2, | ||
const unsigned char *const | next_header, | ||
const unsigned int | crc_type, | ||
const unsigned int | init_val, | ||
const unsigned char *const | crc_table | ||
) |
Compute the CRC-STATIC part of an UDP or UDP-Lite header.
Concerned fields are: all fields expect those for CRC-DYNAMIC
ip | The outer IP packet |
ip2 | The inner IP packet if there is 2 IP headers, NULL otherwise |
next_header | The next header located after the IP header(s) |
crc_type | The type of CRC |
init_val | The initial CRC value |
crc_table | The pre-computed table for fast CRC computation |
References compute_crc_static(), and crc_calculate().
Referenced by c_udp_create(), c_udp_lite_create(), d_udp_create(), d_udp_lite_create(), and rtp_compute_crc_static().
unsigned char crc_table_2[256] |
unsigned char crc_table_3 | ( | ) |
The table to enable fast CRC-3 computation
unsigned char crc_table_6 | ( | ) |
The table to enable fast CRC-6 computation
unsigned char crc_table_7 | ( | ) |
The table to enable fast CRC-7 computation
unsigned char crc_table_8 | ( | ) |
The table to enable fast CRC-8 computation
bool warn_unused_result |