ROHC compression/decompression library
|
ROHC CRC routines. More...
#include "crcany.h"
#include "ip.h"
#include "protocols/uncomp_pkt_hdrs.h"
#include <rohc/rohc.h>
#include <stdbool.h>
Go to the source code of this file.
Macros | |
#define | CRC_INIT_3 0x7 |
The CRC-3 initial value. More... | |
#define | CRC_INIT_7 0x7f |
The CRC-7 initial value. More... | |
#define | CRC_INIT_8 0xff |
The CRC-8 initial value. More... | |
#define | CRC_INIT_FCS32 0xffffffff |
#define | CRC_FCS32_LEN 4U |
Enumerations | |
enum | rohc_crc_type_t { ROHC_CRC_TYPE_NONE = 0, ROHC_CRC_TYPE_3 = 3, ROHC_CRC_TYPE_7 = 7, ROHC_CRC_TYPE_8 = 8 } |
Functions | |
uint32_t | crc_calc_fcs32 (const uint8_t *const data, const size_t length, const uint32_t init_val) |
Optimized CRC FCS-32 calculation using a table. More... | |
uint8_t | ip_compute_crc_static (const struct rohc_pkt_hdrs *const uncomp_pkt_hdrs, const rohc_crc_type_t crc_type, const uint8_t init_val) |
Compute the CRC-STATIC part of an IP header. More... | |
uint8_t | ip_compute_crc_dynamic (const struct rohc_pkt_hdrs *const uncomp_pkt_hdrs, const rohc_crc_type_t crc_type, const uint8_t init_val) |
Compute the CRC-DYNAMIC part of an IP header. More... | |
static uint8_t | udp_compute_crc_static (const struct rohc_pkt_hdrs *const uncomp_pkt_hdrs, const rohc_crc_type_t crc_type, const uint8_t init_val) |
Compute the CRC-STATIC part of an UDP header. More... | |
static uint8_t | udp_compute_crc_dynamic (const struct rohc_pkt_hdrs *const uncomp_pkt_hdrs, const rohc_crc_type_t crc_type, const uint8_t init_val) |
Compute the CRC-DYNAMIC part of an UDP header. More... | |
static uint8_t | esp_compute_crc_static (const struct rohc_pkt_hdrs *const uncomp_pkt_hdrs, const rohc_crc_type_t crc_type, const uint8_t init_val) |
Compute the CRC-STATIC part of an ESP header. More... | |
static uint8_t | esp_compute_crc_dynamic (const struct rohc_pkt_hdrs *const uncomp_pkt_hdrs, const rohc_crc_type_t crc_type, const uint8_t init_val) |
Compute the CRC-DYNAMIC part of an ESP header. More... | |
static uint8_t | rtp_compute_crc_static (const struct rohc_pkt_hdrs *const uncomp_pkt_hdrs, const rohc_crc_type_t crc_type, const uint8_t init_val) |
Compute the CRC-STATIC part of a RTP header. More... | |
static uint8_t | rtp_compute_crc_dynamic (const struct rohc_pkt_hdrs *const uncomp_pkt_hdrs, const rohc_crc_type_t crc_type, const uint8_t init_val) |
Compute the CRC-DYNAMIC part of a RTP header. More... | |
uint8_t | compute_crc_ctrl_fields (const rohc_profile_t profile_id, const uint8_t reorder_ratio, const uint16_t msn, const uint8_t ip_id_behaviors[], const size_t ip_id_behaviors_nr) |
Compute the CRC-3 over control fields for ROHCv2 profiles. More... | |
static uint8_t | crc_calculate (const rohc_crc_type_t crc_type, const uint8_t *const data, const size_t length, const uint8_t init_val) |
Calculate the checksum for the given data. More... | |
static uint8_t | crc_calc_8 (const uint8_t *const buf, const size_t size, const uint8_t init_val) |
Optimized CRC-8 calculation using a table. More... | |
static uint8_t | crc_calc_7 (const uint8_t *const buf, const size_t size, const uint8_t init_val) |
Optimized CRC-7 calculation using a table. More... | |
static uint8_t | crc_calc_3 (const uint8_t *const buf, const size_t size, const uint8_t init_val) |
Optimized CRC-3 calculation using a table. More... | |
Variables | |
static const uint8_t | crc_table_7 [256] |
static const uint8_t | crc_table_8 [256] |
ROHC CRC routines.
#define CRC_FCS32_LEN 4U |
The length (in bytes) of the FCS-32 CRC
#define CRC_INIT_3 0x7 |
The CRC-3 initial value.
#define CRC_INIT_7 0x7f |
The CRC-7 initial value.
#define CRC_INIT_8 0xff |
The CRC-8 initial value.
#define CRC_INIT_FCS32 0xffffffff |
The FCS-32 initial value
enum rohc_crc_type_t |
uint8_t compute_crc_ctrl_fields | ( | const rohc_profile_t | profile_id, |
const uint8_t | reorder_ratio, | ||
const uint16_t | msn, | ||
const uint8_t | ip_id_behaviors[], | ||
const size_t | ip_id_behaviors_nr | ||
) |
Compute the CRC-3 over control fields for ROHCv2 profiles.
profile_id | The current profile ID |
reorder_ratio | The 2-bit reorder_ratio control field, padded with 6 MSB of zeroes |
msn | The 16-bit MSN control field |
ip_id_behaviors | The 2-bit control fields behavior of IP-ID, one per IP header, all are padded with 6 MSB of zeroes |
ip_id_behaviors_nr | The number of IP headers, ie. the number of IP-ID behavior control fields to compute the CRC over |
|
inlinestatic |
Optimized CRC-3 calculation using a table.
buf | The data to compute the CRC for |
size | The size of the data |
init_val | The initial CRC value |
|
inlinestatic |
Optimized CRC-7 calculation using a table.
buf | The data to compute the CRC for |
size | The size of the data |
init_val | The initial CRC value |
|
inlinestatic |
Optimized CRC-8 calculation using a table.
buf | The data to compute the CRC for |
size | The size of the data |
init_val | The initial CRC value |
uint32_t crc_calc_fcs32 | ( | const uint8_t *const | data, |
const size_t | length, | ||
const uint32_t | init_val | ||
) |
Optimized CRC FCS-32 calculation using a table.
Public functions
data | The data to compute the CRC for |
length | The size of the data |
init_val | The initial value of the CRC |
|
inlinestatic |
Calculate the checksum for the given data.
crc_type | The CRC type |
data | The data to calculate the checksum on |
length | The length of the data |
init_val | The initial CRC value |
|
inlinestatic |
Compute the CRC-DYNAMIC part of an ESP header.
Concerned fields are:
uncomp_pkt_hdrs | The uncompressed headers to compute CRC for |
crc_type | The type of CRC |
init_val | The initial CRC value |
|
inlinestatic |
Compute the CRC-STATIC part of an ESP header.
Concerned fields are: all fields expect those for CRC-DYNAMIC
uncomp_pkt_hdrs | The uncompressed headers to compute CRC for |
crc_type | The type of CRC |
init_val | The initial CRC value |
uint8_t ip_compute_crc_dynamic | ( | const struct rohc_pkt_hdrs *const | uncomp_pkt_hdrs, |
const rohc_crc_type_t | crc_type, | ||
const uint8_t | init_val | ||
) |
Compute the CRC-DYNAMIC part of an IP header.
Concerned fields are:
uncomp_pkt_hdrs | The uncompressed headers to compute CRC for |
crc_type | The type of CRC |
init_val | The initial CRC value |
uint8_t ip_compute_crc_static | ( | const struct rohc_pkt_hdrs *const | uncomp_pkt_hdrs, |
const rohc_crc_type_t | crc_type, | ||
const uint8_t | 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.
uncomp_pkt_hdrs | The uncompressed headers to compute CRC for |
crc_type | The type of CRC |
init_val | The initial CRC value |
|
inlinestatic |
Compute the CRC-DYNAMIC part of a RTP header.
Concerned fields are:
uncomp_pkt_hdrs | The uncompressed headers to compute CRC for |
crc_type | The type of CRC |
init_val | The initial CRC value |
|
inlinestatic |
Compute the CRC-STATIC part of a RTP header.
Concerned fields are: all fields expect those for CRC-DYNAMIC
uncomp_pkt_hdrs | The uncompressed headers to compute CRC for |
crc_type | The type of CRC |
init_val | The initial CRC value |
|
inlinestatic |
Compute the CRC-DYNAMIC part of an UDP header.
Concerned fields are:
uncomp_pkt_hdrs | The uncompressed headers to compute CRC for |
crc_type | The type of CRC |
init_val | The initial CRC value |
|
inlinestatic |
Compute the CRC-STATIC part of an UDP header.
Concerned fields are: all fields expect those for CRC-DYNAMIC
uncomp_pkt_hdrs | The uncompressed headers to compute CRC for |
crc_type | The type of CRC |
init_val | The initial CRC value |
|
static |
The table to enable fast CRC-7 computation
|
static |
The table to enable fast CRC-8 computation