Sha256: 01ba7ca349e36e2606b865eb966e2f08a2042c5aedd974516aabe57adbb16fc2

Contents?: true

Size: 1.18 KB

Versions: 5

Compression:

Stored size: 1.18 KB

Contents

module RubySMB
  class Client

    # Contains the methods for doing ECHO commands
    module Echo

      # Sends an ECHO request packet and returns the
      # last response packet.
      #
      # @param echo [Integer] the number of times the server should echo (ignored in SMB2)
      # @param data [String] the data the server should echo back (ignored in SMB2)
      # @return [RubySMB::SMB1::Packet::EchoResponse] the last Echo Response packet received
      def smb1_echo(count: 1, data: '')
        request = RubySMB::SMB2::Packet::EchoRequest.new
        request.parameter_block.echo_count = count
        request.data_block.data = data
        raw_response = send_recv(request)
        (count - 1).times do
          raw_response = dispatcher.recv_packet
        end
        RubySMB::SMB1::Packet::EchoResponse.read(raw_response)
      end


      # Sends an ECHO request packet and returns the
      # response packet.
      #
      # @return [RubySMB::SMB2::Packet::EchoResponse]
      def smb2_echo
        request      = RubySMB::SMB2::Packet::EchoRequest.new
        raw_response = send_recv(request)
        RubySMB::SMB2::Packet::EchoResponse.read(raw_response)
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ruby_smb-0.0.17 lib/ruby_smb/client/echo.rb
ruby_smb-0.0.16 lib/ruby_smb/client/echo.rb
ruby_smb-0.0.15 lib/ruby_smb/client/echo.rb
ruby_smb-0.0.14 lib/ruby_smb/client/echo.rb
ruby_smb-0.0.13 lib/ruby_smb/client/echo.rb