Package pyxmpp :: Package jabberd :: Module componentstream :: Class ComponentStream

[hide private]

# Class ComponentStream

source code

               streamtls.StreamTLSMixIn --+
                                          |
          sasl.core.PasswordManager --+   |
                                      |   |
             streamsasl.StreamSASLMixIn --+
                                          |
    stanzaprocessor.StanzaProcessor --+   |
                                      |   |
             xmlextra.StreamHandler --+   |
                                      |   |
                  streambase.StreamBase --+
                                          |
                              stream.Stream --+
                                              |
                                             ComponentStream

Handles jabberd component (jabber:component:accept) connection stream.

Instance Methods | [hide private]

__init__(self, jid, secret, server, port, keepalive=0, owner=None) Initialize a ComponentStream object. | source code

_reset(self) Reset ComponentStream object state, making the object ready to handle new connections. | source code

connect(self, server=None, port=None) Establish a client connection to a server. | source code

_connect(self, server=None, port=None) Same as ComponentStream.connect but assume self.lock is acquired. | source code

accept(self, sock) Accept an incoming component connection. | source code

stream_start(self, doc) Process <stream:stream> (stream start) tag received from peer. | source code

_post_connect(self) Initialize authentication when the connection is established and we are the initiator. | source code

`str`

_compute_handshake(self) Compute the authentication handshake value. | source code

_auth(self) Authenticate on the server. | source code

_process_node(self, node) Process first level element of the stream. | source code

Inherited from `stream.Stream` (private): `_got_features`, `_make_stream_features`

Inherited from `streamtls.StreamTLSMixIn`: `get_tls_connection`, `tls_is_certificate_valid`

Inherited from `streamtls.StreamTLSMixIn` (private): `_handle_tls_features`, `_make_stream_tls_features`, `_make_tls_connection`, `_process`, `_process_node_tls`, `_process_tls_node`, `_read`, `_read_tls`, `_request_tls`, `_reset_tls`, `_write_raw`

Inherited from `streamsasl.StreamSASLMixIn` (private): `_handle_sasl_features`, `_make_stream_sasl_features`, `_process_node_sasl`, `_process_sasl_abort`, `_process_sasl_auth`, `_process_sasl_challenge`, `_process_sasl_failure`, `_process_sasl_node`, `_process_sasl_response`, `_process_sasl_success`, `_reset_sasl`, `_sasl_authenticate`

Inherited from `sasl.core.PasswordManager`: `check_authzid`, `check_password`, `choose_realm`, `generate_nonce`, `get_password`, `get_realms`, `get_serv_host`, `get_serv_name`, `get_serv_type`

Inherited from `streambase.StreamBase`: `__del__`, `bind`, `check_to`, `close`, `connected`, `disconnect`, `error`, `fileno`, `generate_id`, `idle`, `loop`, `loop_iter`, `process`, `process_stream_error`, `send`, `stanza`, `stanza_start`, `state_change`, `stream_end`, `write_raw`

Inherited from `streambase.StreamBase` (private): `_accept`, `_bind_error`, `_bind_success`, `_close`, `_connect_socket`, `_disconnect`, `_feed_reader`, `_idle`, `_loop_iter`, `_make_reader`, `_post_auth`, `_process_stream_node`, `_restart_stream`, `_send`, `_send_stream_end`, `_send_stream_error`, `_send_stream_features`, `_send_stream_start`, `_write_node`

Inherited from `stanzaprocessor.StanzaProcessor`: `fix_in_stanza`, `fix_out_stanza`, `process_iq`, `process_message`, `process_presence`, `process_response`, `process_stanza`, `route_stanza`, `set_iq_get_handler`, `set_iq_set_handler`, `set_message_handler`, `set_presence_handler`, `set_response_handlers`, `unset_iq_get_handler`, `unset_iq_set_handler`

Inherited from `stanzaprocessor.StanzaProcessor` (private): `_set_response_handlers`

Inherited from `xmlextra.StreamHandler`: `warning`

Inherited from `xmlextra.StreamHandler` (private): `_stanza`, `_stream_end`, `_stream_start`

Instance Variables | [hide private]

: `int` | port : port number to use.
: `unicode` | secret : authentication secret.
: `unicode` | server : server to use.
Inherited from `stream.Stream`: `features`, `initiator`, `lock`, `me`, `peer`, `process_all_stanzas`, `tls` Inherited from `stream.Stream` (private): `_reader` Inherited from `streambase.StreamBase`: `owner`

Method Details | [hide private]

### __init__(self, jid, secret, server, port, keepalive=0, owner=None)
(Constructor)

source code

Initialize a ComponentStream object.

Parameters:
  - `jid` - : JID of the component.
  - `secret` - : authentication secret.
  - `server` - : server address.
  - `port` - : TCP port number on the server.
  - `keepalive` - : keepalive interval. 0 to disable.
  - `owner` - : Client, Component or similar object "owning" this stream.
Overrides: xmlextra.StreamHandler.__init__

### _reset(self)

source code

Reset ComponentStream object state, making the object ready to handle new connections.

Overrides: streambase.StreamBase._reset

### connect(self, server=None, port=None)

source code

Establish a client connection to a server.

[component only]

Parameters:
  - `server` (: `unicode`) - : name or address of the server to use. If not given then use the one specified when creating the object.
  - `port` (: `int`) - : port number of the server to use. If not given then use the one specified when creating the object.
Overrides: streambase.StreamBase.connect

### _connect(self, server=None, port=None)

source code

Same as ComponentStream.connect but assume self.lock is acquired.

Overrides: streambase.StreamBase._connect

### accept(self, sock)

source code

Accept an incoming component connection.

[server only]

Parameters:
  - `sock` - : a listening socket.
Overrides: streambase.StreamBase.accept

### stream_start(self, doc)

source code

Process <stream:stream> (stream start) tag received from peer.

Call Stream.stream_start, but ignore any HostMismatch error.

Parameters:
  - `doc` - : document created by the parser
Overrides: xmlextra.StreamHandler.stream_start

### _post_connect(self)

source code

Initialize authentication when the connection is established and we are the initiator.

Overrides: streambase.StreamBase._post_connect

### _compute_handshake(self)

source code

Compute the authentication handshake value.

Returns: `str`
  the computed hash value.

### _auth(self)

source code

Authenticate on the server.

[component only]

### _process_node(self, node)

source code

Process first level element of the stream.

Handle component handshake (authentication) element, and treat elements in "jabber:component:accept", "jabber:client" and "jabber:server" equally (pass to self.process_stanza). All other elements are passed to Stream._process_node.

Parameters:
  - `node` - : XML node describing the element
Overrides: streambase.StreamBase._process_node