Copyright | (c) 2019 Jack Kelly |
---|---|
License | GPL-3.0-or-later |
Maintainer | jack@jackkelly.name |
Stability | experimental |
Portability | non-portable |
Safe Haskell | None |
Language | Haskell2010 |
How to run a libtelnet state tracker off Reflex Event
s:
- Construct a
TelnetConfig
by usingdef
to get an empty config, and then fill it out using record updates or lenses. - Start a state tracker by calling
telnet
on your config. - Wire the events from the returned
TelnetEvents
into the rest of your application.
Synopsis
- telnet :: forall t m. (MonadIO m, MonadIO (Performable m), PerformEvent t m, TriggerEvent t m) => TelnetConfig t -> m (TelnetEvents t)
- data TelnetConfig t = TelnetConfig {
- _cOptions :: [OptionSpec]
- _cFlags :: [Flag]
- _cRecv :: Event t ByteString
- _cSend :: Event t ByteString
- _cIac :: Event t Iac
- _cNegotiate :: Event t (Iac, Option)
- _cSubnegotiation :: Event t (Option, ByteString)
- _cBeginCompress2 :: Event t ()
- _cNewEnvironSend :: Event t [(Var, ByteString)]
- _cNewEnviron :: Event t (IsInfo, [(Var, ByteString, ByteString)])
- _cTTypeSend :: Event t ()
- _cTTypeIs :: Event t ByteString
- _cSendZmp :: Event t [ByteString]
- _cSendMssp :: Event t [(ByteString, [ByteString])]
- data TelnetEvents t = TelnetEvents {
- _eReceived :: Event t ByteString
- _eSend :: Event t ByteString
- _eWarning :: Event t Err
- _eError :: Event t Err
- _eIac :: Event t Iac
- _eWill :: Event t Option
- _eWont :: Event t Option
- _eDo :: Event t Option
- _eDont :: Event t Option
- _eSubnegotiation :: Event t (Option, ByteString)
- _eZmp :: Event t [ByteString]
- _eTerminalTypeSend :: Event t ()
- _eTerminalTypeIs :: Event t ByteString
- _eCompress :: Event t Bool
- _eEnvironSend :: Event t [(Var, ByteString)]
- _eEnviron :: Event t (IsInfo, [(Var, ByteString, ByteString)])
- _eMssp :: Event t [(ByteString, [ByteString])]
- _eException :: Event t TelnetException
- cOptions :: forall t. Lens' (TelnetConfig t) [OptionSpec]
- cFlags :: forall t. Lens' (TelnetConfig t) [Flag]
- cRecv :: forall t. Lens' (TelnetConfig t) (Event t ByteString)
- cSend :: forall t. Lens' (TelnetConfig t) (Event t ByteString)
- cIac :: forall t. Lens' (TelnetConfig t) (Event t Iac)
- cNegotiate :: forall t. Lens' (TelnetConfig t) (Event t (Iac, Option))
- cSubnegotiation :: forall t. Lens' (TelnetConfig t) (Event t (Option, ByteString))
- cBeginCompress2 :: forall t. Lens' (TelnetConfig t) (Event t ())
- cNewEnvironSend :: forall t. Lens' (TelnetConfig t) (Event t [(Var, ByteString)])
- cNewEnviron :: forall t. Lens' (TelnetConfig t) (Event t (IsInfo, [(Var, ByteString, ByteString)]))
- cTTypeSend :: forall t. Lens' (TelnetConfig t) (Event t ())
- cTTypeIs :: forall t. Lens' (TelnetConfig t) (Event t ByteString)
- cSendZmp :: forall t. Lens' (TelnetConfig t) (Event t [ByteString])
- cSendMssp :: forall t. Lens' (TelnetConfig t) (Event t [(ByteString, [ByteString])])
- eReceived :: forall t. Lens' (TelnetEvents t) (Event t ByteString)
- eSend :: forall t. Lens' (TelnetEvents t) (Event t ByteString)
- eWarning :: forall t. Lens' (TelnetEvents t) (Event t Err)
- eError :: forall t. Lens' (TelnetEvents t) (Event t Err)
- eIac :: forall t. Lens' (TelnetEvents t) (Event t Iac)
- eWill :: forall t. Lens' (TelnetEvents t) (Event t Option)
- eWont :: forall t. Lens' (TelnetEvents t) (Event t Option)
- eDo :: forall t. Lens' (TelnetEvents t) (Event t Option)
- eDont :: forall t. Lens' (TelnetEvents t) (Event t Option)
- eSubnegotiation :: forall t. Lens' (TelnetEvents t) (Event t (Option, ByteString))
- eZmp :: forall t. Lens' (TelnetEvents t) (Event t [ByteString])
- eTerminalTypeSend :: forall t. Lens' (TelnetEvents t) (Event t ())
- eTerminalTypeIs :: forall t. Lens' (TelnetEvents t) (Event t ByteString)
- eCompress :: forall t. Lens' (TelnetEvents t) (Event t Bool)
- eEnvironSend :: forall t. Lens' (TelnetEvents t) (Event t [(Var, ByteString)])
- eEnviron :: forall t. Lens' (TelnetEvents t) (Event t (IsInfo, [(Var, ByteString, ByteString)]))
- eMssp :: forall t. Lens' (TelnetEvents t) (Event t [(ByteString, [ByteString])])
- eException :: forall t. Lens' (TelnetEvents t) (Event t TelnetException)
Documentation
telnet :: forall t m. (MonadIO m, MonadIO (Performable m), PerformEvent t m, TriggerEvent t m) => TelnetConfig t -> m (TelnetEvents t) Source #
Process telnet streams using
libtelnet. The
easiest way to get a
is through its TelnetConfig
tDefault
instance; see TelnetConfig
for details.
Since: 0.1.0.0
Input Events
data TelnetConfig t Source #
A
contains all the input events for a telnet
state tracker. When passed to TelnetConfig
ttelnet
, the network will call each
libtelnet function when its corresponding event fires. An "input
event" describes all events the state tracker listens to; it
doesn't care whether the events are coming from "above" or "below"
itself in the application stack. Data arriving on the socket
(_cRecv
) is an "input event" from "below"; data pasing through
libtelnet on its way out to the socket (_cSend
) is also an "input
event", but from "above".
You will almost certainly want to:
- use
def
to get an emptyTelnetConfig
; - replace the
_cRecv
event with incoming socket data; and - replace the
_cSend
event with outgoing data from your application.
Since: 0.1.0.0
TelnetConfig | |
|
Instances
Reflex t => Default (TelnetConfig t) Source # | No options set and all events are Since: 0.1.0.0 |
Defined in Reflex.LibTelnet def :: TelnetConfig t # |
Output Events
data TelnetEvents t Source #
The libtelnet Event
type is fanned out into a set of
individual "output events". An "output event" describes all events
that should be listened to, regardless of whether they are going
"up" or "down" the application stack: parsed data (_eReceived
) is
an "output event" that should be listened to by the layer "above";
encoded data that should go to a socket (_eSend
) is also an
"output event", but listened to by the layer below.
Since: 0.1.0.0
TelnetEvents | |
|
Lenses
TelnetConfig
cOptions :: forall t. Lens' (TelnetConfig t) [OptionSpec] Source #
cRecv :: forall t. Lens' (TelnetConfig t) (Event t ByteString) Source #
cSend :: forall t. Lens' (TelnetConfig t) (Event t ByteString) Source #
cNegotiate :: forall t. Lens' (TelnetConfig t) (Event t (Iac, Option)) Source #
cSubnegotiation :: forall t. Lens' (TelnetConfig t) (Event t (Option, ByteString)) Source #
cBeginCompress2 :: forall t. Lens' (TelnetConfig t) (Event t ()) Source #
cNewEnvironSend :: forall t. Lens' (TelnetConfig t) (Event t [(Var, ByteString)]) Source #
cNewEnviron :: forall t. Lens' (TelnetConfig t) (Event t (IsInfo, [(Var, ByteString, ByteString)])) Source #
cTTypeSend :: forall t. Lens' (TelnetConfig t) (Event t ()) Source #
cTTypeIs :: forall t. Lens' (TelnetConfig t) (Event t ByteString) Source #
cSendZmp :: forall t. Lens' (TelnetConfig t) (Event t [ByteString]) Source #
cSendMssp :: forall t. Lens' (TelnetConfig t) (Event t [(ByteString, [ByteString])]) Source #
TelnetEvents
eReceived :: forall t. Lens' (TelnetEvents t) (Event t ByteString) Source #
eSend :: forall t. Lens' (TelnetEvents t) (Event t ByteString) Source #
eSubnegotiation :: forall t. Lens' (TelnetEvents t) (Event t (Option, ByteString)) Source #
eZmp :: forall t. Lens' (TelnetEvents t) (Event t [ByteString]) Source #
eTerminalTypeSend :: forall t. Lens' (TelnetEvents t) (Event t ()) Source #
eTerminalTypeIs :: forall t. Lens' (TelnetEvents t) (Event t ByteString) Source #
eEnvironSend :: forall t. Lens' (TelnetEvents t) (Event t [(Var, ByteString)]) Source #
eEnviron :: forall t. Lens' (TelnetEvents t) (Event t (IsInfo, [(Var, ByteString, ByteString)])) Source #
eMssp :: forall t. Lens' (TelnetEvents t) (Event t [(ByteString, [ByteString])]) Source #
eException :: forall t. Lens' (TelnetEvents t) (Event t TelnetException) Source #