Tip: Networking Utilities - ANLAB-KAIST/KENSv3 GitHub Wiki
KENS offers the following networking utility functions for ease of development.
TCP Checksum Calculation
The NetworkUtil::tcp_sum
function calculates TCP checksum as described in RFC 793.
It receives source
and dest
IPs to construct a pseudo header.
Integer-Array Conversion
KENS's ipv4_t
and mac_t
are just aliases of std::array
.
Use arrayToUINT64
and UINT64ToArray
functions to convert between uint64_t
and the address types.
Example
mac_t mac = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
uint64_t mac_int = NetworkUtil::arrayToUINT64(mac);