Class: Net::SFTP::Protocol::V04::Base

### Home Classes Methods

### In Files

- lib/net/sftp/protocol/04/base.rb

### Parent

Net::SFTP::Protocol::V03::Base

### Methods

- #attribute_factory
- #fstat
- #lstat
- #name_factory
- #parse_name_packet
- #stat
- #version

### Files

- README.rdoc

### Class/Module Index

Quicksearch

- Net
- Net::SFTP
- Net::SFTP::Constants
- Net::SFTP::Constants::ACE
- Net::SFTP::Constants::ACE::Flag
- Net::SFTP::Constants::ACE::Mask
- Net::SFTP::Constants::ACE::Type
- Net::SFTP::Constants::LockTypes
- Net::SFTP::Constants::OpenFlags
- Net::SFTP::Constants::OpenFlags::FV1
- Net::SFTP::Constants::OpenFlags::FV5
- Net::SFTP::Constants::OpenFlags::FV6
- Net::SFTP::Constants::PacketTypes
- Net::SFTP::Constants::RenameFlags
- Net::SFTP::Constants::StatusCodes
- Net::SFTP::Exception
- Net::SFTP::Operations
- Net::SFTP::Operations::Dir
- Net::SFTP::Operations::Download
- Net::SFTP::Operations::File
- Net::SFTP::Operations::FileFactory
- Net::SFTP::Operations::Upload
- Net::SFTP::Packet
- Net::SFTP::Protocol
- Net::SFTP::Protocol::Base
- Net::SFTP::Protocol::V01
- Net::SFTP::Protocol::V01::Attributes
- Net::SFTP::Protocol::V01::Base
- Net::SFTP::Protocol::V01::Name
- Net::SFTP::Protocol::V02
- Net::SFTP::Protocol::V02::Base
- Net::SFTP::Protocol::V03
- Net::SFTP::Protocol::V03::Base
- Net::SFTP::Protocol::V04
- Net::SFTP::Protocol::V04::Attributes
- Net::SFTP::Protocol::V04::Base
- Net::SFTP::Protocol::V04::Name
- Net::SFTP::Protocol::V05
- Net::SFTP::Protocol::V05::Base
- Net::SFTP::Protocol::V06
- Net::SFTP::Protocol::V06::Attributes
- Net::SFTP::Protocol::V06::Base
- Net::SFTP::Request
- Net::SFTP::Response
- Net::SFTP::Session
- Net::SFTP::StatusException
- Net::SFTP::Version
- Net::SSH
- Net::SSH::Connection
- Net::SSH::Connection::Session

No matching classes.

# Net::SFTP::Protocol::V04::Base

Wraps the low-level SFTP calls for version 4 of the SFTP protocol. Also implements the updated FXP_NAME packet parsing as mandated by v4 of the protocol.

None of these protocol methods block--all of them return immediately, requiring the SSH event loop to be run while the server response is pending.

You will almost certainly never need to use this driver directly. Please see Net::SFTP::Session for the recommended interface.

### Constants

DEFAULT_FLAGS

  The default flags used if the `flags` parameter is nil for any of the stat, lstat, or fstat operations.

### Public Instance Methods

fstat(handle, flags=nil) click to toggle source

Sends a FXP_FSTAT packet to the server for the given `path`, and with the given `flags`. If `flags` is nil, it defaults to F_SIZE | F_PERMISSIONS | F_ACCESSTIME | F_CREATETIME | F_MODIFYTIME | F_ACL | F_OWNERGROUP | F_SUBSECOND_TIMES | F_EXTENDED (see Net::SFTP::Protocol::V04::Attributes for those constants).

    # File lib/net/sftp/protocol/04/base.rb, line 63
    def fstat(handle, flags=nil)
      send_request(FXP_FSTAT, :string, handle, :long, flags || DEFAULT_FLAGS)
    end

lstat(path, flags=nil) click to toggle source

Sends a FXP_LSTAT packet to the server for the given `path`, and with the given `flags`. If `flags` is nil, it defaults to F_SIZE | F_PERMISSIONS | F_ACCESSTIME | F_CREATETIME | F_MODIFYTIME | F_ACL | F_OWNERGROUP | F_SUBSECOND_TIMES | F_EXTENDED (see Net::SFTP::Protocol::V04::Attributes for those constants).

    # File lib/net/sftp/protocol/04/base.rb, line 54
    def lstat(path, flags=nil)
      send_request(FXP_LSTAT, :string, path, :long, flags || DEFAULT_FLAGS)
    end

parse_name_packet(packet) click to toggle source

As of v4 of the SFTP protocol, the "longname" member was removed from the FXP_NAME structure. This method is essentially the same as the previous implementation, but omits longname.

    # File lib/net/sftp/protocol/04/base.rb, line 28
    def parse_name_packet(packet)
      names = []

      packet.read_long.times do
        filename = packet.read_string
        attrs    = attribute_factory.from_buffer(packet)
        names   << name_factory.new(filename, attrs)
      end

      { :names => names }
    end

stat(path, flags=nil) click to toggle source

Sends a FXP_STAT packet to the server for the given `path`, and with the given `flags`. If `flags` is nil, it defaults to F_SIZE | F_PERMISSIONS | F_ACCESSTIME | F_CREATETIME | F_MODIFYTIME | F_ACL | F_OWNERGROUP | F_SUBSECOND_TIMES | F_EXTENDED (see Net::SFTP::Protocol::V04::Attributes for those constants).

    # File lib/net/sftp/protocol/04/base.rb, line 45
    def stat(path, flags=nil)
      send_request(FXP_STAT, :string, path, :long, flags || DEFAULT_FLAGS)
    end

version() click to toggle source

Returns the protocol version implemented by this driver. (4, in this case)

    # File lib/net/sftp/protocol/04/base.rb, line 21
    def version
      4
    end

### Protected Instance Methods

attribute_factory() click to toggle source

Returns the Attributes class used by this version of the protocol (Net::SFTP::Protocol::V04::Attributes, in this case)

    # File lib/net/sftp/protocol/04/base.rb, line 83
    def attribute_factory
      V04::Attributes
    end

name_factory() click to toggle source

Returns the Name class used by this version of the protocol (Net::SFTP::Protocol::V04::Name, in this case)

    # File lib/net/sftp/protocol/04/base.rb, line 89
    def name_factory
      V04::Name
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.