require 'net/sftp/protocol/01/attributes' module Net; module SFTP; module Protocol; module V04 # A class representing the attributes of a file or directory on the server. # It may be used to specify new attributes, or to query existing attributes. # This particular class is specific to versions 4 and 5 of the SFTP # protocol. # # To specify new attributes, just pass a hash as the argument to the # constructor. The following keys are supported: # # * :type:: the type of the item (integer, one of the T_ constants) # * :size:: the size of the item (integer) # * :uid:: the user-id that owns the file (integer) # * :gid:: the group-id that owns the file (integer) # * :owner:: the name of the user that owns the file (string) # * :group:: the name of the group that owns the file (string) # * :permissions:: the permissions on the file (integer, e.g. 0755) # * :atime:: the access time of the file (integer, seconds since epoch) # * :atime_nseconds:: the nanosecond component of atime (integer) # * :createtime:: the time at which the file was created (integer, seconds since epoch) # * :createtime_nseconds:: the nanosecond component of createtime (integer) # * :mtime:: the modification time of the file (integer, seconds since epoch) # * :mtime_nseconds:: the nanosecond component of mtime (integer) # * :acl:: an array of ACL entries for the item # * :extended:: a hash of name/value pairs identifying extended info # # Likewise, when the server sends an Attributes object, all of the # above attributes are exposed as methods (though not all will be set with # non-nil values from the server). class Attributes < V01::Attributes F_ACCESSTIME = 0x00000008 F_CREATETIME = 0x00000010 F_MODIFYTIME = 0x00000020 F_ACL = 0x00000040 F_OWNERGROUP = 0x00000080 F_SUBSECOND_TIMES = 0x00000100 # A simple struct for representing a single entry in an Access Control # List. (See Net::SFTP::Constants::ACE) ACL = Struct.new(:type, :flag, :mask, :who) class <