| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Network.Control
Description
Common parts to control network protocols.
This library assumes that Int is 64bit.
Synopsis
- defaultMaxStreams :: Int
- defaultMaxStreamData :: Int
- defaultMaxData :: Int
- data TxFlow = TxFlow {}
- newTxFlow :: WindowSize -> TxFlow
- txWindowSize :: TxFlow -> WindowSize
- type WindowSize = Int
- data RxFlow = RxFlow {
- rxfBufSize :: Int
- rxfConsumed :: Int
- rxfReceived :: Int
- rxfLimit :: Int
- newRxFlow :: WindowSize -> RxFlow
- data FlowControlType
- maybeOpenRxWindow :: Int -> FlowControlType -> RxFlow -> (RxFlow, Maybe Int)
- checkRxLimit :: Int -> RxFlow -> (RxFlow, Bool)
- empty :: Int -> LRUCache k v
- lookup :: Ord k => k -> LRUCache k v -> Maybe v
- delete :: Ord k => k -> LRUCache k v -> LRUCache k v
- insert :: Ord k => k -> v -> LRUCache k v -> LRUCache k v
- data LRUCache k v
- data Rate
- newRate :: IO Rate
- getRate :: Rate -> IO Int
- addRate :: Rate -> Int -> IO Int
Documentation
Default max streams. (64)
Default max data of a stream. (256K bytes)
defaultMaxData :: Int #
Default max data of a connection. (1M bytes)
Flow for sending
-------------------------------------->
^ ^
txfSent txfLimit
|-----------| The size which this node can send
txWindowSize
Constructors
| TxFlow | |
newTxFlow :: WindowSize -> TxFlow #
Creating TX flow with a receive buffer size.
txWindowSize :: TxFlow -> WindowSize #
type WindowSize = Int #
Window size.
Flow for receiving.
rxfBufSize
|------------------------|
-------------------------------------->
^ ^ ^
rxfConsumed rxfReceived rxfLimit
|-----------| The size which the peer can send
Window
Constructors
| RxFlow | |
Fields
| |
newRxFlow :: WindowSize -> RxFlow #
Creating RX flow with an initial window size.
data FlowControlType #
The representation of window size update.
Constructors
| FCTWindowUpdate | HTTP/2 style |
| FCTMaxData | QUIC style |
Arguments
| :: Int | The consumed size. |
| -> FlowControlType | |
| -> RxFlow | |
| -> (RxFlow, Maybe Int) |
|
When an application consumed received data, this function should
be called to update rxfConsumed. If the available buffer size
is less than the half of the total buffer size.
the representation of window size update is returned.
Example:
rxfBufSize
|------------------------|
-------------------------------------->
^ ^ ^
rxfConsumed rxfReceived rxfLimit
|01234567890|
In the case where the window update should be informed to the peer,
rxfConsumed and rxfLimit move to the right. The difference
of old and new rxfLimit is window update.
rxfBufSize
|------------------------|
-------------------------------------->
^ ^ ^
rxfConsumed rxfReceived rxfLimit
|0123456789012| : window glows
Otherwise, only rxfConsumed moves to the right.
rxfBufSize
|------------------------|
-------------------------------------->
^ ^ ^
rxfConsumed rxfReceived rxfLimit
|01234567890| : window stays
Checking if received data is acceptable against the current window.
Getting the current rate. If one or more seconds have passed since the previous call, the counter is re-initialized with 1 and it is returned. Otherwise, incremented counter number is returned.