ROHC compression/decompression library
|
ROHC CRC routines. More...
#include "crc.h"
#include "protocols/ip_numbers.h"
#include "protocols/ip.h"
#include "protocols/ipv4.h"
#include "protocols/ipv6.h"
#include "protocols/udp.h"
#include "protocols/rtp.h"
#include "protocols/esp.h"
#include "protocols/tcp.h"
#include <stdlib.h>
#include <assert.h>
Functions | |
static uint8_t | ipv6_ext_calc_crc_static (const struct rohc_pkt_ip_hdr *const ip_hdr, const rohc_crc_type_t crc_type, const uint8_t init_val) |
Compute the CRC-STATIC part of IPv6 extensions. More... | |
static uint8_t | ipv6_ext_calc_crc_dyn (const struct rohc_pkt_ip_hdr *const ip_hdr, const rohc_crc_type_t crc_type, const uint8_t init_val) |
Compute the CRC-DYNAMIC part of IPv6 extensions. More... | |
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... | |
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... | |
Variables | |
static const uint32_t | crc_table_fcs32 [256] |
The pre-computed table for 32-bit Frame Check Sequence (FCS) More... | |
ROHC CRC routines.
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 |
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 |
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 |
|
static |
Compute the CRC-DYNAMIC part of IPv6 extensions.
Only entire AH header is concerned.
ip_hdr | The IP header for which to compute CRC over extension headers |
crc_type | The type of CRC |
init_val | The initial CRC value |
|
static |
Compute the CRC-STATIC part of IPv6 extensions.
Prototypes of private functions
Private functions All extensions are concerned except entire AH header.
ip_hdr | The IP header for which to compute CRC over extension headers |
crc_type | The type of CRC |
init_val | The initial CRC value |
|
static |
The pre-computed table for 32-bit Frame Check Sequence (FCS)
x**0 + x**1 + x**2 + x**4 + x**5 + x**7 + x**8 + x**10 + x**11 + x**12 + x**16 + x**22 + x**23 + x**26 + x**32
Copied from RFC 1662, appendix C.3