- generic Queue implemented - PacketRegistry allocation bug fixed - TCP implementation initials - ALIGN to type macros added
12 lines
393 B
C
12 lines
393 B
C
#include <stdbool.h>
|
|
|
|
#include "tcp_udp_common.h"
|
|
#include "../../utils.h"
|
|
|
|
uint16_t tcp_udp_checksum(const IPv4PseudoHeader *pseudoHeader, const uint8_t * hdr, uint32_t size) {
|
|
uint32_t sum = chksum((const uint8_t *) pseudoHeader, sizeof(IPv4PseudoHeader), true) + chksum(hdr, size, true);
|
|
while (sum >> 16) {
|
|
sum = (sum & 0xFFFF) + (sum >> 16);
|
|
}
|
|
return htonl(sum);
|
|
} |