Class: HrrRbSftp::Protocol::Version1::Packets::SSH_FXP_REALPATH

Inherits:
Packet show all
Defined in:
lib/hrr_rb_sftp/protocol/version1/packets/016_ssh_fxp_realpath.rb

Overview

This class implements SFTP protocol version 1 SSH_FXP_REALPATH packet type, format, and responder.

Constant Summary collapse

TYPE =

Represents SSH_FXP_REALPATH packet type.

16
FORMAT =

Represents SSH_FXP_REALPATH packet format.

[
  [DataTypes::Byte,   :"type"      ],
  [DataTypes::Uint32, :"request-id"],
  [DataTypes::String, :"path"      ],
]

Instance Attribute Summary

Attributes included from Loggable

#logger

Instance Method Summary collapse

Methods inherited from Packet

#context, #handles, #initialize, #version

Methods inherited from Common::Packets::Packet

#decode, #encode, #initialize

Methods included from Loggable

#log_debug, #log_error, #log_fatal, #log_info, #log_warn

Constructor Details

This class inherits a constructor from HrrRbSftp::Protocol::Version1::Packets::Packet

Instance Method Details

#respond_to(request) ⇒ Hash{Symbol=>Object}

Responds to SSH_FXP_REALPATH request.

Parameters:

  • request (Hash{Symbol=>Object})

    SSH_FXP_REALPATH request represented in Hash.

Returns:

  • (Hash{Symbol=>Object})

    Response represented in Hash. Its type is SSH_FXP_NAME.



31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/hrr_rb_sftp/protocol/version1/packets/016_ssh_fxp_realpath.rb', line 31

def respond_to request
  log_debug { "absolute_path = File.absolute_path(#{request[:"path"].inspect})" }
  absolute_path = File.absolute_path(request[:"path"])
  {
    :"type"        => SSH_FXP_NAME::TYPE,
    :"request-id"  => request[:"request-id"],
    :"count"       => 1,
    :"filename[0]" => absolute_path,
    :"longname[0]" => absolute_path,
    :"attrs[0]"    => {},
  }
end