libssh2-0.2: FFI bindings to libssh2 SSH2 client library (http://libssh2.org/)

Safe HaskellNone

Network.SSH.Client.LibSSH2.Foreign

Contents

Synopsis

Types

Session functions

initialize :: Bool -> IO ()Source

Initialize libssh2. Pass True to enable encryption or False to disable it.

exit :: IO ()Source

Deinitialize libssh2.

initSession :: IO SessionSource

Create Session object

freeSession :: Session -> IO ()Source

Free Session object's memory

disconnectSessionSource

Arguments

:: Session 
-> String

Goodbye message

-> IO () 

Disconnect session (but do not free memory)

handshake :: Session -> Socket -> IO ()Source

Run SSH handshake on network socket.

Known hosts functions

initKnownHosts :: Session -> IO KnownHostsSource

Create KnownHosts object for given session.

freeKnownHosts :: KnownHosts -> IO ()Source

Free KnownHosts object's memory

knownHostsReadFileSource

Arguments

:: KnownHosts 
-> FilePath

Path to known_hosts file

-> IO Int 

Read known hosts from file

getHostKey :: Session -> IO (String, Size, CInt)Source

Get remote host public key

checkKnownHostSource

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

publicKeyAuthFileSource

Arguments

:: Session

Session

-> String

Username

-> String

Path to public key

-> String

Path to private key

-> String

Passphrase

-> IO () 

Perform public key authentication.

Channel functions

openChannelSession :: Session -> IO ChannelSource

Open a channel for session.

closeChannel :: Channel -> IO ()Source

Close channel (but do not free memory)

freeChannel :: Channel -> IO ()Source

Free channel object's memory

readChannelSource

Arguments

:: Channel 
-> Size

Amount of data to read

-> IO ByteString 

Read data from channel.

writeChannel :: Channel -> ByteString -> IO ()Source

Write data to channel.

writeChannelFromHandle :: Channel -> Handle -> IO IntegerSource

Write all data to channel from handle. Returns amount of transferred data.

readChannelToHandle :: Channel -> Handle -> Offset -> IO IntegerSource

Read all data from channel to handle. Returns amount of transferred data.

channelExecute :: Channel -> String -> IO ()Source

Execute command

channelShell :: Channel -> IO ()Source

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.

Debug