Class: Net::SSH::Connection::Driver

Class | Net::SSH::Connection::Driver
In: | lib/net/ssh/connection/driver.rb
Parent: | Object

### Methods

add_channel_open_handler allocate_channel_id channel_request channels do_channel_close do_channel_data do_channel_eof do_channel_extended_data do_channel_failure do_channel_open do_channel_open_confirmation do_channel_open_failure do_channel_request do_channel_success do_channel_window_adjust do_global_request do_request_failure do_request_success global_request loop new open_channel ping! process reader_ready? register_data_request remove_channel remove_channel_open_handler send_message

### Included Modules

Constants

### Constants

Request | = | Struct.new( :type, :data, :callback ) |  | A structure for representing global requests, as registered by the global_request method.
DataRequest | = | Struct.new( :channel, :data, :type ) |  | A structure for representing a data buffer that must be sent across a channel.
MESSAGES | = | %w( global_request request_success request_failure channel_open channel_open_failure channel_open_confirmation channel_window_adjust channel_data channel_extended_data channel_eof channel_close channel_request channel_success channel_failure ).inject({}) do |map, event| constant = Constants.const_get event.upcase.to_sym |  |

### Public Class methods

new( session, log, buffers, factories )

Create a new connection driver that communicates over the given transport session. `log` is the logger instance to write log messages to, buffers is a buffer factory, and channels is a factory that can return new channel instances.

### Public Instance methods

add_channel_open_handler( type, &block )

Add a callback to be invoked when a channel-open request is recieved for a channel of the given type. The handler-id is returned.

allocate_channel_id()

Return the next available channel id for this connection. This method is thread-safe.

channel_request( type )

Send a channel request packet to the server.

channels()

Returns an array of active channels.

do_channel_close( response )
do_channel_data( response )
do_channel_eof( response )
do_channel_extended_data( response )
do_channel_failure( response )
do_channel_open( response )
do_channel_open_confirmation( response )
do_channel_open_failure( response )
do_channel_request( response )
do_channel_success( response )
do_channel_window_adjust( response )
do_global_request( response )
do_request_failure( response )
do_request_success( response )
global_request( type, data=nil, &block )

Send a global request packet to the server. This returns immediately. The given block will be invoked when the server responds.

loop( &block )

Repeated call process for as long as the given block returns `true`. If no block is given, then the loop continues until there are no more open channels on this connection.

open_channel( type, extra_data=nil, &on_confirm )

Open and return a new channel. This returns immediately, before the server confirms that the channel was opened. When the server sends the confirmation, the `on_confirm` callback will be invoked.

ping!()

Sends an innocuous packet to the server to test the connection. Can be used to defeat timeouts on long-running commands.

process( nonblock=false )

Wait for and dispatch a single event. If `nonblock` is false (the default) this will block until a message has been received. Otherwise, it will return immediately.

reader_ready?()

Delegates to the reader_ready method of the transport session.

register_data_request( channel, data, type=nil )

Register a data buffer (of an optional type) to be sent across the given channel at the next available opportunity.

This is used internally by channels to hide the window size and maximum packet size from the client. Clients should not call this method directly.

remove_channel( channel )

Remove the given channel from the connection.

remove_channel_open_handler( type, id )

Remove a callback with the given id for channel-open requests of the given type.

send_message( msg )

A convenience method for sending messages.

[Validate]