hans-2.4.0.0: IPv4 Network Stack

Safe HaskellNone
LanguageHaskell98

Hans.Message.Tcp

Synopsis

Documentation

type TcpAckNum = TcpSeqNum Source

An alias to TcpSeqNum, as these two are used in the same role.

tcpFixedHeaderLength :: Int Source

The length of the fixed part of the TcpHeader, in 4-byte octets.

putTcpHeader :: Putter TcpHeader Source

Render a TcpHeader. The checksum value is never rendered, as it is expected to be calculated and poked in afterwords.

getTcpHeader :: Get (TcpHeader, Int) Source

Parse out a TcpHeader, and its length. The resulting length is in bytes, and is derived from the data offset.

putTcpControl :: Putter TcpHeader Source

Render out the Word8 that contains the Control field of the TcpHeader.

setTcpControl :: Word8 -> TcpHeader -> TcpHeader Source

Parse out the control flags from the octet that contains them.

data SackBlock Source

Constructors

SackBlock 

tcpOptionsLength :: [TcpOption] -> (Int, Int) Source

Get the rendered length of a list of TcpOptions, in 4-byte words, and the number of padding bytes required. This rounds up to the nearest 4-byte word.

getTcpOptions :: Get [TcpOption] Source

Parse in known tcp options.

getTcpPacket :: Get (TcpHeader, ByteString) Source

Parse a TcpPacket.

putTcpPacket :: TcpHeader -> ByteString -> Put Source

Render out a TcpPacket, without calculating its checksum.

renderWithTcpChecksumIP4 :: IP4 -> IP4 -> TcpHeader -> ByteString -> ByteString Source

Calculate the checksum of a TcpHeader, and its body.

computeTcpChecksumIP4 :: IP4 -> IP4 -> TcpHeader -> ByteString -> (ByteString, Word16) Source

Calculate the checksum of a tcp packet, and return its rendered header.

validateTcpChecksumIP4 :: IP4 -> IP4 -> ByteString -> Bool Source

Re-create the checksum, minimizing duplication of the original, rendered TCP packet.