Class | Net::SFTP::Protocol::V_01::Impl |
In: |
lib/net/sftp/protocol/01/impl.rb
|
Parent: | Object |
The implementing class for version 1 of the SFTP protocol. It implements the various operations and callbacks available to this level of the protocol. Other protocol versions will typically extend this class, adding (or modifying) methods as needed to bring the implementation into sync with the needed version.
Name | = | Struct.new( :filename, :longname, :attributes ) |
F_READ | = | 0x00000001 |
F_WRITE | = | 0x00000002 |
F_APPEND | = | 0x00000004 |
F_CREAT | = | 0x00000008 |
F_TRUNC | = | 0x00000010 |
F_EXCL | = | 0x00000020 |
open | -> | open_raw |
stat | -> | stat_raw |
lstat | -> | lstat_raw |
fstat | -> | fstat_raw |
close | -> | close_handle |
attr_factory | [R] | The attribute-factory used by this dispatcher. |
driver | [R] | The protocol driver that drives this dispatcher. |
extensions | [RW] | The protocol extensions specified when the protocol version was negotiated. |
A helper method for registering new callbacks. Each callback will cause three new methods to be created, on_name, has_on_name?, and call_on_name. The on_name method may be used to register a block for the corresponding callback.
A helper method for defining new operations supported by this implementation. This will create one method for each named operation. By default, the method simply formats the packet (using the packet assistant), and then sends the data via the driver. It will then return the request id used for this operation.
Dispatches the given packet type to the appropriate handler method. If a new protocol version adds a new packet type, it should override this method, performing its own checking first, followed by calling super.
Used internally to handle attrs packets. The on_attrs callback is invoked, if registered, with the driver, id, and attribute object.
Used internally to handle data packets. The on_data callback is invoked, if registered, with the driver, id, and data (as a buffer).
Used internally to handle handle packets. The on_handle callback is invoked, if registered, with the driver, id, and handle.
Used internally to handle name packets. The on_name callback is invoked, if registered, with the driver, id, and array of items.
Used internally to handle status packets. The on_status callback is invoked, if registered, with the driver, id, and code.
The fstat operation is special, since later versions of the protocol add support for ‘flags’. These flags are ignored in this version, but the parameter exists to allow a program written for one version of the protocol to work with later versions.
The lstat operation is special, since later versions of the protocol add support for ‘flags’. These flags are ignored in this version, but the parameter exists to allow a program written for one version of the protocol to work with later versions.