32 #ifndef ROHC_COMMON_CRC_H 33 #define ROHC_COMMON_CRC_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)));
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));
102 const uint8_t *
const inner_ip,
103 const uint8_t *
const next_header,
105 const uint8_t init_val,
106 const uint8_t *
const crc_table)
107 __attribute__((nonnull(1, 3, 6), warn_unused_result));
110 const uint8_t *
const inner_ip,
111 const uint8_t *
const next_header,
113 const uint8_t init_val,
114 const uint8_t *
const crc_table)
115 __attribute__((nonnull(1, 3, 6), warn_unused_result));
119 const uint8_t *
const inner_ip,
120 const uint8_t *
const next_header,
122 const uint8_t init_val,
123 const uint8_t *
const crc_table)
124 __attribute__((nonnull(1, 3, 6), warn_unused_result));
127 const uint8_t *
const inner_ip,
128 const uint8_t *
const next_header,
130 const uint8_t init_val,
131 const uint8_t *
const crc_table)
132 __attribute__((nonnull(1, 3, 6), warn_unused_result));
136 const uint8_t *
const inner_ip,
137 const uint8_t *
const next_header,
139 const uint8_t init_val,
140 const uint8_t *
const crc_table)
141 __attribute__((nonnull(1, 3, 6), warn_unused_result));
144 const uint8_t *
const inner_ip,
145 const uint8_t *
const next_header,
147 const uint8_t init_val,
148 const uint8_t *
const crc_table)
149 __attribute__((nonnull(1, 3, 6), warn_unused_result));
168 const uint8_t *
const inner_ip,
169 const uint8_t *
const next_header,
171 const uint8_t init_val,
172 const uint8_t *
const crc_table)
174 uint8_t crc = init_val;
179 crc_type, crc, crc_table);
182 udp = (
struct udphdr *) next_header;
208 const uint8_t *
const inner_ip,
209 const uint8_t *
const next_header,
211 const uint8_t init_val,
212 const uint8_t *
const crc_table)
214 uint8_t crc = init_val;
219 crc_type, crc, crc_table);
222 udp = (
struct udphdr *) next_header;
249 const uint8_t *
const inner_ip,
250 const uint8_t *
const next_header,
252 const uint8_t init_val,
253 const uint8_t *
const crc_table)
255 uint8_t crc = init_val;
260 crc_type, crc, crc_table);
263 esp = (
struct esphdr *) next_header;
289 const uint8_t *
const inner_ip,
290 const uint8_t *
const next_header,
292 const uint8_t init_val,
293 const uint8_t *
const crc_table)
295 uint8_t crc = init_val;
300 crc_type, crc, crc_table);
303 esp = (
struct esphdr *) next_header;
330 const uint8_t *
const inner_ip,
331 const uint8_t *
const next_header,
333 const uint8_t init_val,
334 const uint8_t *
const crc_table)
336 uint8_t crc = init_val;
341 crc_type, crc, crc_table);
344 rtp = (
struct rtphdr *) (next_header +
sizeof(
struct udphdr));
347 crc =
crc_calculate(crc_type, (uint8_t *)rtp, 1, crc, crc_table);
375 const uint8_t *
const inner_ip,
376 const uint8_t *
const next_header,
378 const uint8_t init_val,
379 const uint8_t *
const crc_table)
381 uint8_t crc = init_val;
386 crc_type, crc, crc_table);
389 rtp = (
struct rtphdr *) (next_header +
sizeof(
struct udphdr));
uint16_t len
Definition: udp.h:42
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:223
uint32_t sn
Definition: esp.h:43
uint32_t spi
Definition: esp.h:42
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:298
The RTP header.
Definition: rtp.h:48
static 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.h:288
static 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.h:167
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:391
static 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.h:374
static 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.h:207
RTP header.
Definition: esp.h:40
void 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:176
static 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.h:248
static 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.h:329
uint16_t source
Definition: udp.h:40
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:263