-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Simple wrapper around libssh2 -- -- It supports authentication by password or keys. Everything is in the -- SimpleSSH monad which is ErrorT SimpleSSHError IO, allowing to manage -- errors in a haskeller way. @package simplessh @version 0.2.0.5 module Network.SSH.Client.SimpleSSH data SimpleSSHError Connect :: SimpleSSHError Init :: SimpleSSHError Handshake :: SimpleSSHError KnownhostsInit :: SimpleSSHError KnownhostsHostkey :: SimpleSSHError KnownhostsCheck :: SimpleSSHError Authentication :: SimpleSSHError ChannelOpen :: SimpleSSHError ChannelExec :: SimpleSSHError Read :: SimpleSSHError FileOpen :: SimpleSSHError Write :: SimpleSSHError Unknown :: SimpleSSHError type SimpleSSH a = ErrorT SimpleSSHError IO a data Session -- | The result of a command execution. data Result Result :: ByteString -> ByteString -> ResultExit -> Result -- | The process' stdout resultOut :: Result -> ByteString -- | The process' stderr resultErr :: Result -> ByteString -- | The process' exit code or signal resultExit :: Result -> ResultExit -- | Exit code or signal of a process. data ResultExit ExitSuccess :: ResultExit ExitFailure :: Integer -> ResultExit ExitSignal :: ByteString -> ResultExit runSimpleSSH :: SimpleSSH a -> IO (Either SimpleSSHError a) -- | Open a connection, authenticate, execute some action and close the -- connection. -- -- It is the safe way of using SimpleSSH. This function is to be used to -- authenticate with a pair username / password, otherwise see -- withSessionKey. withSessionPassword :: String -> Integer -> String -> String -> String -> (Session -> SimpleSSH a) -> SimpleSSH a -- | Open a connection, authenticate, execute some action and close the -- connection. -- -- It is the safe way of using SimpleSSH. This function is to be used to -- authenticate with a key, otherwise see withSessionPassword. withSessionKey :: String -> Integer -> String -> String -> String -> String -> String -> (Session -> SimpleSSH a) -> SimpleSSH a -- | Send a command to the server. -- -- One should be authenticated before sending commands on a -- Session. execCommand :: Session -> String -> SimpleSSH Result -- | Send a file to the server and returns the number of bytes transferred. -- -- One should be authenticated before sending files on a 'Session. sendFile :: Session -> Integer -> String -> String -> SimpleSSH Integer -- | Open a SSH session. The next step is to authenticate. openSession :: String -> Integer -> String -> SimpleSSH Session -- | Authenticate with a public key for a given username. -- -- Leave the passphrase empty if not needed. -- -- Authenticate a session with a pair username / password. authenticateWithPassword :: Session -> String -> String -> SimpleSSH Session authenticateWithKey :: Session -> String -> FilePath -> FilePath -> String -> SimpleSSH Session -- | Close a session. closeSession :: Session -> SimpleSSH ()