The abstract parent of IncomingPacketStream and OutgoingPacketStream. It represents the common interface of its subclasses.
Methods
Attributes
| [R] | sequence_number | the sequence number of the next packet to be processed. |
| [W] | socket | 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.
[ show 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.
[ show 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.
[ show source ]
# File lib/net/ssh/transport/packet-stream.rb, line 46
46: def set_algorithms( cipher, mac )
47: @cipher, @hmac = cipher, mac
48: end