SatCat5
satcat5::tcp::Header Struct Reference

Detailed Description

TCP header contents.

See also
tcp_core.h.

Definition at line 34 of file tcp_core.h.

#include <tcp_core.h>

Public Member Functions

 Header (const Header &t)=default
 
Headeroperator= (const Header &t)=default
 
constexpr satcat5::tcp::Port src () const
 < Source port
 
constexpr satcat5::tcp::Port dst () const
 < Destination port
 
constexpr unsigned ihl () const
 < Header length (4-byte words)
 
constexpr u16 chk () const
 < Checksum (incoming only)
 
void chk_incr16 (u16 prev, u16 next)
 Incremental update to checksum by replacing a given field. More...
 
void chk_incr32 (u32 prev, u32 next)
 
void write_to (satcat5::io::Writeable *wr) const
 Write TCP header to the designated stream.
 
bool read_core (satcat5::io::Readable *rd)
 Read a partial TCP header from the designated stream. More...
 
bool read_from (satcat5::io::Readable *rd)
 Read TCP header from the designated stream. More...
 

Public Attributes

u16 data [HDR_MAX_SHORTS]
 Raw access to the underlying header contents.
 

Member Function Documentation

◆ chk_incr16()

void Header::chk_incr16 ( u16  prev,
u16  next 
)

Incremental update to checksum by replacing a given field.

The before/after values can any location in the TCP psuedo-header Uses the ~m + m' method of RFC1624 Section 3.

Definition at line 12 of file tcp_core.cc.

◆ read_core()

bool Header::read_core ( satcat5::io::Readable rd)

Read a partial TCP header from the designated stream.

This method reads the first 20 bytes of a TCP header, which contains basic header fields but not variable-length options (i.e., OFFSET > 5). This is used in cases where the full header is unavailable or unnecessary (e.g., due to "peek" limits). To read the entire TCP checksum,

See also
read_from.
Returns
True if the partial header is valid, false otherwise.

Definition at line 30 of file tcp_core.cc.

◆ read_from()

bool Header::read_from ( satcat5::io::Readable rd)

Read TCP header from the designated stream.

This method calls read_core, then reads variable-length header options up to the start of user data. It does not validate the TCP checksum.

Returns
True if header is valid, false otherwise.

Definition at line 42 of file tcp_core.cc.


The documentation for this struct was generated from the following files: