-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | FFI bindings to libssh2 SSH2 client library (http://libssh2.org/) -- -- This package provides FFI bindings for SSH2 client library named -- libssh2. @package libssh2 @version 0.1 module Network.SSH.Client.LibSSH2.Types data Session data KnownHosts data Channel class IsPointer p fromPointer :: IsPointer p => Ptr () -> p toPointer :: IsPointer p => p -> Ptr () type CStringCLen i = (CString, i) type Size = CUInt type SSize = CInt withCStringLenIntConv :: Integral i => String -> (CStringCLen i -> IO a) -> IO a peekCStringPtr :: Ptr CString -> IO String peekMaybeCStringPtr :: Ptr CString -> IO (Maybe String) instance Typeable Channel instance Data Channel instance Eq Channel instance Typeable KnownHosts instance Data KnownHosts instance Eq KnownHosts instance Typeable Session instance Data Session instance Eq Session instance IsPointer Channel instance Show Channel instance IsPointer KnownHosts instance Show KnownHosts instance IsPointer Session instance Show Session module Network.SSH.Client.LibSSH2.Errors -- | Error codes returned by libssh2. data ErrorCode NONE :: ErrorCode SOCKET_NONE :: ErrorCode BANNER_RECV :: ErrorCode BANNER_SEND :: ErrorCode INVALID_MAC :: ErrorCode KEX_FALIURE :: ErrorCode ALLOC :: ErrorCode SOCKET_SEND :: ErrorCode KEY_EXCHANGE_FAILURE :: ErrorCode TIMEOUT :: ErrorCode HOSTKEY_INIT :: ErrorCode HOSTKEY_SIGN :: ErrorCode DECRYPT :: ErrorCode SOCKET_DISCONNECT :: ErrorCode PROTO :: ErrorCode PASSWORD_EXPIRED :: ErrorCode FILE :: ErrorCode METHOD_NONE :: ErrorCode AUTHENTICATION_FAILED :: ErrorCode PUBLICKEY_UNVERIFIED :: ErrorCode CHANNEL_OUTOFORDER :: ErrorCode CHANNEL_FAILURE :: ErrorCode CHANNEL_REQUEST_DENIED :: ErrorCode CHANNEL_UNKNOWN :: ErrorCode CHANNEL_WINDOW_EXCEEDED :: ErrorCode CHANNEL_PACKET_EXCEEDED :: ErrorCode CHANNEL_CLOSED :: ErrorCode CHANNEL_EOF_SENT :: ErrorCode SCP_PROTOCOL :: ErrorCode ZLIB :: ErrorCode SOCKET_TIMEOUT :: ErrorCode SFTP_PROTOCOL :: ErrorCode REQUEST_DENIED :: ErrorCode METHOD_NOT_SUPPORTED :: ErrorCode INVAL :: ErrorCode INVALID_POLL_TYPE :: ErrorCode PUBLICKEY_PROTOCOL :: ErrorCode EAGAIN :: ErrorCode BUFFER_TOO_SMALL :: ErrorCode BAD_USE :: ErrorCode COMPRESS :: ErrorCode OUT_OF_BOUNDARY :: ErrorCode AGENT_PROTOCOL :: ErrorCode SOCKET_RECV :: ErrorCode ENCRYPT :: ErrorCode BAD_SOCKET :: ErrorCode -- | Exception to throw when null pointer received from libssh2. data NULL_POINTER class HasCInt a => CIntResult a b fromCInt :: CIntResult a b => a -> b -- | Get last error information. getLastError :: Session -> IO (Int, String) -- | Throw an exception if negative value passed, or return unchanged -- value. handleInt :: CIntResult a b => a -> IO b handleBool :: CInt -> IO Bool -- | Throw an exception if null pointer passed, or return it casted to -- right type. handleNullPtr :: IsPointer a => Ptr () -> IO a int2error :: Integral i => i -> ErrorCode instance Typeable ErrorCode instance Typeable NULL_POINTER instance Eq ErrorCode instance Show ErrorCode instance Ord ErrorCode instance Enum ErrorCode instance Data ErrorCode instance Eq NULL_POINTER instance Show NULL_POINTER instance Data NULL_POINTER instance Num j => CIntResult (CInt, a, b, c) (j, a, b, c) instance HasCInt (CInt, a, b, c) instance Num j => CIntResult (CInt, a, b) (j, a, b) instance HasCInt (CInt, a, b) instance (Integral i, Num b) => CIntResult (i, a) (b, a) instance Integral i => HasCInt (i, a) instance Num b => CIntResult CLong b instance HasCInt CLong instance Num b => CIntResult CInt b instance HasCInt CInt instance Exception NULL_POINTER instance Exception ErrorCode module Network.SSH.Client.LibSSH2.Foreign data KnownHosts data KnownHostResult MATCH :: KnownHostResult MISMATCH :: KnownHostResult NOTFOUND :: KnownHostResult FAILURE :: KnownHostResult data KnownHostType TYPE_MASK :: KnownHostType TYPE_PLAIN :: KnownHostType TYPE_SHA1 :: KnownHostType TYPE_CUSTOM :: KnownHostType KEYENC_MASK :: KnownHostType KEYENC_RAW :: KnownHostType KEYENC_BASE64 :: KnownHostType KEY_MASK :: KnownHostType KEY_SHIFT :: KnownHostType KEY_RSA1 :: KnownHostType KEY_SSHRSA :: KnownHostType KEY_SSHDSS :: KnownHostType -- | Session directions data Direction INBOUND :: Direction OUTBOUND :: Direction -- | Initialize libssh2. Pass True to enable encryption or False to disable -- it. initialize :: Bool -> IO (Int) -- | Deinitialize libssh2. exit :: IO () -- | Create Session object initSession :: IO Session -- | Free Session object's memory freeSession :: Session -> IO (Int) -- | Disconnect session (but do not free memory) disconnectSession :: Session -> String -> IO Int -- | Run SSH handshake on network socket. handshake :: Session -> Socket -> IO (Int) -- | Get currently blocked directions blockedDirections :: Session -> IO ([Direction]) setBlocking :: Session -> Bool -> IO () -- | Create KnownHosts object for given session. initKnownHosts :: Session -> IO (KnownHosts) -- | Free KnownHosts object's memory freeKnownHosts :: KnownHosts -> IO () -- | Read known hosts from file knownHostsReadFile :: KnownHosts -> FilePath -> IO Int -- | Get remote host public key getHostKey :: Session -> IO (String, Size, CInt) -- | Check host data against known hosts. checkKnownHost :: KnownHosts -> String -> Int -> String -> [KnownHostType] -> IO KnownHostResult -- | Perform public key authentication. Arguments are: session, username, -- path to public key file, path to private key file, passphrase. publicKeyAuthFile :: Session -> String -> String -> String -> String -> IO (Int) -- | Open a channel for session. openChannelSession :: Session -> IO Channel -- | Close channel (but do not free memory) closeChannel :: Channel -> IO (Int) -- | Free channel object's memory freeChannel :: Channel -> IO (Int) channelSendEOF :: Channel -> IO (Int) -- | Read data from channel. Returns amount of given data and data itself. -- NOTE: returns bytes sequence, i.e. not Unicode. readChannel :: Channel -> Size -> IO (SSize, String) -- | Write data to channel. Returns amount of written data. writeChannel :: Channel -> String -> IO Int -- | Write all data to channel from handle. Returns amount of transferred -- data. writeChannelFromHandle :: Channel -> Handle -> IO Integer writeChannelFromHandle :: (Num b, IsPointer p1, IsPointer p) => p1 -> p -> Handle -> IO b -- | Read all data from channel to handle. Returns amount of transferred -- data. readChannelToHandle :: Channel -> Handle -> Offset -> IO Integer channelProcess :: Channel -> String -> String -> IO Int -- | Execute command channelExecute :: Channel -> String -> IO Int -- | Execute shell command channelShell :: Channel -> IO Int requestPTY :: Channel -> String -> IO Int requestPTYEx :: Channel -> String -> String -> Int -> Int -> Int -> Int -> IO (Int) -- | Get channel exit status channelExitStatus :: Channel -> IO (Int) -- | Get channel exit signal. Returns: (possibly error code, exit signal -- name, possibly error message, possibly language code). channelExitSignal :: Channel -> IO (Int, String, Maybe String, Maybe String) -- | Create SCP file send channel. scpSendChannel :: Session -> String -> Int -> Int64 -> POSIXTime -> POSIXTime -> IO (Channel) -- | Create SCP file receive channel. TODO: receive struct stat also. scpReceiveChannel :: Session -> FilePath -> IO (Channel, Offset) data TraceFlag T_TRANS :: TraceFlag T_KEX :: TraceFlag T_AUTH :: TraceFlag T_CONN :: TraceFlag T_SCP :: TraceFlag T_SFTP :: TraceFlag T_ERROR :: TraceFlag T_PUBLICKEY :: TraceFlag T_SOCKET :: TraceFlag setTraceMode :: Session -> [TraceFlag] -> IO (Int) instance Eq KnownHostType instance Show KnownHostType instance Eq KnownHostResult instance Show KnownHostResult instance Ord KnownHostResult instance Enum KnownHostResult instance Eq KnownHost instance Show KnownHost instance Eq Direction instance Show Direction instance Eq TraceFlag instance Show TraceFlag module Network.SSH.Client.LibSSH2 data Session data Channel data KnownHosts -- | Execute some actions within SSH2 connection. Uses public key -- authentication. withSSH2 :: FilePath -> FilePath -> FilePath -> String -> String -> Int -> (Channel -> IO a) -> IO (Int, a) -- | Execute some actions within SSH2 session withSession :: String -> Int -> (Handle -> Session -> IO a) -> IO a -- | Execute some actions within SSH2 session withSessionBlocking :: String -> Int -> (Session -> IO a) -> IO a -- | Execute some actions withing SSH2 channel withChannel :: Session -> (Channel -> IO a) -> IO (Int, a) checkHost :: Session -> String -> Int -> FilePath -> IO KnownHostResult -- | Read all data from the channel readAllChannel :: Channel -> IO String -- | Retry the action repeatedly, while it fails with EAGAIN. This does -- matter if using nonblocking mode. retryIfNeeded :: Handle -> Session -> IO a -> IO a -- | Send a file to remote host via SCP. Returns size of sent data. scpSendFile :: Session -> Int -> FilePath -> FilePath -> IO Integer -- | Receive file from remote host via SCP. Returns size of received data. scpReceiveFile :: Session -> FilePath -> FilePath -> IO Integer runShellCommands :: Session -> [String] -> IO (Int, [String]) execCommands :: Session -> [String] -> IO (Int, [String]) -- | Similar to Network.connectTo, but does not socketToHandle. socketConnect :: String -> Int -> IO Socket