hans-2.6.0.0: IPv4 Network Stack

Safe HaskellNone
LanguageHaskell98

Hans.Layer.Tcp.Window

Synopsis

Documentation

data RemoteWindow Source

Remote window management.

Instances

emptyRemoteWindow :: Word16 -> Int -> RemoteWindow Source

The empty window, seeded with an initial size.

refreshRemoteWindow :: RemoteWindow -> RemoteWindow Source

Recalculate internal constants of the remote window.

setSndWindScale :: Int -> RemoteWindow -> RemoteWindow Source

Set the Snd.Wind.Scale variable for the remote window.

setSndWind :: Word16 -> RemoteWindow -> RemoteWindow Source

Set the Snd.Wind variable for the remote window.

releaseSpace :: Word32 -> RemoteWindow -> RemoteWindow Source

Adjust the internal available counter.

addSegment :: OutSegment -> RemoteWindow -> RemoteWindow Source

Add a segment to the window.

receiveAck :: TcpHeader -> RemoteWindow -> Maybe (OutSegment, RemoteWindow) Source

Process an incoming ack, returning a finalizer, and a new window if there was a matching set of packets waiting for an ack.

genRetransmitSegments :: RemoteWindow -> (OutSegments, RemoteWindow) Source

Update the RTO timer on all segments waiting for an ack. When the timer runs out, output the segment for retransmission.

data OutSegment Source

A delivered segment.

Constructors

OutSegment 

Fields

outAckNum :: !TcpSeqNum
 
outTime :: !POSIXTime
 
outFresh :: !Bool

Whether or not this is a retransmission

outRTO :: !Int

Retransmit timer for this segment

outHeader :: !TcpHeader
 
outBody :: !ByteString
 

Instances

ctlLength :: Num len => Bool -> len Source

outSize' :: Num a => TcpHeader -> ByteString -> a Source

The size of a segment body.

decrementRTO :: OutSegment -> OutSegment Source

Decrement the RTO value on a segment by the timer granularity (500ms). Once the RTO value dips below 1, mark the segment as no longer fresh.

data LocalWindow Source

Local window, containing a buffer of incoming packets, indexed by their sequence number, relative to RCV.NXT.

XXX make this respect the values of size and available

Instances

emptyLocalWindow :: TcpSeqNum -> Word16 -> Int -> LocalWindow Source

Empty local buffer, with an initial sequence number as the next expected sequence number.

localWindowSackBlocks :: LocalWindow -> Seq SackBlock Source

Produce a sequence of blocks for the sack option.

refreshLocalWindow :: LocalWindow -> LocalWindow Source

Recalculate internal constants.

setRcvNxt :: TcpSeqNum -> LocalWindow -> LocalWindow Source

Update the size of the remote window.

addRcvNxt :: TcpSeqNum -> LocalWindow -> LocalWindow Source

Add a sequence number to the value of Rcv.Nxt.

setRcvWind :: Word16 -> LocalWindow -> LocalWindow Source

Set the Rcv.Wind variable for the local window.

setRcvWindScale :: Int -> LocalWindow -> LocalWindow Source

Set the Rcv.Wind.Scale variable in the local window.

incomingPacket :: TcpHeader -> ByteString -> LocalWindow -> (Seq InSegment, LocalWindow) Source

Process an incoming packet that needs to pass through the incoming queue.

addInSegment :: TcpHeader -> ByteString -> LocalWindow -> LocalWindow Source

Queue an incoming packet in the incoming window.

stepWindow :: LocalWindow -> (Seq InSegment, LocalWindow) Source

Advance the window, if there are packets available to be returned.

mkInSegment :: TcpSeqNum -> TcpHeader -> ByteString -> InSegment Source

Generate an incoming segment, relative to the value of RCV.NXT