Safe Haskell | None |
---|---|
Language | Haskell2010 |
- data Window
- emptyWindow :: TcpSeqNum -> TcpSeqNum -> TSClock -> Window
- sndNxt :: Getting r Window TcpSeqNum
- setSndNxt :: TcpSeqNum -> Window -> (Window, Bool)
- sndUna :: Getting r Window TcpSeqNum
- sndWnd :: Lens' Window TcpSeqNum
- nullWindow :: Window -> Bool
- fullWindow :: Window -> Bool
- flushWindow :: Window -> (Window, ())
- data TSClock
- initialTSClock :: Word32 -> UTCTime -> TSClock
- updateTSClock :: Config -> UTCTime -> TSClock -> TSClock
- tsVal :: Getting r TSClock Word32
- queueSegment :: Config -> UTCTime -> (Word32 -> TcpSeqNum -> TcpHeader) -> ByteString -> Window -> (Window, Maybe (Bool, TcpHeader, ByteString))
- retransmitTimeout :: Window -> (Window, Maybe (TcpHeader, ByteString))
- ackSegment :: Config -> UTCTime -> TcpSeqNum -> Window -> (Window, Maybe (Bool, Maybe NominalDiffTime))
- handleSack :: [SackBlock] -> Window -> (Window, [(TcpHeader, ByteString)])
Remote Window
This structure holds bookkeeping variables for the remote end's receive window, as well as the retransmit queue.
sndNxt :: Getting r Window TcpSeqNum Source #
The value of SND.NXT.
NOTE: SND.UNA <= SND.NXT < SND.UNA + SND.WND
setSndNxt :: TcpSeqNum -> Window -> (Window, Bool) Source #
Only sets the value of SND.NXT when the retransmit queue is empty.
sndUna :: Getting r Window TcpSeqNum Source #
The value of SND.UNA -- the left-edge of the send window.
nullWindow :: Window -> Bool Source #
True when the window is empty.
fullWindow :: Window -> Bool Source #
True when the window is full.
flushWindow :: Window -> (Window, ()) Source #
Remove everything from the remote window.
Timestamp Clock
updateTSClock :: Config -> UTCTime -> TSClock -> TSClock Source #
Update the timestamp clock, and return the new value of TSval.
Packet Processing
queueSegment :: Config -> UTCTime -> (Word32 -> TcpSeqNum -> TcpHeader) -> ByteString -> Window -> (Window, Maybe (Bool, TcpHeader, ByteString)) Source #
Returns the new send window, as well as boolean indicating whether or not the retransmit timer needs to be started.
retransmitTimeout :: Window -> (Window, Maybe (TcpHeader, ByteString)) Source #
A retransmit timer has gone off: reset the sack bit on all segments in the queue; if the left-edge exists, mark it as having been retransmitted, and return it back to be sent.
XXX: does this need to update the TS clock?
ackSegment :: Config -> UTCTime -> TcpSeqNum -> Window -> (Window, Maybe (Bool, Maybe NominalDiffTime)) Source #
Remove all segments of the send window that occur before this sequence
number, and increase the size of the available window. When the segment
doesn't acknowledge anything in the window, Nothing
as the second
parameter. Otherwise, return a boolean that is True
when there are no
outstanding segments, and a measurement of the RTT when the segment has not
been retransmitted.
Selective Ack
handleSack :: [SackBlock] -> Window -> (Window, [(TcpHeader, ByteString)]) Source #
Process a sack option, and return the updated window, and the segments that are missing from the remote window.