pssht  latest
SSH server library written in PHP
fpoirotte\Pssht\Wire\Decoder Class Reference

Public Member Functions

 __construct (\fpoirotte\Pssht\Buffer $buffer=null)
 
 decodeBoolean ()
 
 decodeBytes ($count=1)
 
 decodeMpint ()
 
 decodeNameList ($validationCallback=null)
 
 decodeString ()
 
 decodeUint32 ()
 
 decodeUint64 ()
 
 getBuffer ()
 

Protected Attributes

 $buffer
 Buffer the encoded values are read from.
 

Detailed Description

Decode SSH-encoded values (RFC 4251).

Definition at line 17 of file Decoder.php.

Constructor & Destructor Documentation

fpoirotte\Pssht\Wire\Decoder::__construct ( \fpoirotte\Pssht\Buffer  $buffer = null)

Construct a new decoder.

Parameters
fpoirotte::Pssht::Buffer$buffer(optional) Buffer to read from. If omitted, a new empty buffer is used.

Definition at line 29 of file Decoder.php.

References fpoirotte\Pssht\Wire\Decoder\$buffer.

Member Function Documentation

fpoirotte\Pssht\Wire\Decoder::decodeBoolean ( )

Decode a boolean value ("boolean" type).

Return values
boolDecoded value.
nullThe buffer did not contain enough data.

Definition at line 84 of file Decoder.php.

References fpoirotte\Pssht\Wire\Decoder\decodeBytes().

fpoirotte\Pssht\Wire\Decoder::decodeBytes (   $count = 1)

Decode a series of bytes ("byte" type).

Parameters
int$count(optional) Number of bytes to decode. Defaults to 1.
Return values
stringA string of exactly $count bytes.
nullThe buffer did not contain enough data.

Definition at line 62 of file Decoder.php.

Referenced by fpoirotte\Pssht\Wire\Decoder\decodeBoolean(), fpoirotte\Pssht\Wire\Decoder\decodeString(), fpoirotte\Pssht\Wire\Decoder\decodeUint32(), and fpoirotte\Pssht\Wire\Decoder\decodeUint64().

fpoirotte\Pssht\Wire\Decoder::decodeMpint ( )

Decode an arbitrary precision number ("mpint" type).

Return values
resourceGMP resource representing the decoded arbitrary precision number.
nullThe buffer did not contain enough data.

Definition at line 164 of file Decoder.php.

References fpoirotte\Pssht\Wire\Decoder\decodeString().

fpoirotte\Pssht\Wire\Decoder::decodeNameList (   $validationCallback = null)

Decode a list of names ("name-list" type).

Parameters
callable$validationCallback(optional) Callback to call with the list as its sole argument for validation before it is returned. The callback should throw \InvalidArgumentException if any of the values is invalid. By default, this method already validates the values using the rules for "name-list" type given in RFC 4251.
Return values
arrayList of decoded algorithm names.
nullThe buffer did not contain enough data.

Definition at line 203 of file Decoder.php.

References fpoirotte\Pssht\Wire\Decoder\decodeString().

fpoirotte\Pssht\Wire\Decoder::decodeString ( )

Decode a character string ("string" type).

Return values
stringDecoded value.
nullThe buffer did not contain enough data.

Definition at line 140 of file Decoder.php.

References fpoirotte\Pssht\Wire\Decoder\decodeBytes(), and fpoirotte\Pssht\Wire\Decoder\decodeUint32().

Referenced by fpoirotte\Pssht\Wire\Decoder\decodeMpint(), and fpoirotte\Pssht\Wire\Decoder\decodeNameList().

fpoirotte\Pssht\Wire\Decoder::decodeUint32 ( )

Decode a 32 bits unsigned value ("uint32" type).

Return values
intDecoded value.
nullThe buffer did not contain enough data.

Definition at line 102 of file Decoder.php.

References fpoirotte\Pssht\Wire\Decoder\decodeBytes().

Referenced by fpoirotte\Pssht\Wire\Decoder\decodeString().

fpoirotte\Pssht\Wire\Decoder::decodeUint64 ( )

Decode a 64 bits unsigned value ("uint64" type).

Return values
resourceGMP resource representing the decoded 64 bits unsigned value.
nullThe buffer did not contain enough data.

Definition at line 122 of file Decoder.php.

References fpoirotte\Pssht\Wire\Decoder\decodeBytes().

fpoirotte\Pssht\Wire\Decoder::getBuffer ( )

Get the buffer associated with this decoder.

Return values
fpoirotte::Pssht::BufferThe buffer associated with this decoder.

Definition at line 44 of file Decoder.php.

References fpoirotte\Pssht\Wire\Decoder\$buffer.


The documentation for this class was generated from the following file: