Package com.tailf.ned
Interface SSHClient
public interface SSHClient
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceThe SSH CLI session interface.static interfaceSSHCLient file transfer interfacestatic interfaceSSHCLient subsystem interface -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionvoidAuthenticate using the methods specified by NSO or from a cloned connection.voidauthenticate(String[] methods) Authenticate using a custom list of methods.voidauthenticate(String[] methods, String user, String password) Authenticate using a custom list of methods, with explicitly configured authentication parameters.static SSHClientClone a new SSHClient instance from an existing instance.voidclose()Close SSH connectionvoidconnect()Establish the SSH connection using default configuration or cloned setup.voidconnect(int connectTimeout, int idleTimeout) Establish the SSH connection with specific timeouts.voidconnect(int connectTimeout, int idleTimeout, InetAddress address, int port) Establish the SSH connection with timeout and address info specified.static SSHClientcreateClient(NedWorker worker, NedConnectionBase ned) SSHClient default factory method.Instantiate a SCP handlerInstantiate a CLI session, default settingscreateSession(int width, int height) Instantiate a CLI session with specific terminal size parametersInstantiate a SFTP handlercreateSubsystem(String name) Instantiate a subsystem, such as 'netconf'voidExplicitly disable host key checking on this connection-Get info about the negotiated algorithms etc used for the connection.Get name and version of underlying SSH implementation.booleanAuthentication status checkbooleanConnection status checkvoidsetRemoteCharset(Charset remoteCharset) Set charset for sessions started from this connectionvoidsetTrafficClass(int tc) Set traffic class on the socket used by the SSH client.voidEnable compression on the SSH channel
-
Field Details
-
AUTH_PUBLIC_KEY
Authentication methods available for negotiation- See Also:
-
AUTH_PASSWORD
- See Also:
-
AUTH_KEYBOARD_INTERACTIVE
- See Also:
-
AUTH_NONE
- See Also:
-
AUTH_HOSTBASED
- See Also:
-
-
Method Details
-
createClient
SSHClient default factory method. Instantiate a new SSH Client. This can only be done when the NED is in state connect.- Parameters:
worker- - The NED worker thread.ned- - The NED instance- Returns:
- - SSHClient instance
- Throws:
IOException
-
clone
Clone a new SSHClient instance from an existing instance. This method can be called without restrictions.- Parameters:
original- - The SSHClient to clone- Returns:
- A new SSHClient instance
- Throws:
IOException
-
getProviderName
String getProviderName()Get name and version of underlying SSH implementation.- Returns:
- name and version
-
connect
Establish the SSH connection using default configuration or cloned setup.- Throws:
IOException
-
connect
Establish the SSH connection with specific timeouts.- Parameters:
connectTimeout- - Connect timeoutidleTimeout- - Idle timeout- Throws:
IOException
-
connect
Establish the SSH connection with timeout and address info specified.- Parameters:
connectTimeout- - Connect timeoutidleTimeout- - Idle timeoutaddress- - Peer addressport- - Peer port- Throws:
IOException
-
getConnectionInfo
String getConnectionInfo()Get info about the negotiated algorithms etc used for the connection. Relevant only after connect.- Returns:
- A string with connection info
-
disableHostKeyVerification
void disableHostKeyVerification()Explicitly disable host key checking on this connection- -
setRemoteCharset
Set charset for sessions started from this connection- Parameters:
remoteCharset- - Specified charset
-
authenticate
Authenticate using the methods specified by NSO or from a cloned connection.- Throws:
IOException
-
authenticate
Authenticate using a custom list of methods.- Parameters:
methods- - Authentication methods to use in priority order.- Throws:
IOException
-
authenticate
Authenticate using a custom list of methods, with explicitly configured authentication parameters.- Parameters:
methods- - Authentication methods to use in priority order. Set to null if the methods specified by NSO or from a cloned connection shall be used.user- - Userpassword- - Password- Throws:
IOException
-
close
Close SSH connection- Throws:
IOException
-
isConnected
boolean isConnected()Connection status check- Returns:
- true | false
-
isAuthenticated
boolean isAuthenticated()Authentication status check- Returns:
- true | false
-
useCompression
Enable compression on the SSH channel- Throws:
IOException
-
setTrafficClass
Set traffic class on the socket used by the SSH client.- Parameters:
tc- - Traffic class- Throws:
SocketException
-
createSession
Instantiate a CLI session, default settings- Returns:
- A ClI session instance
- Throws:
IOException
-
createSession
Instantiate a CLI session with specific terminal size parameters- Parameters:
width- - Terminal widthheight- - Terminal height- Returns:
- A ClI session instance
- Throws:
IOException
-
createSFTP
Instantiate a SFTP handler- Returns:
- SFTP handler instance
- Throws:
IOException
-
createSCP
Instantiate a SCP handler- Returns:
- SCP handler instance
- Throws:
IOException
-
createSubsystem
Instantiate a subsystem, such as 'netconf'- Parameters:
name- - Name of subsystem.- Returns:
- Subsystem instance
- Throws:
IOException
-