12 void Header::chk_incr16(u16 prev, u16 next) {
14 u16 tmp[2] = {u16(~prev), next};
15 data[8] = satcat5::ip::checksum(2, tmp,
chk());
18 void Header::chk_incr32(u32 prev, u32 next) {
20 u32 tmp[2] = {u32(~prev), next};
21 data[8] = satcat5::ip::checksum(4, (u16*)tmp,
chk());
25 unsigned hdr = 2 *
ihl();
26 for (
unsigned a = 0 ; a < hdr ; ++a)
27 wr->write_u16(
data[a]);
35 for (
unsigned a = 0 ; a < tcp::HDR_MIN_SHORTS ; ++a)
36 data[a] = rd->read_u16();
39 return ihl() >= tcp::HDR_MIN_WORDS;
47 unsigned hdr = 2 *
ihl();
48 unsigned rem = 2 * hdr - tcp::HDR_MIN_BYTES;
52 for (
unsigned a = tcp::HDR_MIN_SHORTS ; a < hdr ; ++a)
53 data[a] = rd->read_u16();
Abstract API for reading byte-streams and packets.
virtual unsigned get_read_ready() const =0
How many bytes can be read without blocking?
Abstract API for writing byte-streams and packets.
"Readable" I/O interface core definitions
"Writeable" I/O interface core definitions
Type definitions for manipulating TCP segments.