Package paramiko :: Module message :: Class Message
[show private | hide private]
[frames | no frames]

Type Message

object --+
         |
        Message


An SSH2 Message is a stream of bytes that encodes some combination of strings, integers, bools, and infinite-precision integers (known in python as longs). This class builds or breaks down such a byte stream.
Method Summary
  __init__(self, content)
Create a new SSH2 Message.
string __repr__(self)
Returns a string representation of this object, for debugging.
string __str__(self)
Return the byte stream content of this Message, as a string.
  add(self, i)
  add_boolean(self, b)
  add_byte(self, b)
  add_bytes(self, b)
  add_int(self, n)
  add_int64(self, n)
Add a 64-bit int to the stream.
  add_list(self, l)
  add_mpint(self, z)
this only works on positive numbers
  add_string(self, s)
bool get_boolean(self)
Fetch a boolean from the stream.
string get_byte(self)
Return the next byte of the Message, without decomposing it.
string get_bytes(self, n)
Return the next n bytes of the Message, without decomposing into an int, string, etc.
int get_int(self)
Fetch an int from the stream.
long get_int64(self)
Fetch a 64-bit int from the stream.
list of strings get_list(self)
Fetch a list of strings from the stream.
long get_mpint(self)
Fetch a long int (mpint) from the stream.
string get_remainder(self)
Return the bytes of this Message that haven't already been parsed and returned.
string get_so_far(self)
Returns the bytes of this Message that have been parsed and returned.
string get_string(self)
Fetch a string from the stream.
    Inherited from object
  __delattr__(...)
x.__delattr__('name') <==> del x.name
  __getattribute__(...)
x.__getattribute__('name') <==> x.name
  __hash__(x)
x.__hash__() <==> hash(x)
  __new__(T, S, ...)
T.__new__(S, ...) -> a new object with type S, a subtype of T
  __reduce__(...)
helper for pickle
  __reduce_ex__(...)
helper for pickle
  __setattr__(...)
x.__setattr__('name', value) <==> x.name = value

Method Details

__init__(self, content='')
(Constructor)

Create a new SSH2 Message.
Parameters:
content - the byte stream to use as the Message content (usually passed in only when decomposing a Message).
           (type=string)
Overrides:
__builtin__.object.__init__

__repr__(self)
(Representation operator)

Returns a string representation of this object, for debugging.
Returns:
string
Overrides:
__builtin__.object.__repr__

__str__(self)
(Informal representation operator)

Return the byte stream content of this Message, as a string.
Returns:
the contents of this Message.
           (type=string)
Overrides:
__builtin__.object.__str__

add_int64(self, n)

Add a 64-bit int to the stream.
Parameters:
n - long int to add.
           (type=long)

add_mpint(self, z)

this only works on positive numbers

get_boolean(self)

Fetch a boolean from the stream.
Returns:
True or False (from the Message).
           (type=bool)

get_byte(self)

Return the next byte of the Message, without decomposing it. This is equivalent to get_bytes(1).
Returns:
the next byte of the Message, or '' if there aren't any bytes remaining.
           (type=string)

get_bytes(self, n)

Return the next n bytes of the Message, without decomposing into an int, string, etc. Just the raw bytes are returned.
Returns:
a string of the next n bytes of the Message, or a string of n zero bytes, if there aren't n bytes remaining.
           (type=string)

get_int(self)

Fetch an int from the stream.
Returns:
a 32-bit unsigned integer.
           (type=int)

get_int64(self)

Fetch a 64-bit int from the stream.
Returns:
a 64-bit unsigned integer.
           (type=long)

get_list(self)

Fetch a list of strings from the stream. These are trivially encoded as comma-separated values in a string.
Returns:
a list of strings.
           (type=list of strings)

get_mpint(self)

Fetch a long int (mpint) from the stream.
Returns:
an arbitrary-length integer.
           (type=long)

get_remainder(self)

Return the bytes of this Message that haven't already been parsed and returned.
Returns:
a string of the bytes not parsed yet.
           (type=string)

get_so_far(self)

Returns the bytes of this Message that have been parsed and returned. The string passed into a Message's constructor can be regenerated by concatenating get_so_far and get_remainder.
Returns:
a string of the bytes parsed so far.
           (type=string)

get_string(self)

Fetch a string from the stream. This could be a byte string and may contain unprintable characters. (It's not unheard of for a string to contain another byte-stream Message.)
Returns:
a string.
           (type=string)

Generated by Epydoc 2.1 on Fri Apr 23 15:55:50 2004 http://epydoc.sf.net