pyxmpp.streamtls.StreamTLSMixIn

Package pyxmpp :: Module streamtls :: Class StreamTLSMixIn |
[show private | hide private]
[frames | no frames]

## Class StreamTLSMixIn

Known Subclasses:
  `Stream`

Mix-in class providing TLS support for an XMPP stream.

Method Summary
| ``__init__`(self, tls_settings)` Initialize TLS support of a Stream object
| ``get_tls_connection`(self)` Get the TLS connection object for the stream.
| ``_handle_tls_features`(self)` Process incoming StartTLS related element of <stream:features/>.
`libxml2.xmlNode` | ``_make_stream_tls_features`(self, features)` Update the <features/> with StartTLS feature.
| ``_make_tls_connection`(self)` Initiate TLS connection.
| ``_process`(self)` Same as `Stream.process` but assume `self.lock` is acquired.
`bool` | ``_process_node_tls`(self, xmlnode)` Process incoming stream element.
| ``_process_tls_node`(self, xmlnode)` Process stream element in the TLS namespace.
| ``_read`(self)` Read data pending on the stream socket and pass it to the parser.
| ``_read_tls`(self)` Read data pending on the stream socket and pass it to the parser.
| ``_request_tls`(self)` Request a TLS-encrypted connection.
| ``_reset_tls`(self)` Reset `StreamTLSMixIn` object state making it ready to handle new connections.
| ``_tls_verify_callback`(self, ssl_ctx_ptr, x509_ptr, errnum, depth, ok)` Certificate verification callback for TLS connections.
| ``_write_raw`(self, data)` Same as `Stream.write_raw` but assume `self.lock` is acquired.

Instance Variable Summary
| `tls`: TLS connection object.

Method Details

### __init__(self, tls_settings=None) (Constructor) Initialize TLS support of a Stream object Parameters: `tls_settings` - settings for StartTLS. (type=`TLSSettings`)

### get_tls_connection(self) Get the TLS connection object for the stream. Returns: `self.tls`

### _handle_tls_features(self) Process incoming StartTLS related element of <stream:features/>. [initiating entity only] The received features node is available in `self.features`.

### _make_stream_tls_features(self, features) Update the <features/> with StartTLS feature. [receving entity only] Parameters: `features` - the <features/> element of the stream. (type=`libxml2.xmlNode`) Returns: updated <features/> element node. (type=`libxml2.xmlNode`)

### _make_tls_connection(self) Initiate TLS connection. [initiating entity only]

### _process(self) Same as `Stream.process` but assume `self.lock` is acquired.

### _process_node_tls(self, xmlnode) Process incoming stream element. Pass it to _process_tls_node if it is in TLS namespace. Returns: `True` when the node was recognized as TLS element. (type=`bool`) Raises: `StreamEncryptionRequired` - if encryption is required by current configuration, it is not active and the element is not in the TLS namespace nor in the stream namespace.

### _process_tls_node(self, xmlnode) Process stream element in the TLS namespace. Parameters: `xmlnode` - the XML node received

### _read(self) Read data pending on the stream socket and pass it to the parser.

### _read_tls(self) Read data pending on the stream socket and pass it to the parser.

### _request_tls(self) Request a TLS-encrypted connection. [initiating entity only]

### _reset_tls(self) Reset `StreamTLSMixIn` object state making it ready to handle new connections.

### _tls_verify_callback(self, ssl_ctx_ptr, x509_ptr, errnum, depth, ok) Certificate verification callback for TLS connections. Parameters: `ssl_ctx_ptr` - TLS context pointer. `x509_ptr` - X.509 certificate pointer. `errnum` - error number. `depth` - verification depth. `ok` - current verification result. Returns: computed verification result.

### _write_raw(self, data) Same as `Stream.write_raw` but assume `self.lock` is acquired.

Instance Variable Details

### tls TLS connection object.