Class: HrrRbSftp::Protocol::Version3::Extensions::FsyncAtOpensshCom

Inherits:
Extension
  • Object
show all
Defined in:
lib/hrr_rb_sftp/protocol/version3/extensions/fsync_at_openssh_com.rb

Overview

This class implements [email protected] version 1 extension format and responder.

Constant Summary collapse

EXTENSION_NAME =

Represents [email protected] version 1 extension name.

"[email protected]"
EXTENSION_DATA =

Represents [email protected] version 1 extension data.

"1"
REQUEST_FORMAT =

Represents SSH_FXP_EXTENDED packet additional format for [email protected] version 1 extension.

{
  :"extended-request" => {
    "[email protected]" => [
      [DataTypes::String, :"handle"],
    ],
  },
}

Instance Attribute Summary

Attributes included from Loggable

#logger

Instance Method Summary collapse

Methods inherited from Extension

#context, #handles, #initialize, #version

Methods included from Loggable

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

Constructor Details

This class inherits a constructor from HrrRbSftp::Protocol::Version3::Extensions::Extension

Instance Method Details

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

Responds to SSH_FXP_EXTENDED request with [email protected] extended-request.

Parameters:

  • request (Hash{Symbol=>Object})

    SSH_FXP_EXTENDED request represented in Hash.

Returns:

  • (Hash{Symbol=>Object})

    Response represented in Hash. Its type is SSH_FXP_STATUS.



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/hrr_rb_sftp/protocol/version3/extensions/fsync_at_openssh_com.rb', line 38

def respond_to request
  begin
    raise "Specified handle does not exist" unless handles.has_key?(request[:"handle"])
    log_debug { "file = handles[#{request[:"handle"].inspect}]" }
    file = handles[request[:"handle"]]
    log_debug { "file.fsync" }
    file.fsync
    {
      :"type"          => Packets::SSH_FXP_STATUS::TYPE,
      :"request-id"    => request[:"request-id"],
      :"code"          => Packets::SSH_FXP_STATUS::SSH_FX_OK,
      :"error message" => "Success",
      :"language tag"  => "",
    }
  end
end