| Safe Haskell | None | 
|---|---|
| Language | Haskell2010 | 
Hans.Tcp.State
Contents
- class HasTcpState state where
 - data TcpState
 - newTcpState :: Config -> IO TcpState
 - tcpQueue :: HasTcpState state => Getting r state (BoundedChan TcpResponderRequest)
 - data TcpResponderRequest
- = SendSegment !(RouteInfo Addr) !Addr !TcpHeader !ByteString
 - | SendWithTcb !Tcb !TcpHeader !ByteString
 
 - incrSynBacklog :: HasTcpState state => state -> IO ()
 - decrSynBacklog :: HasTcpState state => state -> IO Bool
 - registerListening :: HasTcpState state => state -> ListenTcb -> IO Bool
 - lookupListening :: HasTcpState state => state -> Addr -> TcpPort -> IO (Maybe ListenTcb)
 - deleteListening :: HasTcpState state => state -> ListenTcb -> IO ()
 - data Key
 - tcbKey :: Getting r Tcb Key
 - tcpActive :: HasTcpState state => Getting r state (HashTable Key Tcb)
 - lookupActive :: HasTcpState state => state -> Addr -> TcpPort -> Addr -> TcpPort -> IO (Maybe Tcb)
 - registerActive :: HasTcpState state => state -> Tcb -> IO Bool
 - closeActive :: HasTcpState state => state -> Tcb -> IO ()
 - deleteActive :: HasTcpState state => state -> Tcb -> IO ()
 - registerTimeWait :: (HasConfig state, HasTcpState state) => state -> TimeWaitTcb -> IO ()
 - lookupTimeWait :: HasTcpState state => state -> Addr -> TcpPort -> Addr -> TcpPort -> IO (Maybe TimeWaitTcb)
 - resetTimeWait :: (HasConfig state, HasTcpState state) => state -> TimeWaitTcb -> IO ()
 - deleteTimeWait :: HasTcpState state => state -> TimeWaitTcb -> IO ()
 - nextTcpPort :: HasTcpState state => state -> Addr -> Addr -> TcpPort -> IO (Maybe TcpPort)
 - nextIss :: HasTcpState state => state -> Addr -> TcpPort -> Addr -> TcpPort -> IO TcpSeqNum
 
Tcp State
Responder Interaction
tcpQueue :: HasTcpState state => Getting r state (BoundedChan TcpResponderRequest) Source #
data TcpResponderRequest Source #
Requests that can be made to the responder thread.
Constructors
| SendSegment !(RouteInfo Addr) !Addr !TcpHeader !ByteString | |
| SendWithTcb !Tcb !TcpHeader !ByteString | 
Listen Sockets
incrSynBacklog :: HasTcpState state => state -> IO () Source #
Yield back an entry in the Syn backlog.
decrSynBacklog :: HasTcpState state => state -> IO Bool Source #
Returns True when there is space in the Syn backlog, and False if the
 connection should be rejected.
registerListening :: HasTcpState state => state -> ListenTcb -> IO Bool Source #
Register a new listening socket.
lookupListening :: HasTcpState state => state -> Addr -> TcpPort -> IO (Maybe ListenTcb) Source #
Lookup a socket in the Listen state.
deleteListening :: HasTcpState state => state -> ListenTcb -> IO () Source #
Remove a listening socket.
Active Sockets
lookupActive :: HasTcpState state => state -> Addr -> TcpPort -> Addr -> TcpPort -> IO (Maybe Tcb) Source #
Lookup an active socket.
registerActive :: HasTcpState state => state -> Tcb -> IO Bool Source #
Register a new active socket.
closeActive :: HasTcpState state => state -> Tcb -> IO () Source #
Delete the Tcb, and notify any waiting processes.
deleteActive :: HasTcpState state => state -> Tcb -> IO () Source #
Delete an active connection from the tcp state.
TimeWait Sockets
registerTimeWait :: (HasConfig state, HasTcpState state) => state -> TimeWaitTcb -> IO () Source #
Register a socket in the TimeWait state. If the heap was empty, fork off a thread to reap its contents after the timeWaitTimeout.
NOTE: this doesn't remove the original socket from the Active set.
lookupTimeWait :: HasTcpState state => state -> Addr -> TcpPort -> Addr -> TcpPort -> IO (Maybe TimeWaitTcb) Source #
Lookup a socket in the TimeWait state.
resetTimeWait :: (HasConfig state, HasTcpState state) => state -> TimeWaitTcb -> IO () Source #
Reset the timer associated with a TimeWaitTcb.
deleteTimeWait :: HasTcpState state => state -> TimeWaitTcb -> IO () Source #
Delete an entry from the TimeWait heap.
Port Management
nextTcpPort :: HasTcpState state => state -> Addr -> Addr -> TcpPort -> IO (Maybe TcpPort) Source #
Pick a fresh port for a connection.