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:

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 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 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 xmlextra.StreamHandler: warning

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