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

Type SubsystemHandler

object --+        
         |        
  _Verbose --+    
             |    
        Thread --+
                 |
                SubsystemHandler

Known Subclasses:
SFTPServer

Handler for a subsytem in server mode. If you create a subclass of this class and pass it to Transport.set_subsystem_handler, an object of this class will be created for each request for this subsystem. Each new object will be executed within its own new thread by calling start_subsystem. When that method completes, the channel is closed.

For example, if you made a subclass MP3Handler and registered it as the handler for subsystem "mp3", then whenever a client has successfully authenticated and requests subsytem "mp3", an object of class MP3Handler will be created, and start_subsystem will be called on it from a new thread.

Since: ivysaur

Method Summary
  __init__(self, channel, name, server)
Create a new handler for a channel.
  finish_subsystem(self)
Perform any cleanup at the end of a subsystem.
ServerInterface get_server(self)
Return the ServerInterface object associated with this channel and subsystem.
  start_subsystem(self, name, transport, channel)
Process an ssh subsystem in server mode.
  _run(self)
    Inherited from Thread
  __repr__(self)
  getName(self)
  isAlive(self)
  isDaemon(self)
  join(self, timeout)
  run(self)
  setDaemon(self, daemonic)
  setName(self, name)
  start(self)
  _set_daemon(self)
    Inherited from _Verbose
  _note(self, format, *args)
    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
  __str__(x)
x.__str__() <==> str(x)

Class Variable Summary
    Inherited from Thread
bool _Thread__initialized = False

Method Details

__init__(self, channel, name, server)
(Constructor)

Create a new handler for a channel. This is used by ServerInterface to start up a new handler when a channel requests this subsystem. You don't need to override this method, but if you do, be sure to pass the channel and name parameters through to the original __init__ method here.
Parameters:
channel - the channel associated with this subsystem request.
           (type=Channel)
name - name of the requested subsystem.
           (type=str)
server - the server object for the session that started this subsystem
           (type=ServerInterface)
Overrides:
threading.Thread.__init__

finish_subsystem(self)

Perform any cleanup at the end of a subsystem. The default implementation just closes the channel.

Since: 1.1

get_server(self)

Return the ServerInterface object associated with this channel and subsystem.
Returns:
ServerInterface

start_subsystem(self, name, transport, channel)

Process an ssh subsystem in server mode. This method is called on a new object (and in a new thread) for each subsystem request. It is assumed that all subsystem logic will take place here, and when the subsystem is finished, this method will return. After this method returns, the channel is closed.

The combination of transport and channel are unique; this handler corresponds to exactly one Channel on one Transport.
Parameters:
name - name of the requested subsystem.
           (type=str)
transport - the server-mode Transport.
           (type=Transport)
channel - the channel associated with this subsystem request.
           (type=Channel)

Note: It is the responsibility of this method to exit if the underlying Transport is closed. This can be done by checking Transport.is_active or noticing an EOF on the Channel. If this method loops forever without checking for this case, your python interpreter may refuse to exit because this thread will still be running.


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