pyxmpp.stream.Stream

Package pyxmpp :: Module stream :: Class Stream |
[hide private]

# Class Stream

source code

               streamtls.StreamTLSMixIn --+
                                          |
          sasl.core.PasswordManager --+   |
                                      |   |
             streamsasl.StreamSASLMixIn --+
                                          |
    stanzaprocessor.StanzaProcessor --+   |
                                      |   |
             xmlextra.StreamHandler --+   |
                                      |   |
                  streambase.StreamBase --+
                                          |
                                         Stream

Known Subclasses:
  - clientstream.ClientStream
  - , jabberd.componentstream.ComponentStream

Generic XMPP stream class.

Responsible for establishing connection, parsing the stream, StartTLS encryption and SASL authentication negotiation and usage, dispatching received stanzas to apopriate handlers and sending application's stanzas.

Whenever we say "stream" here we actually mean two streams (incoming and outgoing) of one connections, as defined by the XMPP specification.

Instance Methods | [hide private]
__init__(self, default_ns, extra_ns=`(``)`, sasl_mechanisms=`(``)`, tls_settings=None, keepalive=0, owner=None) Initialize Stream object | source code
_got_features(self) Process incoming <stream:features/> element. | source code
_make_stream_features(self) Create the <features/> element for the stream. | source code
_process_node(self, xmlnode) Process first level element of the stream. | source code
_reset(self) Reset Stream object state making it ready to handle new connections. | source code
Inherited from `streamtls.StreamTLSMixIn`: `get_tls_connection`, `tls_is_certificate_valid` Inherited from `streamtls.StreamTLSMixIn` (private): `_handle_tls_features`, `_make_stream_tls_features`, `_make_tls_connection`, `_process`, `_process_node_tls`, `_process_tls_node`, `_read`, `_read_tls`, `_request_tls`, `_reset_tls`, `_write_raw` Inherited from `streamsasl.StreamSASLMixIn` (private): `_handle_sasl_features`, `_make_stream_sasl_features`, `_process_node_sasl`, `_process_sasl_abort`, `_process_sasl_auth`, `_process_sasl_challenge`, `_process_sasl_failure`, `_process_sasl_node`, `_process_sasl_response`, `_process_sasl_success`, `_reset_sasl`, `_sasl_authenticate` Inherited from `sasl.core.PasswordManager`: `check_authzid`, `check_password`, `choose_realm`, `generate_nonce`, `get_password`, `get_realms`, `get_serv_host`, `get_serv_name`, `get_serv_type` Inherited from `streambase.StreamBase`: `__del__`, `accept`, `bind`, `check_to`, `close`, `connect`, `connected`, `disconnect`, `error`, `fileno`, `generate_id`, `idle`, `loop`, `loop_iter`, `process`, `process_stream_error`, `send`, `stanza`, `stanza_start`, `state_change`, `stream_end`, `stream_start`, `write_raw` Inherited from `streambase.StreamBase` (private): `_accept`, `_bind_error`, `_bind_success`, `_close`, `_connect`, `_connect_socket`, `_disconnect`, `_feed_reader`, `_idle`, `_loop_iter`, `_make_reader`, `_post_auth`, `_post_connect`, `_process_stream_node`, `_restart_stream`, `_send`, `_send_stream_end`, `_send_stream_error`, `_send_stream_features`, `_send_stream_start`, `_write_node` Inherited from `stanzaprocessor.StanzaProcessor`: `fix_in_stanza`, `fix_out_stanza`, `process_iq`, `process_message`, `process_presence`, `process_response`, `process_stanza`, `route_stanza`, `set_iq_get_handler`, `set_iq_set_handler`, `set_message_handler`, `set_presence_handler`, `set_response_handlers`, `unset_iq_get_handler`, `unset_iq_set_handler` Inherited from `stanzaprocessor.StanzaProcessor` (private): `_set_response_handlers` Inherited from `xmlextra.StreamHandler`: `warning` Inherited from `xmlextra.StreamHandler` (private): `_stanza`, `_stream_end`, `_stream_start`

Instance Variables | [hide private]
| _reader : the stream reader object (push parser) for the stream.
| features : stream features as annouced by the initiator.
| initiator : `True` if local stream endpoint is the initiating entity.
| lock : lock object used to synchronize access to the StanzaProcessor object.
| me : local JID.
| peer : remote stream endpoint JID.
| process_all_stanzas : when `True` then all stanzas received are considered local.
| tls : TLS connection object.
Inherited from `streambase.StreamBase`: `owner`

Method Details | [hide private]

### __init__(self, default_ns, extra_ns=`(``)`, sasl_mechanisms=`(``)`, tls_settings=None, keepalive=0, owner=None) (Constructor) | source code
Initialize Stream object Parameters: `default_ns` - : stream's default namespace ("jabber:client" for client, "jabber:server" for server, etc.) `extra_ns` - : sequence of extra namespace URIs to be defined for the stream. `sasl_mechanisms` - : sequence of SASL mechanisms allowed for authentication. Currently "PLAIN", "DIGEST-MD5" and "GSSAPI" are supported. `tls_settings` - : settings for StartTLS -- TLSSettings instance. `keepalive` - : keepalive output interval. 0 to disable. `owner` - : Client, Component or similar object "owning" this stream. Overrides: xmlextra.StreamHandler.__init__

### _got_features(self) | source code
Process incoming <stream:features/> element. [initiating entity only] The received features node is available in self.features. Overrides: streambase.StreamBase._got_features

### _make_stream_features(self) | source code
Create the <features/> element for the stream. [receving entity only] Returns: new <features/> element node. Overrides: streambase.StreamBase._make_stream_features

### _process_node(self, xmlnode) | source code
Process first level element of the stream. The element may be stream error or features, StartTLS request/response, SASL request/response or a stanza. Parameters: `xmlnode` - : XML node describing the element Overrides: streambase.StreamBase._process_node

### _reset(self) | source code
Reset Stream object state making it ready to handle new connections. Overrides: streambase.StreamBase._reset