Package twisted :: Package conch :: Package ssh :: Module factory :: Class SSHFactory

[show private | hide private]
[frames | no frames]

## Class SSHFactory

    Factory --+
              |
             SSHFactory

Known Subclasses:
  `OpenSSHFactory`

Method Summary
| ``buildProtocol`(self, addr)` Create an instance of a subclass of Protocol.
| ``doStart`(self)` Make sure startFactory is called. (inherited from `Factory`)
| ``doStop`(self)` Make sure stopFactory is called. (inherited from `Factory`)
`tuple` | ``getDHPrime`(self, bits)` Return a tuple of (g, p) for a Diffe-Hellman process, with p being as close to bits bits as possible.
`dict` | ``getPrimes`(self)` Called when the factory is started to get Diffie-Hellman generators and primes to use.
`dict` | ``getPrivateKeys`(self)` Called when the factory is started to get the private portions of the servers host keys.
`dict` | ``getPublicKeys`(self)` Called when the factory is started to get the public portions of the servers host keys.
subclass of {service.SSHService} | ``getService`(self, transport, service)` Return a class to use as a service for the given transport.
| ``startFactory`(self)` This will be called before I begin listening on a Port or Connector.
| ``stopFactory`(self)` This will be called before I stop listening on all Ports/Connectors. (inherited from `Factory`)

Class Variable Summary
`dictionary` | `services`

Method Details

### buildProtocol(self, addr)

Create an instance of a subclass of Protocol.

The returned instance will handle input on an incoming server connection, and an attribute "factory" pointing to the creating factory.

Override this method to alter how Protocol instances get created.

  Overrides:
    `twisted.internet.protocol.Factory.buildProtocol` (inherited documentation)

### getDHPrime(self, bits)

Return a tuple of (g, p) for a Diffe-Hellman process, with p being as close to bits bits as possible.

  Parameters:
    `bits`
    (type=`int`)
  Returns:
    `tuple`

### getPrimes(self)

Called when the factory is started to get Diffie-Hellman generators and primes to use. Returns a dictionary mapping number of bits to lists of tuple of (generator, prime).

  Returns:
    `dict`

### getPrivateKeys(self)

Called when the factory is started to get the private portions of the servers host keys. Returns a dictionary mapping SSH key types to `Crypto.PublicKey.pubkey.pubkey` objects.

  Returns:
    `dict`

### getPublicKeys(self)

Called when the factory is started to get the public portions of the servers host keys. Returns a dictionary mapping SSH key types to public key strings.

  Returns:
    `dict`

### getService(self, transport, service)

Return a class to use as a service for the given transport.

  Parameters:
    `transport`
    (type=`transport.SSHServerTransport`)
    `service`
    (type=`stR`)
  Returns:
    subclass of {service.SSHService}

### startFactory(self)

This will be called before I begin listening on a Port or Connector.

It will only be called once, even if the factory is connected to multiple ports.

This can be used to perform 'unserialization' tasks that are best put off until things are actually running, such as connecting to a database, opening files, etcetera.

  Overrides:
    `twisted.internet.protocol.Factory.startFactory` (inherited documentation)

Class Variable Details

### services

  Type:
    `dictionary`
  Value:

        {'ssh-connection': <class twisted.conch.ssh.connection.SSHConnection a\
        t 0x8359f74>,
         'ssh-userauth': <class twisted.conch.ssh.userauth.SSHUserAuthServer a\
        t 0x8487484>}

Generated by Epydoc 1.1 on Sat Feb 15 21:17:48 2003 | http://epydoc.sf.net