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. | |
Same as Stream.accept but assume self.lock is acquired. | |
Handle resource binding success. | |
Handle resource binding success. | |
Same as Stream.close but assume self.lock is acquired. | |
Same as Stream.connect but assume self.lock is acquired. | |
Initialize stream on outgoing connection. | |
Same as Stream.disconnect but assume self.lock is acquired. | |
Feed the stream reader with data received. | |
Process incoming <stream:features/> element. | |
Same as Stream.idle but assume self.lock is acquired. | |
Same as Stream.loop_iter but assume self.lock is acquired. | |
Create ne xmlextra.StreamReader instace as self._reader . | |
Create the <features/> element for the stream. | |
Called when connection is authenticated. | |
Called when connection is established. | |
Same as Stream.process but assume self.lock is acquired. | |
Process first level element of the stream. | |
Process first level stream-namespaced element of the stream. | |
Read data pending on the stream socket and pass it to the parser. | |
Reset Stream object state making it ready to handle new
connections. | |
Restart the stream as needed after SASL and StartTLS negotiation. | |
Same as Stream.send but assume self.lock is acquired. | |
Send stream end tag. | |
Send stream error element. | |
Send stream <features/>. | |
Send stream start tag. | |
Write XML xmlnode to the stream. | |
Same as Stream.write_raw but assume self.lock is acquired. | |
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. | |
Same as Stream.set_response_handlers but assume self.lock is acquired. | |
Inherited from StreamHandler | |
Process complete stanza. | |
Process stream end. | |
Process stream start. |
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. | |
_reader : the stream reader object (push parser) for the stream. |
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.
|
_accept(self, sock, myname)Same asStream.accept but assume self.lock is acquired. |
_bind_error(self, stanza)Handle resource binding success. [initiating entity only]
|
_bind_success(self, stanza)Handle resource binding success. [initiating entity only] Set
|
_close(self)Same asStream.close but assume self.lock is acquired. |
_connect(self, addr, port, service=None, to=None)Same asStream.connect but assume self.lock is acquired. |
_connect_socket(self, sock, to=None)Initialize stream on outgoing connection.
|
_disconnect(self)Same asStream.disconnect but assume self.lock is acquired. |
_feed_reader(self, data)Feed the stream reader with data received. If
|
_got_features(self)Process incoming <stream:features/> element. [initiating entity only] The received features node is available in |
_idle(self)Same asStream.idle but assume self.lock is acquired. |
_loop_iter(self, timeout)Same asStream.loop_iter but assume self.lock is acquired. |
_make_reader(self)Create nexmlextra.StreamReader instace as self._reader . |
_make_stream_features(self)Create the <features/> element for the stream. [receving entity only]
|
_post_auth(self)Called when connection is authenticated. This method is supposed to be overriden in derived classes. |
_post_connect(self)Called when connection is established. This method is supposed to be overriden in derived classes. |
_process(self)Same asStream.process but assume self.lock is acquired. |
_process_node(self, xmlnode)Process first level element of the stream. The element may be stream error or features, StartTLS request/response, SASL request/response or a stanza.
|
_process_stream_node(self, xmlnode)Process first level stream-namespaced element of the stream. The element may be stream error or stream features.
|
_read(self)Read data pending on the stream socket and pass it to the parser. |
_reset(self)ResetStream object state making it ready to handle new
connections. |
_restart_stream(self)Restart the stream as needed after SASL and StartTLS negotiation. |
_send(self, stanza)Same asStream.send but assume self.lock is acquired. |
_send_stream_end(self)Send stream end tag. |
_send_stream_error(self, condition)Send stream error element.
|
_send_stream_features(self)Send stream <features/>. [receiving entity only] |
_send_stream_start(self, sid=None)Send stream start tag. |
_write_node(self, xmlnode)Write XMLxmlnode to the stream.
|
_write_raw(self, data)Same asStream.write_raw but assume self.lock is acquired. |
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. |
_readerthe stream reader object (push parser) for the stream. |
Home | Trees | Index | Help |
|
---|
Generated by Epydoc 2.1 on Mon Dec 26 17:57:35 2005 | http://epydoc.sf.net |