Home | Trees | Index | Help |
|
---|
|
StanzaProcessor
--+ |StreamHandler
--+ | StreamBase
Stream
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.
Method Summary | |
---|---|
Initialize Stream object | |
__del__(self)
| |
Accept incoming connection. | |
Bind to a resource. | |
Check "to" attribute of received stream header. | |
Forcibly close the connection and clear the stream state. | |
Establish XMPP connection with given address. | |
Check if stream is connected. | |
Gracefully close the connection. | |
Handle stream XML parse error. | |
Return filedescriptor of the stream socket. | |
Generate a random and unique stream ID. | |
Do some housekeeping (cache expiration, timeout handling). | |
Simple "main loop" for the stream. | |
Single iteration of a simple "main loop" for the stream. | |
Process stream's pending events. | |
Process stream error element received. | |
Write stanza to the stream. | |
Process stanza (first level child element of the stream). | |
Process stanza (first level child element of the stream) start tag -- do nothing. | |
Called when connection state is changed. | |
Process </stream:stream> (stream end) tag received from peer. | |
Process <stream:stream> (stream start) tag received from peer. | |
Write raw data to the stream socket. | |
Inherited from StanzaProcessor | |
Modify incoming stanza before processing it. | |
Modify outgoing stanza before sending into the stream. | |
Process IQ stanza received. | |
Process message stanza. | |
Process presence stanza. | |
Process stanza received from the stream. | |
Process stanza not addressed to us. | |
Set <iq type="get"/> handler. | |
Set <iq type="set"/> handler. | |
Set a handler for <message/> stanzas. | |
Set a handler for <presence/> stanzas. | |
Set response handler for an IQ "get" or "set" stanza. | |
Remove <iq type="get"/> handler. | |
Remove <iq type="set"/> handler. |
Instance Variable Summary | |
---|---|
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. |
Method Details |
---|
__init__(self,
default_ns,
extra_ns=(),
keepalive=0)
Initialize Stream object |
accept(self, sock, myname)Accept incoming connection. [receiving entity only]
|
bind(self, resource)Bind to a resource. [initiating entity only] XMPP stream is authenticated for bare JID only. To use the full JID it must be bound to a resource.
|
check_to(self, to)Check "to" attribute of received stream header. Should be overriden in derived classes which require other logic for handling that attribute. |
close(self)Forcibly close the connection and clear the stream state. |
connect(self, addr, port, service=None, to=None)Establish XMPP connection with given address. [initiating entity only]
|
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). This method should be called periodically from the application's main loop. |
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. Should be called whenever there is input available
on |
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. This method is supposed to be overriden in derived classes or replaced by an application. It may be used to display the connection progress. |
stream_end(self, _unused)Process </stream:stream> (stream end) tag received from peer.
|
stream_start(self, doc)Process <stream:stream> (stream start) tag received from peer.
|
write_raw(self, data)Write raw data to the stream socket.
|
Instance Variable Details |
---|
featuresstream features as annouced by the initiator. |
initiatorTrue if local stream endpoint is the initiating entity. |
lockRLock object used to synchronize access to Stream object. |
melocal stream endpoint JID. |
peerremote stream endpoint JID. |
process_all_stanzaswhenTrue then all stanzas received are
considered local. |
Home | Trees | Index | Help |
|
---|
Generated by Epydoc 2.1 on Mon Dec 26 17:57:35 2005 | http://epydoc.sf.net |