lib/net/sftp/protocol/01/base.rb
# Sends a FXP_OPEN packet to the server and returns the packet identifier.
# The +flags+ parameter is either an integer (in which case it must be
# a combination of the IO constants) or a string (in which case it must
# be one of the mode strings that IO::open accepts). The +options+
# parameter is a hash that is used to construct a new Attribute object,
# to pass as part of the FXP_OPEN request.
Sends a FXP_OPEN packet to the server and returns the packet identifier.
The +flags+ parameter is either an integer (in which case it must be
a combination of the IO constants) or a string (in which case it must
be one of the mode strings that IO::open accepts). The +options+
parameter is a hash that is used to construct a new Attribute object,
to pass as part of the FXP_OPEN request.
Sends a FXP_OPEN packet to the server and returns the packet identifier . The + flags + parameter is either an integer ( in which case it must be a combination of the IO constants ) or a string ( in which case it must be one of the mode strings that IO :: open accepts ) . The + options + parameter is a hash that is used to construct a new Attribute object to pass as part of the FXP_OPEN request .
def open(path, flags, options)
      flags = normalize_open_flags(flags)
      if flags & (IO::WRONLY | IO::RDWR) != 0
        sftp_flags = FV1::WRITE
        sftp_flags |= FV1::READ if flags & IO::RDWR != 0
        sftp_flags |= FV1::APPEND if flags & IO::APPEND != 0
      else
        sftp_flags = FV1::READ
      end
      sftp_flags |= FV1::CREAT if flags & IO::CREAT != 0
      sftp_flags |= FV1::TRUNC if flags & IO::TRUNC != 0
      sftp_flags |= FV1::EXCL  if flags & IO::EXCL  != 0
      attributes = attribute_factory.new(options)
      send_request(FXP_OPEN, :string, path, :long, sftp_flags, :raw, attributes.to_s)
    end
def open ( path , flags , options ) flags = normalize_open_flags ( flags ) if flags & ( IO :: WRONLY | IO :: RDWR ) != 0 sftp_flags = FV1 :: WRITE sftp_flags |= FV1 :: READ if flags & IO :: RDWR != 0 sftp_flags |= FV1 :: APPEND if flags & IO :: APPEND != 0 else sftp_flags = FV1 :: READ end sftp_flags |= FV1 :: CREAT if flags & IO :: CREAT != 0 sftp_flags |= FV1 :: TRUNC if flags & IO :: TRUNC != 0 sftp_flags |= FV1 :: EXCL if flags & IO :: EXCL != 0 attributes = attribute_factory . new ( options ) send_request ( FXP_OPEN , :string , path , :long , sftp_flags , :raw , attributes . to_s ) end
Sends a FXP_OPEN packet to the server and returns the packet identifier.
Sends a FXP_OPEN packet to the server and returns the packet identifier .
path
<not_specific>
flags
<not_specific>
options
<not_specific>