# `nonza` — Non-stanza stream-level XSOs (Nonzas)

This module contains XSO models for stream-level elements which are not stanzas. Since XEP-0360, these are called “nonzas”.

Changed in version 0.5: Before version 0.5, this module was called `aioxmpp.stream_xsos`.

## General XSOs

class aioxmpp.nonza.StreamError

  XSO representing a stream error.

  text

    The text content of the stream error.

  condition

    The RFC 6120 stream error condition.

class aioxmpp.nonza.StreamFeatures

  XSO for collecting the supported stream features the remote advertises.

  To register a stream feature, use `register_child()` with the `features` descriptor. A more fancy way to do the same thing is to use the `as_feature_class()` classmethod as decorator for your feature XSO class.

  Adding new feature classes:

  classmethod as_feature_class(other_cls)

  Querying features:

  stream_features[FeatureClass]

    Obtain the first feature XSO which matches the FeatureClass. If no such XSO is contained in the `StreamFeatures` instance stream_features, `KeyError` is raised.

  stream_features[FeatureClass] = feature

    Replace the stream features belonging to the given FeatureClass with the feature XSO.

    If the FeatureClass does not match the type of the feature XSO, a `TypeError` is raised.

    It is legal to leave the FeatureClass out by specifying `...` instead. In that case, the class is auto-detected from the feature object assigned.

  del stream_features[FeatureClass]

    If any feature of the given FeatureClass type is in the stream_features, they are all removed.

    Otherwise, `KeyError` is raised, to stay consistent with other mapping-like types.

  get_feature(feature_cls, default=None)

    If a feature of the given feature_cls type is contained in the current stream features set, the first such instance is returned.

    Otherwise, default is returned.

  has_feature(feature_cls)

    Return `True` if the stream features contain a feature of the given feature_cls type. `False` is returned otherwise.

## StartTLS related XSOs

class aioxmpp.nonza.StartTLSXSO

  Base class for starttls related XSOs.

  This base class merely defines the namespaces to declare when serialising the derived XSOs

class aioxmpp.nonza.StartTLSFeature

  Start TLS capability stream feature

class aioxmpp.nonza.StartTLS

  XSO indicating that the client wants to start TLS now.

class aioxmpp.nonza.StartTLSProceed

  Server allows start TLS.

class aioxmpp.nonza.StartTLSFailure

  Server refusing to start TLS.

## SASL related XSOs

class aioxmpp.nonza.SASLXSO(*args, **kwargs)

class aioxmpp.nonza.SASLAuth(*args, **kwargs)

  Start SASL authentication.

  mechanism

    The mechanism to authenticate with.

  payload

    For mechanisms which use an initial client-supplied payload, this can be a string. It is automatically encoded as base64 according to the XMPP SASL specification.

class aioxmpp.nonza.SASLChallenge(*args, **kwargs)

  A SASL challenge.

  payload

    The (decoded) SASL payload as `bytes`. Base64 en/decoding is handled by the XSO stack.

class aioxmpp.nonza.SASLResponse(*args, **kwargs)

  A SASL response.

  payload

    The (decoded) SASL payload as `bytes`. Base64 en/decoding is handled by the XSO stack.

class aioxmpp.nonza.SASLFailure(*args, **kwargs)

  Indication of SASL failure.

  condition

    The condition which caused the authentication to fail.

  text

    Optional human-readable text.

class aioxmpp.nonza.SASLSuccess(*args, **kwargs)

  Indication of SASL success, with optional final payload supplied by the server.

  payload

    The (decoded) SASL payload. Base64 en/decoding is handled by the XSO stack.

class aioxmpp.nonza.SASLAbort(*args, **kwargs)

  Request to abort the SASL authentication.

## Stream management related XSOs

class aioxmpp.nonza.SMXSO

  Base class for stream-management related XSOs.

  This base class merely defines the namespaces to declare when serializing the data.

class aioxmpp.nonza.SMRequest

  A request for an SM acknowledgement (see `SMAcknowledgement`).

class aioxmpp.nonza.SMAcknowledgement

  Response to a `SMRequest`.

  counter

    The counter as received by the remote side.

class aioxmpp.nonza.SMEnable

  Request to enable stream management.

  resume

    Set this to `True` to request the capability of resuming the stream later.

  max_

    Maximum time, as integer in seconds, for which the stream should be resumable after the connection dropped. Only relevant if `resume` is true and may be overridden by the server.

    New in version 0.9.

class aioxmpp.nonza.SMEnabled

  Response to a `SMEnable` request.

  resume

    If `True`, the peer allows resumption of the stream.

  id_

    The SM-ID of the stream. This is required to resume later.

  location

    A hostname-port pair which defines to which host the client shall connect to resume the stream.

  max_

    Maximum time, as integer in seconds, for which the stream will be resumable after the connection dropped. Only relevant if `resume` is true.

class aioxmpp.nonza.SMResume

  Request resumption of a previously interrupted SM stream.

  counter

    Set this to the value of the local incoming stanza counter.

  previd

    Set this to the SM-ID, as received in `SMEnabled`.

class aioxmpp.nonza.SMResumed

  Notification that SM resumption was successful, in response to `SMResume`.

  counter

    The stanza counter of the remote side.

  previd

    The SM-ID of the stream.