hans-3.0.2: Network Stack

Safe HaskellNone
LanguageHaskell2010

Hans.Tcp.State

Contents

Synopsis

Tcp State

Responder Interaction

data TcpResponderRequest Source #

Requests that can be made to the responder thread.

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

data Key Source #

Instances

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.

Sequence Numbers

nextIss :: HasTcpState state => state -> Addr -> TcpPort -> Addr -> TcpPort -> IO TcpSeqNum Source #