/* This checksum is specific to the packet format above. This is not a full implementation of the checksum algorithm. Instead, as much as possible is precalculated to reduce the amount of computation needed. This calculation is accurate for total lengths up to 42457.  */
static uint16_t calc_checksum(uint16_t total_len)
/* This checksum is specific to the packet format above. This is not a full implementation of the checksum algorithm. Instead, as much as possible is precalculated to reduce the amount of computation needed. This calculation is accurate for total lengths up to 42457.  */
static uint16_t calc_checksum(uint16_t total_len)
{
    return ~(23078 + total_len);
}