{-# LINE 1 "src/Network/Telnet/LibTelnet/Types.hsc" #-}
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE MultiWayIf #-}
{-# LANGUAGE RecordWildCards #-}
module Network.Telnet.LibTelnet.Types where
import Network.Telnet.LibTelnet.Iac
import Network.Telnet.LibTelnet.Options
import Control.Exception (Exception, throwIO)
import Data.Typeable (Typeable)
import Foreign
import Foreign.C
import GHC.Generics (Generic)
data TelnetT
data TelnetException
= NullTelnetPtr
| UnexpectedEventType TelnetEventTypeT
| UnexpectedEnvironCmd ECmd
| UnexpectedEnvironVar EVar
| UnexpectedTerminalTypeCmd TCmd
deriving (TelnetException -> TelnetException -> Bool
(TelnetException -> TelnetException -> Bool)
-> (TelnetException -> TelnetException -> Bool)
-> Eq TelnetException
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TelnetException -> TelnetException -> Bool
$c/= :: TelnetException -> TelnetException -> Bool
== :: TelnetException -> TelnetException -> Bool
$c== :: TelnetException -> TelnetException -> Bool
Eq, (forall x. TelnetException -> Rep TelnetException x)
-> (forall x. Rep TelnetException x -> TelnetException)
-> Generic TelnetException
forall x. Rep TelnetException x -> TelnetException
forall x. TelnetException -> Rep TelnetException x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TelnetException x -> TelnetException
$cfrom :: forall x. TelnetException -> Rep TelnetException x
Generic, Int -> TelnetException -> ShowS
[TelnetException] -> ShowS
TelnetException -> String
(Int -> TelnetException -> ShowS)
-> (TelnetException -> String)
-> ([TelnetException] -> ShowS)
-> Show TelnetException
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TelnetException] -> ShowS
$cshowList :: [TelnetException] -> ShowS
show :: TelnetException -> String
$cshow :: TelnetException -> String
showsPrec :: Int -> TelnetException -> ShowS
$cshowsPrec :: Int -> TelnetException -> ShowS
Show, Typeable)
instance Exception TelnetException
newtype Flag = Flag { Flag -> CUChar
unFlag :: CUChar }
flagProxy :: Flag
flagProxy :: Flag
flagProxy = CUChar -> Flag
Flag 1
{-# LINE 56 "src/Network/Telnet/LibTelnet/Types.hsc" #-}
data TelnetTeloptT = TelnetTeloptT
{ TelnetTeloptT -> CShort
_telopt :: CShort
, TelnetTeloptT -> Iac
_us :: Iac
, TelnetTeloptT -> Iac
_him :: Iac
}
instance Storable TelnetTeloptT where
sizeOf :: TelnetTeloptT -> Int
sizeOf _ = ((4))
{-# LINE 66 "src/Network/Telnet/LibTelnet/Types.hsc" #-}
alignment _ = (2)
{-# LINE 67 "src/Network/Telnet/LibTelnet/Types.hsc" #-}
peek :: Ptr TelnetTeloptT -> IO TelnetTeloptT
peek p :: Ptr TelnetTeloptT
p = do
CShort
telopt <- ((\hsc_ptr :: Ptr TelnetTeloptT
hsc_ptr -> Ptr TelnetTeloptT -> Int -> IO CShort
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr TelnetTeloptT
hsc_ptr 0)) Ptr TelnetTeloptT
p
{-# LINE 70 "src/Network/Telnet/LibTelnet/Types.hsc" #-}
us <- ((\hsc_ptr -> peekByteOff hsc_ptr 2)) p
{-# LINE 71 "src/Network/Telnet/LibTelnet/Types.hsc" #-}
him <- ((\hsc_ptr -> peekByteOff hsc_ptr 3)) p
{-# LINE 72 "src/Network/Telnet/LibTelnet/Types.hsc" #-}
TelnetTeloptT -> IO TelnetTeloptT
forall (f :: * -> *) a. Applicative f => a -> f a
pure (TelnetTeloptT -> IO TelnetTeloptT)
-> TelnetTeloptT -> IO TelnetTeloptT
forall a b. (a -> b) -> a -> b
$ CShort -> Iac -> Iac -> TelnetTeloptT
TelnetTeloptT CShort
telopt Iac
us Iac
him
poke :: Ptr TelnetTeloptT -> TelnetTeloptT -> IO ()
poke p :: Ptr TelnetTeloptT
p TelnetTeloptT{..} = do
((\hsc_ptr :: Ptr TelnetTeloptT
hsc_ptr -> Ptr TelnetTeloptT -> Int -> CShort -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr TelnetTeloptT
hsc_ptr 0)) Ptr TelnetTeloptT
p CShort
_telopt
{-# LINE 77 "src/Network/Telnet/LibTelnet/Types.hsc" #-}
((\hsc_ptr -> pokeByteOff hsc_ptr 2)) p _us
{-# LINE 78 "src/Network/Telnet/LibTelnet/Types.hsc" #-}
((\hsc_ptr -> pokeByteOff hsc_ptr 3)) p _him
{-# LINE 79 "src/Network/Telnet/LibTelnet/Types.hsc" #-}
data EventT
= Data (CString, CSize)
| Send (CString, CSize)
| Warning ErrorT
| Error ErrorT
| Command Iac
| Will Option
| Wont Option
| Do Option
| Dont Option
| Subnegotiation Option (CString, CSize)
| Zmp (Ptr CString, CSize)
| TerminalType TCmd CString
| Compress CUChar
| Environ ECmd (Ptr TelnetEnvironT, CSize)
| Mssp (Ptr TelnetEnvironT, CSize)
instance Storable EventT where
sizeOf :: EventT -> Int
sizeOf _ = ((40))
{-# LINE 100 "src/Network/Telnet/LibTelnet/Types.hsc" #-}
alignment _ = (8)
{-# LINE 101 "src/Network/Telnet/LibTelnet/Types.hsc" #-}
peek :: Ptr EventT -> IO EventT
peek p :: Ptr EventT
p = do
TelnetEventTypeT
eType <- ((\hsc_ptr :: Ptr EventT
hsc_ptr -> Ptr EventT -> Int -> IO TelnetEventTypeT
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr EventT
hsc_ptr 0)) Ptr EventT
p
{-# LINE 104 "src/Network/Telnet/LibTelnet/Types.hsc" #-}
if | eType `elem` [eventData, eventSend] -> do
ctor <- if | eType == eventData -> pure Data
| eType == eventSend -> pure Send
| otherwise -> throwIO $ UnexpectedEventType eType
buffer <- ((\hsc_ptr -> peekByteOff hsc_ptr 8)) p
{-# LINE 109 "src/Network/Telnet/LibTelnet/Types.hsc" #-}
size <- ((\hsc_ptr -> peekByteOff hsc_ptr 16)) p
{-# LINE 110 "src/Network/Telnet/LibTelnet/Types.hsc" #-}
pure $ ctor (buffer, size)
| eType `elem` [eventWarning, eventError] -> do
ctor <- if | eType == eventWarning -> pure Warning
| eType == eventError -> pure Error
| otherwise -> throwIO $ UnexpectedEventType eType
file <- ((\hsc_ptr -> peekByteOff hsc_ptr 8)) p
{-# LINE 117 "src/Network/Telnet/LibTelnet/Types.hsc" #-}
func <- ((\hsc_ptr -> peekByteOff hsc_ptr 16)) p
{-# LINE 118 "src/Network/Telnet/LibTelnet/Types.hsc" #-}
msg <- ((\hsc_ptr -> peekByteOff hsc_ptr 24)) p
{-# LINE 119 "src/Network/Telnet/LibTelnet/Types.hsc" #-}
line <- ((\hsc_ptr -> peekByteOff hsc_ptr 32)) p
{-# LINE 120 "src/Network/Telnet/LibTelnet/Types.hsc" #-}
errcode <- ((\hsc_ptr -> peekByteOff hsc_ptr 36)) p
{-# LINE 121 "src/Network/Telnet/LibTelnet/Types.hsc" #-}
pure . ctor $ ErrorT file func msg line errcode
| eType == eventIac ->
Command <$> ((\hsc_ptr -> peekByteOff hsc_ptr 4)) p
{-# LINE 126 "src/Network/Telnet/LibTelnet/Types.hsc" #-}
| eType `elem` [eventWill, eventWont, eventDo, eventDont] -> do
ctor <- if | eType == eventWill -> pure Will
| eType == eventWont -> pure Wont
| eType == eventDo -> pure Do
| eType == eventDont -> pure Dont
| otherwise -> throwIO $ UnexpectedEventType eType
ctor <$> ((\hsc_ptr -> peekByteOff hsc_ptr 4)) p
{-# LINE 134 "src/Network/Telnet/LibTelnet/Types.hsc" #-}
| eType == eventSubnegotiation -> do
telopt <- ((\hsc_ptr -> peekByteOff hsc_ptr 24)) p
{-# LINE 137 "src/Network/Telnet/LibTelnet/Types.hsc" #-}
buffer <- ((\hsc_ptr -> peekByteOff hsc_ptr 8)) p
{-# LINE 138 "src/Network/Telnet/LibTelnet/Types.hsc" #-}
size <- ((\hsc_ptr -> peekByteOff hsc_ptr 16)) p
{-# LINE 139 "src/Network/Telnet/LibTelnet/Types.hsc" #-}
pure $ Subnegotiation telopt (buffer, size)
| eType == eventZmp -> do
argc <- ((\hsc_ptr -> peekByteOff hsc_ptr 16)) p
{-# LINE 144 "src/Network/Telnet/LibTelnet/Types.hsc" #-}
argv <- ((\hsc_ptr -> peekByteOff hsc_ptr 8)) p
{-# LINE 145 "src/Network/Telnet/LibTelnet/Types.hsc" #-}
pure $ Zmp (argv, argc)
| eType == eventTType -> do
cmd <- ((\hsc_ptr -> peekByteOff hsc_ptr 4)) p
{-# LINE 150 "src/Network/Telnet/LibTelnet/Types.hsc" #-}
name <- ((\hsc_ptr -> peekByteOff hsc_ptr 8)) p
{-# LINE 151 "src/Network/Telnet/LibTelnet/Types.hsc" #-}
pure $ TerminalType cmd name
| eType == eventCompress ->
Compress <$> ((\hsc_ptr -> peekByteOff hsc_ptr 4)) p
{-# LINE 156 "src/Network/Telnet/LibTelnet/Types.hsc" #-}
| eType == eventEnviron -> do
cmd <- ((\hsc_ptr -> peekByteOff hsc_ptr 24)) p
{-# LINE 159 "src/Network/Telnet/LibTelnet/Types.hsc" #-}
values <- ((\hsc_ptr -> peekByteOff hsc_ptr 8)) p
{-# LINE 160 "src/Network/Telnet/LibTelnet/Types.hsc" #-}
size <- ((\hsc_ptr -> peekByteOff hsc_ptr 16)) p
{-# LINE 161 "src/Network/Telnet/LibTelnet/Types.hsc" #-}
pure $ Environ cmd (values, size)
| eType == eventMssp -> do
values <- ((\hsc_ptr -> peekByteOff hsc_ptr 8)) p
{-# LINE 166 "src/Network/Telnet/LibTelnet/Types.hsc" #-}
size <- ((\hsc_ptr -> peekByteOff hsc_ptr 16)) p
{-# LINE 167 "src/Network/Telnet/LibTelnet/Types.hsc" #-}
pure $ Mssp (values, size)
| otherwise -> throwIO $ UnexpectedEventType eType
poke :: Ptr EventT -> EventT -> IO ()
poke p :: Ptr EventT
p (Data (buffer :: CString
buffer, size :: CSize
size)) = do
((\hsc_ptr :: Ptr EventT
hsc_ptr -> Ptr EventT -> Int -> TelnetEventTypeT -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr EventT
hsc_ptr 0)) Ptr EventT
p TelnetEventTypeT
eventData
{-# LINE 174 "src/Network/Telnet/LibTelnet/Types.hsc" #-}
((\hsc_ptr -> pokeByteOff hsc_ptr 8)) p buffer
{-# LINE 175 "src/Network/Telnet/LibTelnet/Types.hsc" #-}
((\hsc_ptr -> pokeByteOff hsc_ptr 16)) p size
{-# LINE 176 "src/Network/Telnet/LibTelnet/Types.hsc" #-}
poke p :: Ptr EventT
p (Send (buffer :: CString
buffer, size :: CSize
size)) = do
((\hsc_ptr :: Ptr EventT
hsc_ptr -> Ptr EventT -> Int -> TelnetEventTypeT -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr EventT
hsc_ptr 0)) Ptr EventT
p TelnetEventTypeT
eventSend
{-# LINE 179 "src/Network/Telnet/LibTelnet/Types.hsc" #-}
((\hsc_ptr -> pokeByteOff hsc_ptr 8)) p buffer
{-# LINE 180 "src/Network/Telnet/LibTelnet/Types.hsc" #-}
((\hsc_ptr -> pokeByteOff hsc_ptr 16)) p size
{-# LINE 181 "src/Network/Telnet/LibTelnet/Types.hsc" #-}
poke p :: Ptr EventT
p (Warning ErrorT{..}) = do
((\hsc_ptr :: Ptr EventT
hsc_ptr -> Ptr EventT -> Int -> TelnetEventTypeT -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr EventT
hsc_ptr 0)) Ptr EventT
p TelnetEventTypeT
eventWarning
{-# LINE 184 "src/Network/Telnet/LibTelnet/Types.hsc" #-}
((\hsc_ptr -> pokeByteOff hsc_ptr 8)) p _file
{-# LINE 185 "src/Network/Telnet/LibTelnet/Types.hsc" #-}
((\hsc_ptr -> pokeByteOff hsc_ptr 16)) p _func
{-# LINE 186 "src/Network/Telnet/LibTelnet/Types.hsc" #-}
((\hsc_ptr -> pokeByteOff hsc_ptr 24)) p _msg
{-# LINE 187 "src/Network/Telnet/LibTelnet/Types.hsc" #-}
((\hsc_ptr -> pokeByteOff hsc_ptr 32)) p _line
{-# LINE 188 "src/Network/Telnet/LibTelnet/Types.hsc" #-}
((\hsc_ptr -> pokeByteOff hsc_ptr 36)) p _errcode
{-# LINE 189 "src/Network/Telnet/LibTelnet/Types.hsc" #-}
poke p :: Ptr EventT
p (Error ErrorT{..}) = do
((\hsc_ptr :: Ptr EventT
hsc_ptr -> Ptr EventT -> Int -> TelnetEventTypeT -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr EventT
hsc_ptr 0)) Ptr EventT
p TelnetEventTypeT
eventError
{-# LINE 192 "src/Network/Telnet/LibTelnet/Types.hsc" #-}
((\hsc_ptr -> pokeByteOff hsc_ptr 8)) p _file
{-# LINE 193 "src/Network/Telnet/LibTelnet/Types.hsc" #-}
((\hsc_ptr -> pokeByteOff hsc_ptr 16)) p _func
{-# LINE 194 "src/Network/Telnet/LibTelnet/Types.hsc" #-}
((\hsc_ptr -> pokeByteOff hsc_ptr 24)) p _msg
{-# LINE 195 "src/Network/Telnet/LibTelnet/Types.hsc" #-}
((\hsc_ptr -> pokeByteOff hsc_ptr 32)) p _line
{-# LINE 196 "src/Network/Telnet/LibTelnet/Types.hsc" #-}
((\hsc_ptr -> pokeByteOff hsc_ptr 36)) p _errcode
{-# LINE 197 "src/Network/Telnet/LibTelnet/Types.hsc" #-}
poke p :: Ptr EventT
p (Command cmd :: Iac
cmd) = do
((\hsc_ptr :: Ptr EventT
hsc_ptr -> Ptr EventT -> Int -> TelnetEventTypeT -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr EventT
hsc_ptr 0)) Ptr EventT
p TelnetEventTypeT
eventIac
{-# LINE 200 "src/Network/Telnet/LibTelnet/Types.hsc" #-}
((\hsc_ptr -> pokeByteOff hsc_ptr 4)) p cmd
{-# LINE 201 "src/Network/Telnet/LibTelnet/Types.hsc" #-}
poke p :: Ptr EventT
p (Will opt :: Option
opt) = do
((\hsc_ptr :: Ptr EventT
hsc_ptr -> Ptr EventT -> Int -> TelnetEventTypeT -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr EventT
hsc_ptr 0)) Ptr EventT
p TelnetEventTypeT
eventWill
{-# LINE 204 "src/Network/Telnet/LibTelnet/Types.hsc" #-}
((\hsc_ptr -> pokeByteOff hsc_ptr 4)) p opt
{-# LINE 205 "src/Network/Telnet/LibTelnet/Types.hsc" #-}
poke p :: Ptr EventT
p (Wont opt :: Option
opt) = do
((\hsc_ptr :: Ptr EventT
hsc_ptr -> Ptr EventT -> Int -> TelnetEventTypeT -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr EventT
hsc_ptr 0)) Ptr EventT
p TelnetEventTypeT
eventWont
{-# LINE 208 "src/Network/Telnet/LibTelnet/Types.hsc" #-}
((\hsc_ptr -> pokeByteOff hsc_ptr 4)) p opt
{-# LINE 209 "src/Network/Telnet/LibTelnet/Types.hsc" #-}
poke p :: Ptr EventT
p (Do opt :: Option
opt) = do
((\hsc_ptr :: Ptr EventT
hsc_ptr -> Ptr EventT -> Int -> TelnetEventTypeT -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr EventT
hsc_ptr 0)) Ptr EventT
p TelnetEventTypeT
eventDo
{-# LINE 212 "src/Network/Telnet/LibTelnet/Types.hsc" #-}
((\hsc_ptr -> pokeByteOff hsc_ptr 4)) p opt
{-# LINE 213 "src/Network/Telnet/LibTelnet/Types.hsc" #-}
poke p :: Ptr EventT
p (Dont opt :: Option
opt) = do
((\hsc_ptr :: Ptr EventT
hsc_ptr -> Ptr EventT -> Int -> TelnetEventTypeT -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr EventT
hsc_ptr 0)) Ptr EventT
p TelnetEventTypeT
eventDont
{-# LINE 216 "src/Network/Telnet/LibTelnet/Types.hsc" #-}
((\hsc_ptr -> pokeByteOff hsc_ptr 4)) p opt
{-# LINE 217 "src/Network/Telnet/LibTelnet/Types.hsc" #-}
poke p :: Ptr EventT
p (Subnegotiation opt :: Option
opt (buffer :: CString
buffer, size :: CSize
size)) = do
((\hsc_ptr :: Ptr EventT
hsc_ptr -> Ptr EventT -> Int -> TelnetEventTypeT -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr EventT
hsc_ptr 0)) Ptr EventT
p TelnetEventTypeT
eventSubnegotiation
{-# LINE 220 "src/Network/Telnet/LibTelnet/Types.hsc" #-}
((\hsc_ptr -> pokeByteOff hsc_ptr 24)) p opt
{-# LINE 221 "src/Network/Telnet/LibTelnet/Types.hsc" #-}
((\hsc_ptr -> pokeByteOff hsc_ptr 8)) p buffer
{-# LINE 222 "src/Network/Telnet/LibTelnet/Types.hsc" #-}
((\hsc_ptr -> pokeByteOff hsc_ptr 16)) p size
{-# LINE 223 "src/Network/Telnet/LibTelnet/Types.hsc" #-}
poke p :: Ptr EventT
p (Zmp (argv :: Ptr CString
argv, argc :: CSize
argc)) = do
((\hsc_ptr :: Ptr EventT
hsc_ptr -> Ptr EventT -> Int -> TelnetEventTypeT -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr EventT
hsc_ptr 0)) Ptr EventT
p TelnetEventTypeT
eventZmp
{-# LINE 226 "src/Network/Telnet/LibTelnet/Types.hsc" #-}
((\hsc_ptr -> pokeByteOff hsc_ptr 8)) p argv
{-# LINE 227 "src/Network/Telnet/LibTelnet/Types.hsc" #-}
((\hsc_ptr -> pokeByteOff hsc_ptr 16)) p argc
{-# LINE 228 "src/Network/Telnet/LibTelnet/Types.hsc" #-}
poke p :: Ptr EventT
p (TerminalType cmd :: TCmd
cmd name :: CString
name) = do
((\hsc_ptr :: Ptr EventT
hsc_ptr -> Ptr EventT -> Int -> TelnetEventTypeT -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr EventT
hsc_ptr 0)) Ptr EventT
p TelnetEventTypeT
eventTType
{-# LINE 231 "src/Network/Telnet/LibTelnet/Types.hsc" #-}
((\hsc_ptr -> pokeByteOff hsc_ptr 4)) p cmd
{-# LINE 232 "src/Network/Telnet/LibTelnet/Types.hsc" #-}
((\hsc_ptr -> pokeByteOff hsc_ptr 8)) p name
{-# LINE 233 "src/Network/Telnet/LibTelnet/Types.hsc" #-}
poke p :: Ptr EventT
p (Compress state :: CUChar
state) = do
((\hsc_ptr :: Ptr EventT
hsc_ptr -> Ptr EventT -> Int -> TelnetEventTypeT -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr EventT
hsc_ptr 0)) Ptr EventT
p TelnetEventTypeT
eventCompress
{-# LINE 236 "src/Network/Telnet/LibTelnet/Types.hsc" #-}
((\hsc_ptr -> pokeByteOff hsc_ptr 4)) p state
{-# LINE 237 "src/Network/Telnet/LibTelnet/Types.hsc" #-}
poke p :: Ptr EventT
p (Environ cmd :: ECmd
cmd (values :: Ptr TelnetEnvironT
values, size :: CSize
size)) = do
((\hsc_ptr :: Ptr EventT
hsc_ptr -> Ptr EventT -> Int -> TelnetEventTypeT -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr EventT
hsc_ptr 0)) Ptr EventT
p TelnetEventTypeT
eventEnviron
{-# LINE 240 "src/Network/Telnet/LibTelnet/Types.hsc" #-}
((\hsc_ptr -> pokeByteOff hsc_ptr 24)) p cmd
{-# LINE 241 "src/Network/Telnet/LibTelnet/Types.hsc" #-}
((\hsc_ptr -> pokeByteOff hsc_ptr 8)) p values
{-# LINE 242 "src/Network/Telnet/LibTelnet/Types.hsc" #-}
((\hsc_ptr -> pokeByteOff hsc_ptr 16)) p size
{-# LINE 243 "src/Network/Telnet/LibTelnet/Types.hsc" #-}
poke p :: Ptr EventT
p (Mssp (values :: Ptr TelnetEnvironT
values, size :: CSize
size)) = do
((\hsc_ptr :: Ptr EventT
hsc_ptr -> Ptr EventT -> Int -> TelnetEventTypeT -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr EventT
hsc_ptr 0)) Ptr EventT
p TelnetEventTypeT
eventMssp
{-# LINE 246 "src/Network/Telnet/LibTelnet/Types.hsc" #-}
((\hsc_ptr -> pokeByteOff hsc_ptr 8)) p values
{-# LINE 247 "src/Network/Telnet/LibTelnet/Types.hsc" #-}
((\hsc_ptr -> pokeByteOff hsc_ptr 16)) p size
{-# LINE 248 "src/Network/Telnet/LibTelnet/Types.hsc" #-}
newtype TelnetEventTypeT = TelnetEventTypeT { TelnetEventTypeT -> CInt
unTelnetEventTypeT :: CInt }
deriving (TelnetEventTypeT -> TelnetEventTypeT -> Bool
(TelnetEventTypeT -> TelnetEventTypeT -> Bool)
-> (TelnetEventTypeT -> TelnetEventTypeT -> Bool)
-> Eq TelnetEventTypeT
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TelnetEventTypeT -> TelnetEventTypeT -> Bool
$c/= :: TelnetEventTypeT -> TelnetEventTypeT -> Bool
== :: TelnetEventTypeT -> TelnetEventTypeT -> Bool
$c== :: TelnetEventTypeT -> TelnetEventTypeT -> Bool
Eq, Int -> TelnetEventTypeT -> ShowS
[TelnetEventTypeT] -> ShowS
TelnetEventTypeT -> String
(Int -> TelnetEventTypeT -> ShowS)
-> (TelnetEventTypeT -> String)
-> ([TelnetEventTypeT] -> ShowS)
-> Show TelnetEventTypeT
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TelnetEventTypeT] -> ShowS
$cshowList :: [TelnetEventTypeT] -> ShowS
show :: TelnetEventTypeT -> String
$cshow :: TelnetEventTypeT -> String
showsPrec :: Int -> TelnetEventTypeT -> ShowS
$cshowsPrec :: Int -> TelnetEventTypeT -> ShowS
Show, Ptr b -> Int -> IO TelnetEventTypeT
Ptr b -> Int -> TelnetEventTypeT -> IO ()
Ptr TelnetEventTypeT -> IO TelnetEventTypeT
Ptr TelnetEventTypeT -> Int -> IO TelnetEventTypeT
Ptr TelnetEventTypeT -> Int -> TelnetEventTypeT -> IO ()
Ptr TelnetEventTypeT -> TelnetEventTypeT -> IO ()
TelnetEventTypeT -> Int
(TelnetEventTypeT -> Int)
-> (TelnetEventTypeT -> Int)
-> (Ptr TelnetEventTypeT -> Int -> IO TelnetEventTypeT)
-> (Ptr TelnetEventTypeT -> Int -> TelnetEventTypeT -> IO ())
-> (forall b. Ptr b -> Int -> IO TelnetEventTypeT)
-> (forall b. Ptr b -> Int -> TelnetEventTypeT -> IO ())
-> (Ptr TelnetEventTypeT -> IO TelnetEventTypeT)
-> (Ptr TelnetEventTypeT -> TelnetEventTypeT -> IO ())
-> Storable TelnetEventTypeT
forall b. Ptr b -> Int -> IO TelnetEventTypeT
forall b. Ptr b -> Int -> TelnetEventTypeT -> IO ()
forall a.
(a -> Int)
-> (a -> Int)
-> (Ptr a -> Int -> IO a)
-> (Ptr a -> Int -> a -> IO ())
-> (forall b. Ptr b -> Int -> IO a)
-> (forall b. Ptr b -> Int -> a -> IO ())
-> (Ptr a -> IO a)
-> (Ptr a -> a -> IO ())
-> Storable a
poke :: Ptr TelnetEventTypeT -> TelnetEventTypeT -> IO ()
$cpoke :: Ptr TelnetEventTypeT -> TelnetEventTypeT -> IO ()
peek :: Ptr TelnetEventTypeT -> IO TelnetEventTypeT
$cpeek :: Ptr TelnetEventTypeT -> IO TelnetEventTypeT
pokeByteOff :: Ptr b -> Int -> TelnetEventTypeT -> IO ()
$cpokeByteOff :: forall b. Ptr b -> Int -> TelnetEventTypeT -> IO ()
peekByteOff :: Ptr b -> Int -> IO TelnetEventTypeT
$cpeekByteOff :: forall b. Ptr b -> Int -> IO TelnetEventTypeT
pokeElemOff :: Ptr TelnetEventTypeT -> Int -> TelnetEventTypeT -> IO ()
$cpokeElemOff :: Ptr TelnetEventTypeT -> Int -> TelnetEventTypeT -> IO ()
peekElemOff :: Ptr TelnetEventTypeT -> Int -> IO TelnetEventTypeT
$cpeekElemOff :: Ptr TelnetEventTypeT -> Int -> IO TelnetEventTypeT
alignment :: TelnetEventTypeT -> Int
$calignment :: TelnetEventTypeT -> Int
sizeOf :: TelnetEventTypeT -> Int
$csizeOf :: TelnetEventTypeT -> Int
Storable)
eventData :: TelnetEventTypeT
eventData :: TelnetEventTypeT
eventData = CInt -> TelnetEventTypeT
TelnetEventTypeT 0
eventSend :: TelnetEventTypeT
eventSend :: TelnetEventTypeT
eventSend = CInt -> TelnetEventTypeT
TelnetEventTypeT 1
eventIac :: TelnetEventTypeT
eventIac :: TelnetEventTypeT
eventIac = CInt -> TelnetEventTypeT
TelnetEventTypeT 2
eventWill :: TelnetEventTypeT
eventWill :: TelnetEventTypeT
eventWill = CInt -> TelnetEventTypeT
TelnetEventTypeT 3
eventWont :: TelnetEventTypeT
eventWont :: TelnetEventTypeT
eventWont = CInt -> TelnetEventTypeT
TelnetEventTypeT 4
eventDo :: TelnetEventTypeT
eventDo :: TelnetEventTypeT
eventDo = CInt -> TelnetEventTypeT
TelnetEventTypeT 5
eventDont :: TelnetEventTypeT
eventDont :: TelnetEventTypeT
eventDont = CInt -> TelnetEventTypeT
TelnetEventTypeT 6
eventSubnegotiation :: TelnetEventTypeT
eventSubnegotiation :: TelnetEventTypeT
eventSubnegotiation = CInt -> TelnetEventTypeT
TelnetEventTypeT 7
eventCompress :: TelnetEventTypeT
eventCompress :: TelnetEventTypeT
eventCompress = CInt -> TelnetEventTypeT
TelnetEventTypeT 8
eventZmp :: TelnetEventTypeT
eventZmp :: TelnetEventTypeT
eventZmp = CInt -> TelnetEventTypeT
TelnetEventTypeT 9
eventTType :: TelnetEventTypeT
eventTType :: TelnetEventTypeT
eventTType = CInt -> TelnetEventTypeT
TelnetEventTypeT 10
eventEnviron :: TelnetEventTypeT
eventEnviron :: TelnetEventTypeT
eventEnviron = CInt -> TelnetEventTypeT
TelnetEventTypeT 11
eventMssp :: TelnetEventTypeT
eventMssp :: TelnetEventTypeT
eventMssp = CInt -> TelnetEventTypeT
TelnetEventTypeT 12
eventWarning :: TelnetEventTypeT
eventWarning :: TelnetEventTypeT
eventWarning = CInt -> TelnetEventTypeT
TelnetEventTypeT 13
eventError :: TelnetEventTypeT
eventError :: TelnetEventTypeT
eventError = CInt -> TelnetEventTypeT
TelnetEventTypeT 14
{-# LINE 269 "src/Network/Telnet/LibTelnet/Types.hsc" #-}
data ErrorT = ErrorT
{ _file :: CString
, _func :: CString
, _msg :: CString
, _line :: CInt
, _errcode :: TelnetErrorT
}
newtype TelnetErrorT = TelnetErrorT { unTelnetErrorT :: CInt }
deriving (Eq, Show, Storable)
errOK :: TelnetErrorT
errOK :: TelnetErrorT
errOK = CInt -> TelnetErrorT
TelnetErrorT 0
errBadVal :: TelnetErrorT
errBadVal :: TelnetErrorT
errBadVal = CInt -> TelnetErrorT
TelnetErrorT 1
errNoMem :: TelnetErrorT
errNoMem :: TelnetErrorT
errNoMem = CInt -> TelnetErrorT
TelnetErrorT 2
errOverflow :: TelnetErrorT
errOverflow :: TelnetErrorT
errOverflow = CInt -> TelnetErrorT
TelnetErrorT 3
errProtocol :: TelnetErrorT
errProtocol :: TelnetErrorT
errProtocol = CInt -> TelnetErrorT
TelnetErrorT 4
errCompress :: TelnetErrorT
errCompress :: TelnetErrorT
errCompress = CInt -> TelnetErrorT
TelnetErrorT 5
{-# LINE 291 "src/Network/Telnet/LibTelnet/Types.hsc" #-}
newtype TCmd = TCmd { unTCmd :: CUChar } deriving (Eq, Show, Storable)
tCmdIs :: TCmd
tCmdIs = TCmd 0
tCmdSend :: TCmd
tCmdSend :: TCmd
tCmdSend = CUChar -> TCmd
TCmd 1
{-# LINE 298 "src/Network/Telnet/LibTelnet/Types.hsc" #-}
newtype ECmd = ECmd { ECmd -> CUChar
unECmd :: CUChar } deriving (ECmd -> ECmd -> Bool
(ECmd -> ECmd -> Bool) -> (ECmd -> ECmd -> Bool) -> Eq ECmd
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ECmd -> ECmd -> Bool
$c/= :: ECmd -> ECmd -> Bool
== :: ECmd -> ECmd -> Bool
$c== :: ECmd -> ECmd -> Bool
Eq, Int -> ECmd -> ShowS
[ECmd] -> ShowS
ECmd -> String
(Int -> ECmd -> ShowS)
-> (ECmd -> String) -> ([ECmd] -> ShowS) -> Show ECmd
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ECmd] -> ShowS
$cshowList :: [ECmd] -> ShowS
show :: ECmd -> String
$cshow :: ECmd -> String
showsPrec :: Int -> ECmd -> ShowS
$cshowsPrec :: Int -> ECmd -> ShowS
Show, Ptr b -> Int -> IO ECmd
Ptr b -> Int -> ECmd -> IO ()
Ptr ECmd -> IO ECmd
Ptr ECmd -> Int -> IO ECmd
Ptr ECmd -> Int -> ECmd -> IO ()
Ptr ECmd -> ECmd -> IO ()
ECmd -> Int
(ECmd -> Int)
-> (ECmd -> Int)
-> (Ptr ECmd -> Int -> IO ECmd)
-> (Ptr ECmd -> Int -> ECmd -> IO ())
-> (forall b. Ptr b -> Int -> IO ECmd)
-> (forall b. Ptr b -> Int -> ECmd -> IO ())
-> (Ptr ECmd -> IO ECmd)
-> (Ptr ECmd -> ECmd -> IO ())
-> Storable ECmd
forall b. Ptr b -> Int -> IO ECmd
forall b. Ptr b -> Int -> ECmd -> IO ()
forall a.
(a -> Int)
-> (a -> Int)
-> (Ptr a -> Int -> IO a)
-> (Ptr a -> Int -> a -> IO ())
-> (forall b. Ptr b -> Int -> IO a)
-> (forall b. Ptr b -> Int -> a -> IO ())
-> (Ptr a -> IO a)
-> (Ptr a -> a -> IO ())
-> Storable a
poke :: Ptr ECmd -> ECmd -> IO ()
$cpoke :: Ptr ECmd -> ECmd -> IO ()
peek :: Ptr ECmd -> IO ECmd
$cpeek :: Ptr ECmd -> IO ECmd
pokeByteOff :: Ptr b -> Int -> ECmd -> IO ()
$cpokeByteOff :: forall b. Ptr b -> Int -> ECmd -> IO ()
peekByteOff :: Ptr b -> Int -> IO ECmd
$cpeekByteOff :: forall b. Ptr b -> Int -> IO ECmd
pokeElemOff :: Ptr ECmd -> Int -> ECmd -> IO ()
$cpokeElemOff :: Ptr ECmd -> Int -> ECmd -> IO ()
peekElemOff :: Ptr ECmd -> Int -> IO ECmd
$cpeekElemOff :: Ptr ECmd -> Int -> IO ECmd
alignment :: ECmd -> Int
$calignment :: ECmd -> Int
sizeOf :: ECmd -> Int
$csizeOf :: ECmd -> Int
Storable)
eCmdIs :: ECmd
eCmdIs :: ECmd
eCmdIs = CUChar -> ECmd
ECmd 0
eCmdSend :: ECmd
eCmdSend :: ECmd
eCmdSend = CUChar -> ECmd
ECmd 1
eCmdInfo :: ECmd
eCmdInfo :: ECmd
eCmdInfo = CUChar -> ECmd
ECmd 2
{-# LINE 306 "src/Network/Telnet/LibTelnet/Types.hsc" #-}
newtype EVar = EVar { unEvar :: CUChar } deriving (Eq, Show, Storable)
eVar :: EVar
eVar :: EVar
eVar = CUChar -> EVar
EVar 0
eValue :: EVar
eValue :: EVar
eValue = CUChar -> EVar
EVar 1
eUserVar :: EVar
eUserVar :: EVar
eUserVar = CUChar -> EVar
EVar 3
{-# LINE 314 "src/Network/Telnet/LibTelnet/Types.hsc" #-}
newtype MsspVar = MsspVar { unMsspVar :: CUChar } deriving (Eq, Show, Storable)
msspVar :: MsspVar
msspVar :: MsspVar
msspVar = CUChar -> MsspVar
MsspVar 1
msspVal :: MsspVar
msspVal :: MsspVar
msspVal = CUChar -> MsspVar
MsspVar 2
{-# LINE 321 "src/Network/Telnet/LibTelnet/Types.hsc" #-}
data TelnetEnvironT = TelnetEnvironT
{ TelnetEnvironT -> EVar
_type :: EVar
, TelnetEnvironT -> CString
_var :: CString
, TelnetEnvironT -> CString
_value :: CString
}
instance Storable TelnetEnvironT where
sizeOf :: TelnetEnvironT -> Int
sizeOf _ = ((24))
{-# LINE 332 "src/Network/Telnet/LibTelnet/Types.hsc" #-}
alignment _ = (8)
{-# LINE 333 "src/Network/Telnet/LibTelnet/Types.hsc" #-}
peek :: Ptr TelnetEnvironT -> IO TelnetEnvironT
peek p :: Ptr TelnetEnvironT
p = do
EVar
type_ <- ((\hsc_ptr :: Ptr TelnetEnvironT
hsc_ptr -> Ptr TelnetEnvironT -> Int -> IO EVar
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr TelnetEnvironT
hsc_ptr 0)) Ptr TelnetEnvironT
p
{-# LINE 336 "src/Network/Telnet/LibTelnet/Types.hsc" #-}
var <- ((\hsc_ptr -> peekByteOff hsc_ptr 8)) p
{-# LINE 337 "src/Network/Telnet/LibTelnet/Types.hsc" #-}
value <- ((\hsc_ptr -> peekByteOff hsc_ptr 16)) p
{-# LINE 338 "src/Network/Telnet/LibTelnet/Types.hsc" #-}
TelnetEnvironT -> IO TelnetEnvironT
forall (f :: * -> *) a. Applicative f => a -> f a
pure (TelnetEnvironT -> IO TelnetEnvironT)
-> TelnetEnvironT -> IO TelnetEnvironT
forall a b. (a -> b) -> a -> b
$ EVar -> CString -> CString -> TelnetEnvironT
TelnetEnvironT EVar
type_ CString
var CString
value
poke :: Ptr TelnetEnvironT -> TelnetEnvironT -> IO ()
poke p :: Ptr TelnetEnvironT
p TelnetEnvironT{..} = do
((\hsc_ptr :: Ptr TelnetEnvironT
hsc_ptr -> Ptr TelnetEnvironT -> Int -> EVar -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr TelnetEnvironT
hsc_ptr 0)) Ptr TelnetEnvironT
p EVar
_type
{-# LINE 343 "src/Network/Telnet/LibTelnet/Types.hsc" #-}
((\hsc_ptr -> pokeByteOff hsc_ptr 8)) p _var
{-# LINE 344 "src/Network/Telnet/LibTelnet/Types.hsc" #-}
((\hsc_ptr -> pokeByteOff hsc_ptr 16)) p _value
{-# LINE 345 "src/Network/Telnet/LibTelnet/Types.hsc" #-}