Sha256: 012199a0dd11e1cd324edbd5bc03b0ef987f2cd256f8679d5e54b8f544ee06b8

Contents?: true

Size: 1.4 KB

Versions: 281

Compression:

Stored size: 1.4 KB

Contents

require 'net/ssh/buffer'
require 'net/ssh/test/packet'

module Net; module SSH; module Test

  # This is a specialization of Net::SSH::Test::Packet for representing mock
  # packets that are received by the local (client) host. These are created
  # automatically by Net::SSH::Test::Script and Net::SSH::Test::Channel by any
  # of the gets_* methods.
  class RemotePacket < Packet
    # Returns +true+; this is a remote packet.
    def remote?
      true
    end

    # The #process method should only be called on Net::SSH::Test::LocalPacket
    # packets; if it is attempted on a remote packet, then it is an expectation
    # mismatch (a remote packet was received when a local packet was expected
    # to be sent). This will happen when either your test script
    # (Net::SSH::Test::Script) or your program are wrong.
    def process(packet)
      raise "received packet type #{packet.read_byte} and was not expecting any packet"
    end

    # Returns this remote packet as a string, suitable for parsing by 
    # Net::SSH::Transport::PacketStream and friends. When a remote packet is
    # received, this method is called and the result concatenated onto the
    # input buffer for the packet stream.
    def to_s
      @to_s ||= begin
        instantiate!
        string = Net::SSH::Buffer.from(:byte, @type, *types.zip(@data).flatten).to_s
        [string.length, string].pack("NA*")
      end
    end
  end

end; end; end

Version data entries

281 entries across 238 versions & 30 rubygems

Version Path
vagrant-unbundled-2.2.7.0 vendor/bundle/ruby/2.4.0/gems/net-ssh-4.1.0/lib/net/ssh/test/remote_packet.rb
vagrant-unbundled-2.1.2.0 vendor/bundle/ruby/2.3.0/gems/net-ssh-4.2.0/lib/net/ssh/test/remote_packet.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.4.0/gems/net-ssh-4.2.0/lib/net/ssh/test/remote_packet.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.5.0/gems/net-ssh-4.2.0/lib/net/ssh/test/remote_packet.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.3.0/gems/net-ssh-4.2.0/lib/net/ssh/test/remote_packet.rb
vagrant-unbundled-2.1.1.0 vendor/bundle/ruby/2.5.0/gems/net-ssh-4.2.0/lib/net/ssh/test/remote_packet.rb
vagrant-unbundled-2.0.4.0 vendor/bundle/ruby/2.5.0/gems/net-ssh-4.2.0/lib/net/ssh/test/remote_packet.rb
vagrant-unbundled-2.0.3.0 vendor/bundle/ruby/2.5.0/gems/net-ssh-4.2.0/lib/net/ssh/test/remote_packet.rb
net-ssh-5.0.0.beta1 lib/net/ssh/test/remote_packet.rb
vagrant-unbundled-2.0.2.0 vendor/bundle/ruby/2.4.0/gems/net-ssh-4.1.0/lib/net/ssh/test/remote_packet.rb
vagrant-unbundled-2.0.2.0 vendor/bundle/ruby/2.5.0/gems/net-ssh-4.2.0/lib/net/ssh/test/remote_packet.rb
vagrant-unbundled-2.0.1.0 vendor/bundle/ruby/2.4.0/gems/net-ssh-4.1.0/lib/net/ssh/test/remote_packet.rb
vagrant-unbundled-2.0.0.1 vendor/bundle/ruby/2.4.0/gems/net-ssh-4.1.0/lib/net/ssh/test/remote_packet.rb
net-ssh-4.2.0 lib/net/ssh/test/remote_packet.rb
vagrant-unbundled-1.9.8.1 vendor/bundle/ruby/2.4.0/gems/net-ssh-4.1.0/lib/net/ssh/test/remote_packet.rb
vagrant-unbundled-1.9.7.1 vendor/bundle/ruby/2.4.0/gems/net-ssh-4.1.0/lib/net/ssh/test/remote_packet.rb
net-ssh-4.2.0.rc2 lib/net/ssh/test/remote_packet.rb
net-ssh-4.2.0.rc1 lib/net/ssh/test/remote_packet.rb
vagrant-unbundled-1.9.5.1 vendor/bundle/ruby/2.4.0/gems/net-ssh-4.1.0/lib/net/ssh/test/remote_packet.rb
savant-echo-1.0.4 bin/packaging/vendor/ruby/2.2.0/gems/net-ssh-3.2.0/lib/net/ssh/test/remote_packet.rb