Class Net::SSH::Transport::PacketStream
In: lib/net/ssh/transport/packet-stream.rb
Parent: Object

The abstract parent of IncomingPacketStream and OutgoingPacketStream. It represents the common interface of its subclasses.

Methods

Attributes

sequence_number  [R]  the sequence number of the next packet to be processed.
socket  [W]  the setter for setting the socket to use for IO communication

Public Class methods

Create a new packet stream. The given ciphers and hmacs are factories that are used to initialize the cipher and mac attributes.

[Source]

    # File lib/net/ssh/transport/packet-stream.rb, line 38
38:         def initialize( ciphers, hmacs )
39:           @sequence_number = 0
40: 
41:           @cipher = ciphers.get( "none" )
42:           @hmac = hmacs.get( "none" )
43:         end

Public Instance methods

Compute the mac for the given payload.

[Source]

    # File lib/net/ssh/transport/packet-stream.rb, line 51
51:         def compute_hmac( payload )
52:           @hmac.digest( [ @sequence_number, payload ].pack( "NA*" ) )
53:         end

Set the cipher and mac algorithms to the given arguments.

[Source]

    # File lib/net/ssh/transport/packet-stream.rb, line 46
46:         def set_algorithms( cipher, mac )
47:           @cipher, @hmac = cipher, mac
48:         end

[Validate]