GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Net::SSH::Perl::Packet(3) User Contributed Perl Documentation Net::SSH::Perl::Packet(3)

Net::SSH::Perl::Packet - Packet layer of SSH protocol

    use Net::SSH::Perl::Packet;

    # Send a packet to an ssh daemon.
    my $pack = Net::SSH::Perl::Packet->new($ssh, type => SSH_MSG_NONE);
    $pack->send;

    # Receive a packet.
    my $pack = Net::SSH::Perl::Packet->read($ssh);

Net::SSH::Perl::Packet implements the packet-layer piece of the SSH protocol. Messages between server and client are sent as binary data packets, which are encrypted (once the two sides have agreed on the encryption cipher, that is).

Packets are made up primarily of a packet type, which describes the type of message and data contained therein, and the data itself. In addition, each packet: indicates its length in a 32-bit unsigned integer; contains padding to pad the length of the packet to a multiple of 8 bytes; and is verified by a 32-bit crc checksum.

Refer to the SSH RFC for more details on the packet protocol and the SSH protocol in general.

Creates/starts a new packet in memory. $ssh is a Net::SSH::Perl object, which should already be connected to an ssh daemon. %params can contain the following keys:
  • type

    The message type of this packet. This should be one of the values exported by Net::SSH::Perl::Constants from the msg tag; for example, SSH_MSG_NONE.

  • data

    A Net::SSH::Perl::Buffer object containing the data in this packet. Realistically, there aren't many times you'll need to supply this argument: when sending a packet, it will be created automatically; and when receiving a packet, the read method (see below) will create the buffer automatically, as well.

Reads a packet from the ssh daemon and returns that packet.

This method will block until an entire packet has been read. The socket itself is non-blocking, but the method waits (using select) for data on the incoming socket, then processes that data when it comes in. If the data makes up a complete packet, the packet is returned to the caller. Otherwise read continues to try to read more data.

Checks the data that's been read from the sshd to see if that data comprises a complete packet. If so, that packet is returned. If not, returns "undef".

This method does not block.

Reads the next packet from the daemon and dies if the packet type does not match $type. Otherwise returns the read packet.

Sends a packet to the ssh daemon. $data is optional, and if supplied specifies the buffer to be sent in the packet (should be a Net::SSH::Perl::Buffer object). In addition, $data, if specified, must include the packed message type.

If $data is not specified, send sends the buffer internal to the packet, which you've presumably filled by calling the put_* methods (see below).

Returns the message type of the packet $packet.

Returns the message buffer from the packet $packet; a Net::SSH::Perl::Buffer object.

Calling methods from the Net::SSH::Perl::Buffer class on your Net::SSH::Perl::Packet object will automatically invoke those methods on the buffer object internal to your packet object (which is created when your object is constructed). For example, if you executed the following code:

    my $packet = Net::SSH::Perl::Packet->new($ssh, type => SSH_CMSG_USER);
    $packet->put_str($user);

this would construct a new packet object $packet, then fill its internal buffer by calling the put_str method on it.

Refer to the Net::SSH::Perl::Buffer documentation (the GET AND PUT METHODS section) for more details on those methods.

Please see the Net::SSH::Perl manpage for author, copyright, and license information.
2017-08-24 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.