Home | Trees | Index | Help |
---|
Package xmpp :: Module session :: Class Session |
|
Method Summary | |
---|---|
When the session is created it's type (client/server) is determined from the beginning. | |
Takes Protocol instance as argument. | |
Declare some stream feature as activated one. | |
Put the "immidiatedly send" queue content on the wire. | |
If stream is authenticated than move items from "send" queue to "immidiatedly send" queue. | |
Reads all pending incoming data. | |
Put chunk into "immidiatedly send" queue. | |
Change the session state. | |
Change the underlaying socket state. | |
Change the underlaying XML stream state Stream starts with STREAM__NOT_OPENED and then proceeds with STREAM__OPENED, STREAM__CLOSING and STREAM__CLOSED states. | |
Declare some feature as "negotiating now" to prevent other features from start negotiating. | |
This method is used to initialise the internal xml expat parser and to send initial stream header (in case of client connection). | |
Declare some feature as "negotiated" to allow other features start negotiating. | |
Notify the peer about stream closure. | |
Declare some feature as illegal. |
Method Details |
---|
__init__(self,
socket,
owner,
xmlns=None,
peer=None)
When the session is created it's type (client/server) is determined
from the beginning. socket argument is the pre-created socket-like
object. It must have the following methods: send, recv, fileno, close.
owner is the 'master' instance that have Dispatcher plugged into it and
generally will take care about all session events. xmlns is the stream
namespace that will be used. Client must set this argument If server
sets this argument than stream will be dropped if opened with some
another namespace. peer is the name of peer instance. This is the flag
that differentiates client session from server session. Client must set
it to the name of the server that will be connected, server must leave
this argument alone.
|
enqueue(self, stanza)Takes Protocol instance as argument. Puts stanza into "send" fifo queue. Items into the send queue are hold until stream authenticated. After that this method is effectively the same as "sendnow" method. |
feature(self, feature)Declare some stream feature as activated one. |
flush_queue(self)Put the "immidiatedly send" queue content on the wire. Blocks until at least one byte sent. |
push_queue(self, failreason='urn:ietf:params:xml:ns:xmpp-stanzas recipient-unavailable')If stream is authenticated than move items from "send" queue to "immidiatedly send" queue. Else if the stream is failed then return all queued stanzas with error passed as argument. Otherwise do nothing. |
receive(self)Reads all pending incoming data. Raises IOError on disconnection. Blocks until at least one byte is read. |
sendnow(self, chunk)Put chunk into "immidiatedly send" queue. Should only be used for auth/TLS stuff and like. If you just want to shedule regular stanza for delivery use enqueue method. |
set_session_state(self, newstate)Change the session state. Session starts with SESSION_NOT_AUTHED state and then comes through SESSION_AUTHED, SESSION_BOUND, SESSION_OPENED and SESSION_CLOSED states. |
set_socket_state(self, newstate)Change the underlaying socket state. Socket starts with SOCKET_UNCONNECTED state and then proceeds (possibly) to SOCKET_ALIVE and then to SOCKET_DEAD |
set_stream_state(self, newstate)Change the underlaying XML stream state Stream starts with STREAM__NOT_OPENED and then proceeds with STREAM__OPENED, STREAM__CLOSING and STREAM__CLOSED states. Note that some features (like TLS and SASL) requires stream re-start so this state can have non-linear changes. |
start_feature(self, f)Declare some feature as "negotiating now" to prevent other features from start negotiating. |
StartStream(self)This method is used to initialise the internal xml expat parser and to send initial stream header (in case of client connection). Should be used after initial connection and after every stream restart. |
stop_feature(self, f)Declare some feature as "negotiated" to allow other features start negotiating. |
terminate_stream(self, error=None, unregister=1)Notify the peer about stream closure. Ensure that xmlstream is not brokes - i.e. if the stream isn't opened yet - open it before closure. If the error condition is specified than create a stream error and send it along with closing stream tag. Emulate receiving 'unavailable' type presence just before stream closure. |
unfeature(self, feature)Declare some feature as illegal. Illegal features can not be used. Example: BIND feature becomes illegal after Non-SASL auth. |
Home | Trees | Index | Help |
---|
Generated by Epydoc 2.1 on Mon Mar 6 14:11:54 2006 | http://epydoc.sf.net |