Class | Net::SFTP::Protocol::V04::Base |
In: |
lib/net/sftp/protocol/04/base.rb
|
Parent: | V03::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.
DEFAULT_FLAGS | = | Attributes::F_SIZE | Attributes::F_PERMISSIONS | Attributes::F_ACCESSTIME | Attributes::F_CREATETIME | Attributes::F_MODIFYTIME | Attributes::F_ACL | Attributes::F_OWNERGROUP | Attributes::F_SUBSECOND_TIMES | Attributes::F_EXTENDED | The default flags used if the flags parameter is nil for any of the stat, lstat, or fstat operations. |
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 63: def fstat(handle, flags=nil) 64: send_request(FXP_FSTAT, :string, handle, :long, flags || DEFAULT_FLAGS) 65: end
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 54: def lstat(path, flags=nil) 55: send_request(FXP_LSTAT, :string, path, :long, flags || DEFAULT_FLAGS) 56: end
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 28: def parse_name_packet(packet) 29: names = [] 30: 31: packet.read_long.times do 32: filename = packet.read_string 33: attrs = attribute_factory.from_buffer(packet) 34: names << name_factory.new(filename, attrs) 35: end 36: 37: { :names => names } 38: end
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 45: def stat(path, flags=nil) 46: send_request(FXP_STAT, :string, path, :long, flags || DEFAULT_FLAGS) 47: end
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 83: def attribute_factory 84: V04::Attributes 85: end
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 89: def name_factory 90: V04::Name 91: end