32 #ifndef ROHC_COMMON_CRC_H
33 #define ROHC_COMMON_CRC_H
38 # include <linux/types.h>
44 #define CRC_INIT_3 0x7
46 #define CRC_INIT_7 0x7f
48 #define CRC_INIT_8 0xff
51 #define CRC_INIT_FCS32 0xffffffff
53 #define CRC_FCS32_LEN 4U
71 __attribute__((nonnull(1), warn_unused_result));
74 const uint8_t *
const data,
76 const uint8_t init_val,
77 const uint8_t *
const crc_table)
78 __attribute__((nonnull(2, 5), warn_unused_result));
82 const uint32_t init_val)
83 __attribute__((nonnull(1), warn_unused_result, pure));
86 const uint8_t *
const inner_ip,
87 const uint8_t *
const next_header,
89 const uint8_t init_val,
90 const uint8_t *
const crc_table)
91 __attribute__((nonnull(1, 6), warn_unused_result));
93 const uint8_t *
const inner_ip,
94 const uint8_t *
const next_header,
96 const uint8_t init_val,
97 const uint8_t *
const crc_table)
98 __attribute__((nonnull(1, 6), warn_unused_result));
101 const uint8_t *
const inner_ip,
102 const uint8_t *
const next_header,
104 const uint8_t init_val,
105 const uint8_t *
const crc_table)
106 __attribute__((nonnull(1, 3, 6), warn_unused_result));
108 const uint8_t *
const inner_ip,
109 const uint8_t *
const next_header,
111 const uint8_t init_val,
112 const uint8_t *
const crc_table)
113 __attribute__((nonnull(1, 3, 6), warn_unused_result));
116 const uint8_t *
const inner_ip,
117 const uint8_t *
const next_header,
119 const uint8_t init_val,
120 const uint8_t *
const crc_table)
121 __attribute__((nonnull(1, 3, 6), warn_unused_result));
123 const uint8_t *
const inner_ip,
124 const uint8_t *
const next_header,
126 const uint8_t init_val,
127 const uint8_t *
const crc_table)
128 __attribute__((nonnull(1, 3, 6), warn_unused_result));
131 const uint8_t *
const inner_ip,
132 const uint8_t *
const next_header,
134 const uint8_t init_val,
135 const uint8_t *
const crc_table)
136 __attribute__((nonnull(1, 3, 6), warn_unused_result));
138 const uint8_t *
const inner_ip,
139 const uint8_t *
const next_header,
141 const uint8_t init_val,
142 const uint8_t *
const crc_table)
143 __attribute__((nonnull(1, 3, 6), warn_unused_result));
uint8_t esp_compute_crc_dynamic(const uint8_t *const outer_ip, const uint8_t *const inner_ip, const uint8_t *const next_header, const rohc_crc_type_t crc_type, const uint8_t init_val, const uint8_t *const crc_table)
Compute the CRC-DYNAMIC part of an ESP header.
Definition: crc.c:597
uint8_t udp_compute_crc_dynamic(const uint8_t *const outer_ip, const uint8_t *const inner_ip, const uint8_t *const next_header, const rohc_crc_type_t crc_type, const uint8_t init_val, const uint8_t *const crc_table)
Compute the CRC-DYNAMIC part of an UDP or UDP-Lite header.
Definition: crc.c:518
uint8_t esp_compute_crc_static(const uint8_t *const outer_ip, const uint8_t *const inner_ip, const uint8_t *const next_header, const rohc_crc_type_t crc_type, const uint8_t init_val, const uint8_t *const crc_table)
Compute the CRC-STATIC part of an ESP header.
Definition: crc.c:558
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, const uint8_t *const crc_table)
Calculate the checksum for the given data.
Definition: crc.c:234
bool rohc_crc_init_table(uint8_t *const table, const rohc_crc_type_t crc_type)
Initialize a CRC table given a 256-byte table and the CRC type to use.
Definition: crc.c:178
uint8_t compute_crc_static(const uint8_t *const outer_ip, const uint8_t *const inner_ip, const uint8_t *const next_header, const rohc_crc_type_t crc_type, const uint8_t init_val, const uint8_t *const crc_table)
Compute the CRC-STATIC part of an IP header.
Definition: crc.c:309
rohc_crc_type_t
Definition: crc.h:56
uint8_t compute_crc_dynamic(const uint8_t *const outer_ip, const uint8_t *const inner_ip, const uint8_t *const next_header, const rohc_crc_type_t crc_type, const uint8_t init_val, const uint8_t *const crc_table)
Compute the CRC-DYNAMIC part of an IP header.
Definition: crc.c:402
uint8_t rtp_compute_crc_dynamic(const uint8_t *const outer_ip, const uint8_t *const inner_ip, const uint8_t *const next_header, const rohc_crc_type_t crc_type, const uint8_t init_val, const uint8_t *const crc_table)
Compute the CRC-DYNAMIC part of a RTP header.
Definition: crc.c:681
uint8_t udp_compute_crc_static(const uint8_t *const outer_ip, const uint8_t *const inner_ip, const uint8_t *const next_header, const rohc_crc_type_t crc_type, const uint8_t init_val, const uint8_t *const crc_table)
Compute the CRC-STATIC part of an UDP or UDP-Lite header.
Definition: crc.c:479
uint8_t rtp_compute_crc_static(const uint8_t *const outer_ip, const uint8_t *const inner_ip, const uint8_t *const next_header, const rohc_crc_type_t crc_type, const uint8_t init_val, const uint8_t *const crc_table)
Compute the CRC-STATIC part of a RTP header.
Definition: crc.c:637
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.
Definition: crc.c:274