paramiko.Packetizer

Package paramiko :: Class Packetizer |
[show private | hide private]
[frames | no frames]

## Type Packetizer

    object --+
             |
            Packetizer

Implementation of the base SSH packet protocol.

Method Summary
| `__init__(self, socket)`
| `__del__(self)`
| `_build_packet(self, payload)`
| `_check_keepalive(self)`
| `_log(self, level, msg)`
| `_py22_read_all(self, n)`
| `_py22_read_timeout(self, timeout)`
| `_read_timeout(self, timeout)`
| `_trigger_rekey(self)`
| `close(self)`
| `get_hexdump(self)`
| `get_mac_size_in(self)`
| `get_mac_size_out(self)`
| ``need_rekey`(self)` Returns `True` if a new set of keys needs to be negotiated.
str | ``read_all`(self, n, check_rekey)` Read as close to N bytes as possible, blocking as long as necessary.
| ``read_message`(self)` Only one thread should ever be in this function (no other locking is done).
| ``readline`(self, timeout)` Read a line from the socket.
| ``send_message`(self, data)` Write a block of data using the current cipher, as an SSH block.
| `set_hexdump(self, hexdump)`
| ``set_inbound_cipher`(self, block_engine, block_size, mac_engine, mac_size, mac_key)` Switch inbound data cipher.
| `set_inbound_compressor(self, compressor)`
| ``set_keepalive`(self, interval, callback)` Turn on/off the callback keepalive.
| ``set_log`(self, log)` Set the python log object to use for logging.
| ``set_outbound_cipher`(self, block_engine, block_size, mac_engine, mac_size, mac_key)` Switch outbound data cipher.
| `set_outbound_compressor(self, compressor)`
| `write_all(self, out)`
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
| ``__repr__`(x)` x.__repr__() <==> repr(x)
| ``__setattr__`(...)` x.__setattr__('name', value) <==> x.name = value
| ``__str__`(x)` x.__str__() <==> str(x)

Class Variable Summary
`int` | `REKEY_BYTES` = 1073741824
`int` | `REKEY_PACKETS` = 1073741824

Method Details

### need_rekey(self) Returns `True` if a new set of keys needs to be negotiated. This will be triggered during a packet read or write, so it should be checked after every read or write, or at least after every few. Returns: `True` if a new set of keys needs to be negotiated

### read_all(self, n, check_rekey=False) Read as close to N bytes as possible, blocking as long as necessary. Parameters: `n` - number of bytes to read (type=int) Returns: the data read (type=str) Raises: `EOFError` - if the socket was closed before all the bytes could be read

### read_message(self) Only one thread should ever be in this function (no other locking is done). Raises: `SSHException` - if the packet is mangled `NeedRekeyException` - if the transport should rekey

### readline(self, timeout) Read a line from the socket. This is done in a fairly inefficient way, but is only used for initial banner negotiation so it's not worth optimising.

### send_message(self, data) Write a block of data using the current cipher, as an SSH block.

### set_inbound_cipher(self, block_engine, block_size, mac_engine, mac_size, mac_key) Switch inbound data cipher.

### set_keepalive(self, interval, callback) Turn on/off the callback keepalive. If `interval` seconds pass with no data read from or written to the socket, the callback will be executed and the timer will be reset.

### set_log(self, log) Set the python log object to use for logging.

### set_outbound_cipher(self, block_engine, block_size, mac_engine, mac_size, mac_key) Switch outbound data cipher.

Class Variable Details

    ### REKEY_BYTES Type: `int` Value:
        1073741824

    ### REKEY_PACKETS Type: `int` Value:
        1073741824

Generated by Epydoc 2.1 on Sun Dec 4 11:16:46 2005 | http://epydoc.sf.net