Base class for a generic XMPP stream.
Responsible for establishing connection, parsing the stream, dispatching
received stanzas to apopriate handlers and sending application's stanzas.
This doesn't provide any authentication or encryption (both required by
the XMPP specification) and is not usable on its own.
Whenever we say "stream" here we actually mean two streams
(incoming and outgoing) of one connections, as defined by the XMPP
specification.
|
__init__(self,
stanza_namespace,
handlers,
settings=None)
Initialize StreamBase object |
|
|
|
|
|
|
|
|
|
|
|
disconnect(self)
Gracefully close the connection. |
|
|
|
event(self,
event)
Handle a stream event. |
|
|
|
|
|
close(self)
Forcibly close the connection and clear the stream state. |
|
|
|
stream_start(self,
element)
Process <stream:stream> (stream start) tag received from peer. |
|
|
|
stream_end(self)
Process </stream:stream> (stream end) tag received from peer. |
|
|
|
|
|
stream_element(self,
element)
Process first level child element of the stream). |
|
|
|
|
|
_send_stream_start(self,
stream_id=None,
stream_to=None)
Send stream start tag. |
|
|
|
|
|
|
|
_restart_stream(self)
Restart the stream as needed after SASL and StartTLS negotiation. |
|
|
ElementTree.Element
|
|
|
|
|
|
|
|
|
send(self,
stanza)
Write stanza to the stream. |
|
|
|
_send(self,
stanza)
Same as send but assume lock is acquired. |
|
|
int
|
regular_tasks(self)
Do some housekeeping (cache expiration, timeout handling). |
|
|
|
|
|
|
|
check_to(self,
to)
Check "to" attribute of received stream header. |
|
|
|
generate_id(self)
Generate a random and unique stream ID. |
|
|
|
_got_features(self,
features)
Process incoming <stream:features/> element. |
|
|
|
is_connected(self)
Check if stream is is_connected and stanzas may be sent. |
|
|
|
|
|
|
Inherited from stanzaprocessor.StanzaProcessor :
fix_in_stanza ,
fix_out_stanza ,
process_iq ,
process_message ,
process_presence ,
process_stanza ,
route_stanza ,
set_response_handlers ,
setup_stanza_handlers
Inherited from object :
__delattr__ ,
__format__ ,
__getattribute__ ,
__hash__ ,
__new__ ,
__reduce__ ,
__reduce_ex__ ,
__repr__ ,
__setattr__ ,
__sizeof__ ,
__str__ ,
__subclasshook__
|
dict
|
_element_handlers
mapping from stream element names to lists of
methods handling them
|
unicode
|
_input_state
None , "open" (<stream:stream> has been received)
"restart" or "closed" (</stream:stream> or EOF has been received)
|
unicode
|
_output_state
None , "open" (<stream:stream> has been received)
"restart" or "closed" (</stream:stream> or EOF has been received)
|
unicode
|
_stanza_namespace_p
qname prefix of the stanza namespace
|
list of StreamFeatureHandler
|
_stream_feature_handlers
stream features handlers
|
bool
|
authenticated
True if local entity has authenticated to peer
|
ElementTree.Element
|
features
stream features as annouced by the receiver.
|
list
|
handlers
handlers for stream elements and stanza payload
|
bool
|
initiator
True if local stream endpoint is the initiating entity.
|
threading.RLock
|
lock
lock object used to synchronize access to the
StanzaProcessor object.
|
JID
|
me
local JID.
|
JID
|
peer
remote stream endpoint JID.
|
bool
|
peer_authenticated
True if the peer has authenticated to us
|
unicode
|
peer_language
language of human-readable stream content selected
by the peer
|
bool
|
process_all_stanzas
when True then all stanzas received are
considered local.
|
XMPPSettings
|
settings
stream settings
|
unicode
|
stanza_namespace
default namespace of the stream
|
bool
|
tls_established
True when the stream is protected by TLS
|
transport.XMPPTransport
|
transport
transport used by this stream
|
(int , int ) tuple
|
version
Negotiated version of the XMPP protocol.
|