NAME
Net::SSH::Perl::Subsystem::Client - Subsystem client base class
SYNOPSIS
package My::Subsystem;
use Net::SSH::Perl::Subsystem::Client;
@ISA = qw( Net::SSH::Perl::Subsystem::Client );
use constant MSG_HELLO => 1;
sub init {
my $system = shift;
$system->SUPER::init(@_);
my $msg = $system->new_msg(MSG_HELLO);
$msg->put_str("Hello, subsystem server.");
$msg->send;
}
sub subsystem { "mysubsystem" }
DESCRIPTION
Net::SSH::Perl::Subsystem::Client simplifies the process of writing a client for an SSH-2 subsystem. A subsystem is generally a networking protocol that is built on top of an SSH channel--the channel provides transport, connection, encryption, authentication, message integrity, etc. The subsystem client and server communicate over this encrypted, secure channel (a channel built over an insecure network). SSH provides the encrypted transport, and the subsystem is then free to act like a standard networking protocol.
Subsystem::Client is built on top of Net::SSH::Perl, which provides the client end of the services described above (encryption, message integrity checking, authentication, etc.). It is designed to be used with a subsystem server, working with respect to an agreed-upon networking protocol.
SFTP is an example of a subsystem: the underlying transport is set up by Net::SSH::Perl, and on top of that layer, files can be transferred and filesystems managed without knowledge of the secure tunnel.
USAGE
Net::SSH::Perl::Subsystem::Client is intended to be used as a base class for your protocol-specific client. It handles all interaction with Net::SSH::Perl so that your focus can be on sending commands to the subsystem server, etc.
Your subclass will probably be most interested in using and/or overriding the following methods:
$sc->init(%args)
Initializes a new Subsystem::Client object: builds the SSH tunnel using Net::SSH::Perl, then opens up a channel along which the subsystem traffic will be sent. It then opens a connection to the subsystem server.
You can override this method to provide any additional functionality that your client might need; for example, you might wish to use it to send an 'init' message to the subsystem server.