pyxmpp.jabberd.componentstream.ComponentStream

Package pyxmpp :: Package jabberd :: Module componentstream :: Class ComponentStream |
[show private | hide private]
[frames | no frames]

## Class ComponentStream

    StanzaProcessor --+
                      |
      StreamHandler --+
                      |
             StreamBase --+
                          |
    PasswordManager --+   |
                      |   |
        StreamSASLMixIn --+
                          |
         StreamTLSMixIn --+
                          |
                     Stream --+
                              |
                             ComponentStream

Handles jabberd component (jabber:component:accept) connection stream.

Method Summary
| ``__init__`(self, jid, secret, server, port, keepalive)` Initialize a `ComponentStream` object.
| ``accept`(self, sock)` Accept an incoming component connection.
| ``connect`(self, server, port)` Establish a client connection to a server.
| ``stream_start`(self, doc)` Process <stream:stream> (stream start) tag received from peer.
Inherited from StreamTLSMixIn
| ``get_tls_connection`(self)` Get the TLS connection object for the stream.
Inherited from PasswordManager
`bool` | ``check_authzid`(self, authzid, extra_info)` Check if the authenticated entity is allowed to use given authorization id.
`bool` | ``check_password`(self, username, password, realm)` Check the password validity.
`unicode` | ``choose_realm`(self, realm_list)` Choose an authentication realm from the list provided by the server.
`str` | ``generate_nonce`(self)` Generate a random string for digest authentication challenges.
`unicode`,`str` tuple. | ``get_password`(self, username, realm, acceptable_formats)` Get the password for user authentication.
`list` of `unicode` | ``get_realms`(self)` Get available realms list.
| ``get_serv_host`(self)` Return the host name for DIGEST-MD5 'digest-uri' field.
| ``get_serv_name`(self)` Return the service name for DIGEST-MD5 'digest-uri' field.
| ``get_serv_type`(self)` Return the service type for DIGEST-MD5 'digest-uri' field.
Inherited from StreamBase
| ``__del__`(self)`
| ``bind`(self, resource)` Bind to a resource.
| ``check_to`(self, to)` Check "to" attribute of received stream header.
| ``close`(self)` Forcibly close the connection and clear the stream state.
| ``connected`(self)` Check if stream is connected.
| ``disconnect`(self)` Gracefully close the connection.
| ``error`(self, descr)` Handle stream XML parse error.
| ``fileno`(self)` Return filedescriptor of the stream socket.
| ``generate_id`(self)` Generate a random and unique stream ID.
| ``idle`(self)` Do some housekeeping (cache expiration, timeout handling).
| ``loop`(self, timeout)` Simple "main loop" for the stream.
| ``loop_iter`(self, timeout)` Single iteration of a simple "main loop" for the stream.
| ``process`(self)` Process stream's pending events.
| ``process_stream_error`(self, err)` Process stream error element received.
| ``send`(self, stanza)` Write stanza to the stream.
| ``stanza`(self, _unused, node)` Process stanza (first level child element of the stream).
| ``stanza_start`(self, doc, node)` Process stanza (first level child element of the stream) start tag -- do nothing.
| ``state_change`(self, state, arg)` Called when connection state is changed.
| ``stream_end`(self, _unused)` Process </stream:stream> (stream end) tag received from peer.
| ``write_raw`(self, data)` Write raw data to the stream socket.
Inherited from StanzaProcessor
| ``fix_in_stanza`(self, stanza)` Modify incoming stanza before processing it.
| ``fix_out_stanza`(self, stanza)` Modify outgoing stanza before sending into the stream.
| ``process_iq`(self, stanza)` Process IQ stanza received.
| ``process_message`(self, stanza)` Process message stanza.
| ``process_presence`(self, stanza)` Process presence stanza.
| ``process_stanza`(self, stanza)` Process stanza received from the stream.
| ``route_stanza`(self, stanza)` Process stanza not addressed to us.
| ``set_iq_get_handler`(self, element, namespace, handler)` Set <iq type="get"/> handler.
| ``set_iq_set_handler`(self, element, namespace, handler)` Set <iq type="set"/> handler.
| ``set_message_handler`(self, typ, handler, namespace, priority)` Set a handler for <message/> stanzas.
| ``set_presence_handler`(self, typ, handler, namespace, priority)` Set a handler for <presence/> stanzas.
| ``set_response_handlers`(self, iq, res_handler, err_handler, timeout_handler, timeout)` Set response handler for an IQ "get" or "set" stanza.
| ``unset_iq_get_handler`(self, element, namespace)` Remove <iq type="get"/> handler.
| ``unset_iq_set_handler`(self, element, namespace)` Remove <iq type="set"/> handler.

Instance Variable Summary
`int` | `port`: port number to use.
`unicode` | `secret`: authentication secret.
`unicode` | `server`: server to use.
Inherited from Stream
| `features`: stream features as annouced by the initiator.
| `initiator`: `True` if local stream endpoint is the initiating entity.
| `lock`: RLock object used to synchronize access to Stream object.
| `me`: local stream endpoint JID.
| `peer`: remote stream endpoint JID.
| `process_all_stanzas`: when `True` then all stanzas received are considered local.
| `tls`: TLS connection object.

Method Details

### __init__(self, jid, secret, server, port, keepalive=0) (Constructor) Initialize a `ComponentStream` object. Parameters: `jid` - JID of the component. `secret` - authentication secret. `server` - server address. `port` - TCP port number on the server. `keepalive` - keepalive interval. 0 to disable. Overrides: `pyxmpp.stream.Stream.__init__`

### accept(self, sock) Accept an incoming component connection. [server only] Parameters: `sock` - a listening socket. Overrides: `pyxmpp.streambase.StreamBase.accept`

### connect(self, server=None, port=None) Establish a client connection to a server. [component only] Parameters: `server` - name or address of the server to use. If not given then use the one specified when creating the object. (type=`unicode`) `port` - port number of the server to use. If not given then use the one specified when creating the object. (type=`int`) Overrides: `pyxmpp.streambase.StreamBase.connect`

### stream_start(self, doc) Process <stream:stream> (stream start) tag received from peer. Call `Stream.stream_start`, but ignore any `HostMismatch` error. Parameters: `doc` - document created by the parser Overrides: `pyxmpp.streambase.StreamBase.stream_start`

Instance Variable Details

### port port number to use. Type: `int`

### secret authentication secret. Type: `unicode`

### server server to use. Type: `unicode`