diff options
Diffstat (limited to 'paramiko/message.py')
-rw-r--r-- | paramiko/message.py | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/paramiko/message.py b/paramiko/message.py index 05c1dd4c..f8ed6170 100644 --- a/paramiko/message.py +++ b/paramiko/message.py @@ -32,7 +32,7 @@ class Message (object): 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. - + Normally you don't need to deal with anything this low-level, but it's exposed for people implementing custom extensions, or features that paramiko doesn't support yet. @@ -188,7 +188,7 @@ class Message (object): def get_list(self): """ Fetch a `list` of `strings <str>` from the stream. - + These are trivially encoded as comma-separated values in a string. """ return self.get_text().split(',') @@ -196,7 +196,7 @@ class Message (object): def add_bytes(self, b): """ Write bytes to the stream, without any formatting. - + :param str b: bytes to add """ self.packet.write(b) @@ -205,7 +205,7 @@ class Message (object): def add_byte(self, b): """ Write a single byte to the stream, without any formatting. - + :param str b: byte to add """ self.packet.write(b) @@ -214,7 +214,7 @@ class Message (object): def add_boolean(self, b): """ Add a boolean value to the stream. - + :param bool b: boolean value to add """ if b: @@ -222,20 +222,20 @@ class Message (object): else: self.packet.write(zero_byte) return self - + def add_int(self, n): """ Add an integer to the stream. - + :param int n: integer to add """ self.packet.write(struct.pack('>I', n)) return self - + def add_adaptive_int(self, n): """ Add an integer to the stream. - + :param int n: integer to add """ if n >= Message.big_int: @@ -258,7 +258,7 @@ class Message (object): """ Add a long int to the stream, encoded as an infinite-precision integer. This method only works on positive numbers. - + :param long z: long int to add """ self.add_string(util.deflate_long(z)) @@ -267,7 +267,7 @@ class Message (object): def add_string(self, s): """ Add a string to the stream. - + :param str s: string to add """ s = asbytes(s) @@ -280,12 +280,12 @@ class Message (object): Add a list of strings to the stream. They are encoded identically to a single string of values separated by commas. (Yes, really, that's how SSH2 does it.) - + :param list l: list of strings to add """ self.add_string(','.join(l)) return self - + def _add(self, i): if type(i) is bool: return self.add_boolean(i) @@ -303,7 +303,7 @@ class Message (object): .. warning:: Longs are encoded non-deterministically. Don't use this method. - + :param seq: the sequence of items """ for item in seq: |