Module | Net::SSH::Transport::PacketStream |
In: |
lib/net/ssh/transport/packet_stream.rb
|
A module that builds additional functionality onto the Net::SSH::BufferedIo module. It adds SSH encryption, compression, and packet validation, as per the SSH2 protocol. It also adds an abstraction for polling packets, to allow for both blocking and non-blocking reads.
client | [R] | The client state object, which encapsulates the algorithms used to build packets to send to the server. |
hints | [R] | The map of "hints" that can be used to modify the behavior of the packet stream. For instance, when authentication succeeds, an "authenticated" hint is set, which is used to determine whether or not to compress the data when using the "delayed" compression algorithm. |
server | [R] | The server state object, which encapsulates the algorithms used to interpret packets coming from the server. |
Performs any pending cleanup necessary on the IO and its associated state objects. (See State#cleanup).
Enqueues a packet to be sent, but does not immediately send the packet. The given payload is pre-processed according to the algorithms specified in the client state (compression, cipher, and hmac).
If the IO object requires a rekey operation (as indicated by either its client or server state objects, see State#needs_rekey?), this will yield. Otherwise, this does nothing.
Returns the next full packet. If the mode parameter is :nonblock (the default), then this will return immediately, whether a packet is available or not, and will return nil if there is no packet ready to be returned. If the mode parameter is :block, then this method will block until a packet is available.
Called when this module is used to extend an object. It initializes the states and generally prepares the object for use as a packet stream.
Tries to read the next packet. If there is insufficient data to read an entire packet, this returns immediately, otherwise the packet is read, post-processed according to the cipher, hmac, and compression algorithms specified in the server state object, and returned as a new Packet object.