Package pyxmpp :: Package jabber :: Module clientstream :: Class LegacyClientStream
[show private | hide private]
[frames | no frames]

Class LegacyClientStream

StanzaProcessor --+            
                  |            
  StreamHandler --+            
                  |            
         StreamBase --+        
                      |        
PasswordManager --+   |        
                  |   |        
    StreamSASLMixIn --+        
                      |        
     StreamTLSMixIn --+        
                      |        
                 Stream --+    
                          |    
               ClientStream --+
                              |
                             LegacyClientStream


Handles Jabber (both XMPP and legacy protocol) client connection stream.

Both client and server side of the connection is supported. This class handles
client SASL and legacy authentication, authorisation and XMPP resource binding.

Method Summary
  __init__(self, jid, password, server, port, auth_methods, tls_settings, keepalive)
Initialize a LegacyClientStream object.
  auth_error(self, stanza)
Handle legacy authentication error.
  auth_finish(self, _unused)
Handle success of the legacy authentication.
  auth_in_stage1(self, stanza)
Handle the first stage (<iq type='get'/>) of legacy ("plain" or "digest") authentication.
  auth_in_stage2(self, stanza)
Handle the second stage (<iq type='set'/>) of legacy ("plain" or "digest") authentication.
  auth_stage2(self, stanza)
Handle the first stage authentication response (result of the <iq type="get"/>).
  auth_timeout(self)
Handle legacy authentication timeout.
  registration_error(self, stanza)
Handle in-band registration error.
  registration_form_received(self, stanza)
Handle registration form received.
  registration_success(self, stanza)
Handle registration success.
  submit_registration_form(self, form)
Submit a registration form.
    Inherited from ClientStream
  accept(self, sock)
Accept an incoming client connection.
  check_authzid(self, authzid, extra_info)
Check authorization id provided by the client.
  choose_realm(self, realm_list)
Choose authentication realm from the list provided by the server.
  connect(self, server, port)
Establish a client connection to a server.
  do_bind(self, stanza)
Do the resource binding requested by a client connected.
  fix_in_stanza(self, stanza)
Fix an incoming stanza.
  fix_out_stanza(self, stanza)
Fix outgoing stanza.
  get_password(self, username, realm, acceptable_formats)
Get a user password for the SASL authentication.
  get_realms(self)
Get realms available for client authentication.
  get_serv_host(self)
Get the service host name for SASL authentication.
  get_serv_name(self)
Get the service name for SASL authentication.
  get_serv_type(self)
Get the server name for SASL authentication.
    Inherited from StreamTLSMixIn
  get_tls_connection(self)
Get the TLS connection object for the stream.
    Inherited from PasswordManager
  check_password(self, username, password, realm)
Check the password validity.
  generate_nonce(self)
Generate a random string for digest authentication challenges.
    Inherited from StreamBase
  __del__(self)
  bind(self, resource)
Bind to a resource.
  check_to(self, to)
Check "to" attribute of received stream header.
  close(self)
Forcibly close the connection and clear the stream state.
  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).
  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.
  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.
  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.
    Inherited from StanzaProcessor
  process_iq(self, stanza)
Process IQ stanza received.
  process_message(self, stanza)
Process message stanza.
  process_presence(self, stanza)
Process presence stanza.
  process_stanza(self, stanza)
Process stanza received from the stream.
  route_stanza(self, stanza)
Process stanza not addressed to us.
  set_iq_get_handler(self, element, namespace, handler)
Set <iq type="get"/> handler.
  set_iq_set_handler(self, element, namespace, handler)
Set <iq type="set"/> handler.
  set_message_handler(self, typ, handler, namespace, priority)
Set a handler for <message/> stanzas.
  set_presence_handler(self, typ, handler, namespace, priority)
Set a handler for <presence/> stanzas.
  set_response_handlers(self, iq, res_handler, err_handler, timeout_handler, timeout)
Set response handler for an IQ "get" or "set" stanza.
  unset_iq_get_handler(self, element, namespace)
Remove <iq type="get"/> handler.
  unset_iq_set_handler(self, element, namespace)
Remove <iq type="set"/> handler.

Method Details

__init__(self, jid, password=None, server=None, port=5222, auth_methods=('sasl:DIGEST-MD5', 'digest'), tls_settings=None, keepalive=0)
(Constructor)

Initialize a LegacyClientStream object.

:Parameters:
    - `jid`: local JID.
    - `password`: user's password.
    - `server`: server to use. If not given then address will be derived form the JID.
    - `port`: port number to use. If not given then address will be derived form the JID.
    - `auth_methods`: sallowed authentication methods. SASL authentication mechanisms
      in the list should be prefixed with "sasl:" string.
    - `tls_settings`: settings for StartTLS -- `TLSSettings` instance.
    - `keepalive`: keepalive output interval. 0 to disable.
:Types:
    - `jid`: `pyxmpp.JID`
    - `password`: `unicode`
    - `server`: `unicode`
    - `port`: `int`
    - `auth_methods`: sequence of `str`
    - `tls_settings`: `pyxmpp.TLSSettings`
    - `keepalive`: `int`
Overrides:
pyxmpp.clientstream.ClientStream.__init__

auth_error(self, stanza)

Handle legacy authentication error.

[client only]

auth_finish(self, _unused)

Handle success of the legacy authentication.

auth_in_stage1(self, stanza)

Handle the first stage (<iq type='get'/>) of legacy ("plain" or
"digest") authentication.

[server only]

auth_in_stage2(self, stanza)

Handle the second stage (<iq type='set'/>) of legacy ("plain" or
"digest") authentication.

[server only]

auth_stage2(self, stanza)

Handle the first stage authentication response (result of the <iq
type="get"/>).

[client only]

auth_timeout(self)

Handle legacy authentication timeout.

[client only]

registration_error(self, stanza)

Handle in-band registration error.

[client only]

:Parameters:
    - `stanza`: the error stanza received or `None` on timeout.
:Types:
    - `stanza`: `pyxmpp.stanza.Stanza`

registration_form_received(self, stanza)

Handle registration form received.

[client only]

Call self.registration_callback with the registration form received
as the argument. Use the value returned by the callback will be a
filled-in form.

:Parameters:
    - `stanza`: the stanza received.
:Types:
    - `stanza`: `pyxmpp.iq.Iq`

registration_success(self, stanza)

Handle registration success.

[client only]

Clean up registration stuff, change state to "registered" and initialize
authentication.

:Parameters:
    - `stanza`: the stanza received.
:Types:
    - `stanza`: `pyxmpp.iq.Iq`

submit_registration_form(self, form)

Submit a registration form.

[client only]

:Parameters:
    - `form`: the filled-in form. When form is `None` or its type is
      "cancel" the registration is to be canceled.

:Types:
    - `form`: `pyxmpp.jabber.dataforms.Form`

Generated by Epydoc 2.1 on Wed May 31 22:36:59 2006 http://epydoc.sf.net