| 
    ROHC compression/decompression library
    
   | 
 
ROHC CRC routines. More...
#include "ip.h"#include "protocols/udp.h"#include "protocols/rtp.h"#include "protocols/esp.h"#include "protocols/tcp.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 | |
| 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.  More... | |
| 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.  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 | 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.  More... | |
| 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.  More... | |
| 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.  More... | |
| 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.  More... | |
| 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.  More... | |
| 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.  More... | |
| 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.  More... | |
| 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.  More... | |
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_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.
Concerned fields are:
| outer_ip | The outer IP packet | 
| inner_ip | 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 | 
| crc_table | The pre-computed table for fast CRC computation | 
| 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.
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.
| outer_ip | The outer IP packet | 
| inner_ip | 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 | 
| crc_table | The pre-computed table for fast CRC computation | 
| 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.
| data | The data to compute the CRC for | 
| length | The size of the data | 
| init_val | The initial value of the CRC | 
| 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.
| 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 | 
| crc_table | The pre-computed table for fast CRC computation | 
      
  | 
  inlinestatic | 
Compute the CRC-DYNAMIC part of an ESP header.
Concerned fields are:
| outer_ip | The outer IP packet | 
| inner_ip | 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 | 
| crc_table | The pre-computed table for fast CRC computation | 
      
  | 
  inlinestatic | 
Compute the CRC-STATIC part of an ESP header.
Concerned fields are: all fields expect those for CRC-DYNAMIC
| outer_ip | The outer IP packet | 
| inner_ip | 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 | 
| crc_table | The pre-computed table for fast CRC computation | 
| 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.
Public functions
| table | IN/OUT: The 256-byte table to initialize | 
| crc_type | The type of CRC to initialize the table for | 
      
  | 
  inlinestatic | 
Compute the CRC-DYNAMIC part of a RTP header.
Concerned fields are:
| outer_ip | The outer IP packet | 
| inner_ip | 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 | 
| crc_table | The pre-computed table for fast CRC computation | 
      
  | 
  inlinestatic | 
Compute the CRC-STATIC part of a RTP header.
Concerned fields are: all fields expect those for CRC-DYNAMIC
| outer_ip | The outer IP packet | 
| inner_ip | 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 | 
| crc_table | The pre-computed table for fast CRC computation | 
      
  | 
  inlinestatic | 
Compute the CRC-DYNAMIC part of an UDP or UDP-Lite header.
Concerned fields are:
| outer_ip | The outer IP packet | 
| inner_ip | 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 | 
| crc_table | The pre-computed table for fast CRC computation | 
      
  | 
  inlinestatic | 
Compute the CRC-STATIC part of an UDP or UDP-Lite header.
Concerned fields are: all fields expect those for CRC-DYNAMIC
| outer_ip | The outer IP packet | 
| inner_ip | 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 | 
| crc_table | The pre-computed table for fast CRC computation | 
 1.8.13