Class t.w.p.j.x.XmlStream(xmlstream.XmlStream):

Part of twisted.words.protocols.jabber.xmlstream View Source View In Hierarchy

XMPP XML Stream protocol handler.
Instance VariablesversionXML stream version as a tuple (major, minor). Initially, this is set to the minimally supported version. Upon receiving the stream header of the peer, it is set to the minimum of that value and the version on the received header. (type: (int, int) )
namespacedefault namespace URI for stream (type: str )
thisHosthostname of this entity
otherHosthostname of the peer entity
sidsession identifier (type: str )
initiatingTrue if this is the initiating stream (type: bool )
featuresmap of (uri, name) to stream features element received from the receiving entity. (type: dict of (str, str) to domish.Element. )
prefixesmap of URI to prefixes that are to appear on stream header. (type: dict of str to str )
initializerslist of stream initializer objects (type: list of objects that provide IInitializer )
authenticatorassociated authenticator that uses initializers to initialize the XML stream.
Method __init__ Undocumented
Method _callLater Undocumented
Method reset Reset XML Stream.
Method onStreamError Called when a stream:error element has been received.
Method onFeatures Called when a stream:features element has been received.
Method sendHeader Send stream header.
Method sendFooter Send stream footer.
Method sendStreamError Send stream level error.
Method send Send data over the stream.
Method connectionMade Called when a connection is made.
Method onDocumentStart Called when the stream header has been received.

Inherited from XmlStream:

Method _initializeStream Sets up XML Parser.
Method dataReceived Called whenever data is received.
Method connectionLost Called when the connection is shut down.
Method onElement Called whenever a direct child element of the root element has
Method onDocumentEnd Called whenever the end tag of the root element has been received.
Method setDispatchFn Set another function to handle elements.
Method resetDispatchFn Set the default function (onElement) to handle elements.

Inherited from BaseProtocol (via XmlStream, Protocol):

Method makeConnection Make a connection to a transport and a server.

Inherited from EventDispatcher (via XmlStream):

Method _isEvent Undocumented
Method addOnetimeObserver Register a one-time observer for an event.
Method addObserver Register an observer for an event.
Method _addObserver Undocumented
Method removeObserver Remove function as observer for an event.
Method dispatch Dispatch an event.
def __init__(self, authenticator): (source)
Undocumented
def _callLater(self, *args, **kwargs): (source)
Undocumented
def reset(self): (source)

Reset XML Stream.

Resets the XML Parser for incoming data. This is to be used after successfully negotiating a new layer, e.g. TLS and SASL. Note that registered event observers will continue to be in place.
def onStreamError(self, errelem): (source)

Called when a stream:error element has been received.

Dispatches a STREAM_ERROR_EVENT event with the error element to allow for cleanup actions and drops the connection.
ParameterserrelemThe received error element. (type: domish.Element )
def onFeatures(self, features): (source)

Called when a stream:features element has been received.

Stores the received features in the features attribute, checks the need for initiating TLS and notifies the authenticator of the start of the stream.
ParametersfeaturesThe received features element. (type: domish.Element )
def sendHeader(self): (source)
Send stream header.
def sendFooter(self): (source)
Send stream footer.
def sendStreamError(self, streamError): (source)

Send stream level error.

If we are the receiving entity, and haven't sent the header yet, we sent one first.

If the given failure is a error.StreamError, it is rendered to its XML representation, otherwise a generic internal-error stream error is generated.

After sending the stream error, the stream is closed and the transport connection dropped.
def send(self, obj): (source)

Send data over the stream.

This overrides xmlstream.Xmlstream.send to use the default namespace of the stream header when serializing domish.IElements. It is assumed that if you pass an object that provides domish.IElement, it represents a direct child of the stream's root element.
def connectionMade(self): (source)

Called when a connection is made.

Notifies the authenticator when a connection has been made.
def onDocumentStart(self, rootelem): (source)

Called when the stream header has been received.

Extracts the header's id and version attributes from the root element. The id attribute is stored in our sid attribute and the version attribute is parsed and the minimum of the version we sent and the parsed version attribute is stored as a tuple (major, minor) in this class' version attribute. If no version attribute was present, we assume version 0.0.

If appropriate (we are the initiating stream and the minimum of our and the other party's version is at least 1.0), a one-time observer is registered for getting the stream features. The registered function is onFeatures.

Ultimately, the authenticator's streamStarted method will be called.
ParametersrootelemThe root element. (type: domish.Element )
API Documentation for twisted, generated by pydoctor.