Safe Haskell | None |
---|
Network.SSH.Client.LibSSH2.Foreign
- data KnownHosts
- data KnownHostResult
- data KnownHostType
- = TYPE_MASK
- | TYPE_PLAIN
- | TYPE_SHA1
- | TYPE_CUSTOM
- | KEYENC_MASK
- | KEYENC_RAW
- | KEYENC_BASE64
- | KEY_MASK
- | KEY_SHIFT
- | KEY_RSA1
- | KEY_SSHRSA
- | KEY_SSHDSS
- data Direction
- initialize :: Bool -> IO Int
- exit :: IO ()
- initSession :: IO Session
- freeSession :: Session -> IO Int
- disconnectSession :: Session -> String -> IO Int
- handshake :: Session -> Socket -> IO Int
- blockedDirections :: Session -> IO [Direction]
- setBlocking :: Session -> Bool -> IO ()
- initKnownHosts :: Session -> IO KnownHosts
- freeKnownHosts :: KnownHosts -> IO ()
- knownHostsReadFile :: KnownHosts -> FilePath -> IO Int
- getHostKey :: Session -> IO (String, Size, CInt)
- checkKnownHost :: KnownHosts -> String -> Int -> String -> [KnownHostType] -> IO KnownHostResult
- publicKeyAuthFile :: Session -> String -> String -> String -> String -> IO Int
- openChannelSession :: Session -> IO Channel
- closeChannel :: Channel -> IO Int
- freeChannel :: Channel -> IO Int
- channelSendEOF :: Channel -> IO Int
- readChannel :: Channel -> Size -> IO (SSize, String)
- writeChannel :: Channel -> String -> IO Int
- writeChannelFromHandle :: (Num b, IsPointer p1, IsPointer p) => p1 -> p -> Handle -> IO b
- readChannelToHandle :: Channel -> Handle -> Offset -> IO Integer
- channelProcess :: Channel -> String -> String -> IO Int
- channelExecute :: Channel -> String -> IO Int
- channelShell :: Channel -> IO Int
- requestPTY :: Channel -> String -> IO Int
- requestPTYEx :: Channel -> String -> String -> Int -> Int -> Int -> Int -> IO Int
- channelExitStatus :: Channel -> IO Int
- channelExitSignal :: Channel -> IO (Int, String, Maybe String, Maybe String)
- scpSendChannel :: Session -> String -> Int -> Int64 -> POSIXTime -> POSIXTime -> IO Channel
- scpReceiveChannel :: Session -> FilePath -> IO (Channel, Offset)
- data TraceFlag
- setTraceMode :: Session -> [TraceFlag] -> IO Int
Types
data KnownHosts Source
data KnownHostResult Source
data KnownHostType Source
Constructors
TYPE_MASK | |
TYPE_PLAIN | |
TYPE_SHA1 | |
TYPE_CUSTOM | |
KEYENC_MASK | |
KEYENC_RAW | |
KEYENC_BASE64 | |
KEY_MASK | |
KEY_SHIFT | |
KEY_RSA1 | |
KEY_SSHRSA | |
KEY_SSHDSS |
Instances
Session directions
Session functions
initialize :: Bool -> IO IntSource
Initialize libssh2. Pass True to enable encryption or False to disable it.
initSession :: IO SessionSource
Create Session object
freeSession :: Session -> IO IntSource
Free Session object's memory
Disconnect session (but do not free memory)
blockedDirections :: Session -> IO [Direction]Source
Get currently blocked directions
setBlocking :: Session -> Bool -> IO ()Source
Known hosts functions
initKnownHosts :: Session -> IO KnownHostsSource
Create KnownHosts object for given session.
freeKnownHosts :: KnownHosts -> IO ()Source
Free KnownHosts object's memory
Arguments
:: KnownHosts | |
-> FilePath | Path to known_hosts file |
-> IO Int |
Read known hosts from file
Arguments
:: KnownHosts | |
-> String | Host name |
-> Int | Port number (usually 22) |
-> String | Host public key |
-> [KnownHostType] | Host flags (see libssh2 documentation) |
-> IO KnownHostResult |
Check host data against known hosts.
Authentication
publicKeyAuthFile :: Session -> String -> String -> String -> String -> IO IntSource
Perform public key authentication. Arguments are: session, username, path to public key file, path to private key file, passphrase.
Channel functions
openChannelSession :: Session -> IO ChannelSource
Open a channel for session.
closeChannel :: Channel -> IO IntSource
Close channel (but do not free memory)
freeChannel :: Channel -> IO IntSource
Free channel object's memory
channelSendEOF :: Channel -> IO IntSource
Read data from channel. Returns amount of given data and data itself. NOTE: returns bytes sequence, i.e. not Unicode.
writeChannel :: Channel -> String -> IO IntSource
Write data to channel. Returns amount of written data.
writeChannelFromHandle :: (Num b, IsPointer p1, IsPointer p) => p1 -> p -> Handle -> IO bSource
Write all data to channel from handle. Returns amount of transferred data. writeChannelFromHandle :: Channel -> Handle -> IO Integer
readChannelToHandle :: Channel -> Handle -> Offset -> IO IntegerSource
Read all data from channel to handle. Returns amount of transferred data.
channelShell :: Channel -> IO IntSource
Execute shell command
channelExitStatus :: Channel -> IO IntSource
Get channel exit status
channelExitSignal :: Channel -> IO (Int, String, Maybe String, Maybe String)Source
Get channel exit signal. Returns: (possibly error code, exit signal name, possibly error message, possibly language code).
scpSendChannel :: Session -> String -> Int -> Int64 -> POSIXTime -> POSIXTime -> IO ChannelSource
Create SCP file send channel.
scpReceiveChannel :: Session -> FilePath -> IO (Channel, Offset)Source
Create SCP file receive channel. TODO: receive struct stat also.