ROHC compression/decompression library
|
ROHC CRC routines. More...
Functions | |
int | crc_get_polynom (int type) |
Get the polynom for the CRC type. | |
void | crc_init_table (unsigned char *table, unsigned char poly) |
Initialize a table given a 256 bytes table and the polynom to use. | |
unsigned int | crc_calculate (int type, unsigned char *data, int length, unsigned int init_val) |
Calculate the checksum for the given data. | |
unsigned int | compute_crc_static (const unsigned char *ip, const unsigned char *ip2, const unsigned char *next_header, unsigned int crc_type, unsigned int init_val) |
Compute the CRC-STATIC part of an IP header. | |
unsigned int | compute_crc_dynamic (const unsigned char *ip, const unsigned char *ip2, const unsigned char *next_header, unsigned int crc_type, unsigned int init_val) |
Compute the CRC-DYNAMIC part of an IP header. | |
unsigned int | udp_compute_crc_static (const unsigned char *ip, const unsigned char *ip2, const unsigned char *next_header, unsigned int crc_type, unsigned int init_val) |
Compute the CRC-STATIC part of an UDP or UDO-Lite header. | |
unsigned int | udp_compute_crc_dynamic (const unsigned char *ip, const unsigned char *ip2, const unsigned char *next_header, unsigned int crc_type, unsigned int init_val) |
Compute the CRC-DYNAMIC part of an UDP or UDP-Lite header. | |
unsigned int | rtp_compute_crc_static (const unsigned char *ip, const unsigned char *ip2, const unsigned char *next_header, unsigned int crc_type, unsigned int init_val) |
Compute the CRC-STATIC part of a RTP header. | |
unsigned int | rtp_compute_crc_dynamic (const unsigned char *ip, const unsigned char *ip2, const unsigned char *next_header, unsigned int crc_type, unsigned int init_val) |
Compute the CRC-DYNAMIC part of a RTP header. | |
unsigned int | ipv6_ext_compute_crc_static (const unsigned char *ip, unsigned int crc_type, unsigned int init_val) |
Compute the CRC-STATIC part of IPv6 extensions. | |
unsigned int | ipv6_ext_compute_crc_dynamic (const unsigned char *ip, unsigned int crc_type, unsigned int init_val) |
Compute the CRC-DYNAMIC part of IPv6 extensions. | |
Variables | |
unsigned char | crc_table_8 [256] |
Table to enable fast CRC-8 computation. | |
unsigned char | crc_table_7 [256] |
Table to enable fast CRC-7 computation. | |
unsigned char | crc_table_6 [256] |
Table to enable fast CRC-6 computation. | |
unsigned char | crc_table_3 [256] |
Table to enable fast CRC-3 computation. | |
unsigned char | crc_table_2 [256] |
Table to enable fast CRC-2 computation. |
ROHC CRC routines.
unsigned int compute_crc_dynamic | ( | const unsigned char * | ip, |
const unsigned char * | ip2, | ||
const unsigned char * | next_header, | ||
unsigned int | crc_type, | ||
unsigned int | init_val | ||
) |
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 |
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 * | ip, |
const unsigned char * | ip2, | ||
const unsigned char * | next_header, | ||
unsigned int | crc_type, | ||
unsigned int | init_val | ||
) |
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 |
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 | ( | int | type, |
unsigned char * | data, | ||
int | length, | ||
unsigned int | init_val | ||
) |
Calculate the checksum for the given data.
type | The CRC type (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 |
References CRC_TYPE_2, CRC_TYPE_3, CRC_TYPE_6, CRC_TYPE_7, and CRC_TYPE_8.
Referenced by c_generic_feedback(), c_uncompressed_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(), rohc_ir_dyn_packet_crc_ok(), rohc_ir_packet_crc_ok(), rtp_compute_crc_dynamic(), rtp_compute_crc_static(), udp_compute_crc_dynamic(), udp_compute_crc_static(), and uncompressed_code_IR_packet().
int crc_get_polynom | ( | int | type | ) |
Get the polynom for the CRC type.
Public functions
type | The CRC type |
References CRC_TYPE_2, CRC_TYPE_3, CRC_TYPE_6, CRC_TYPE_7, and CRC_TYPE_8.
void crc_init_table | ( | unsigned char * | table, |
unsigned char | poly | ||
) |
Initialize a table given a 256 bytes table and the polynom to use.
table | The 256 bytes table |
poly | The polynom |
unsigned int ipv6_ext_compute_crc_dynamic | ( | const unsigned char * | ip, |
unsigned int | crc_type, | ||
unsigned int | init_val | ||
) |
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 |
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 * | ip, |
unsigned int | crc_type, | ||
unsigned int | init_val | ||
) |
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 |
References crc_calculate(), ip_get_extension_size(), ip_get_next_ext_header_from_ext(), and IPV6_EXT_AUTH.
Referenced by compute_crc_static().
unsigned int rtp_compute_crc_dynamic | ( | const unsigned char * | ip, |
const unsigned char * | ip2, | ||
const unsigned char * | next_header, | ||
unsigned int | crc_type, | ||
unsigned int | init_val | ||
) |
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 |
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 * | ip, |
const unsigned char * | ip2, | ||
const unsigned char * | next_header, | ||
unsigned int | crc_type, | ||
unsigned int | init_val | ||
) |
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 |
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 * | ip, |
const unsigned char * | ip2, | ||
const unsigned char * | next_header, | ||
unsigned int | crc_type, | ||
unsigned int | init_val | ||
) |
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 |
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 * | ip, |
const unsigned char * | ip2, | ||
const unsigned char * | next_header, | ||
unsigned int | crc_type, | ||
unsigned int | init_val | ||
) |
Compute the CRC-STATIC part of an UDP or UDO-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 |
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] |
Table to enable fast CRC-2 computation.
unsigned char crc_table_3[256] |
Table to enable fast CRC-3 computation.
unsigned char crc_table_6[256] |
Table to enable fast CRC-6 computation.
unsigned char crc_table_7[256] |
Table to enable fast CRC-7 computation.
unsigned char crc_table_8[256] |
Table to enable fast CRC-8 computation.