def _process(self): """Same as `Stream.process` but assume `self.lock` is acquired.""" try: StreamBase._process(self) except SSLError, e: self.close() raise TLSError("TLS Error: " + str(e))
def _process(self): """Same as `Stream.process` but assume `self.lock` is acquired.""" try: StreamBase._process(self) except SSLError,e: self.close() raise TLSError("TLS Error: "+str(e))
def _read(self): """Read data pending on the stream socket and pass it to the parser.""" self.__logger.debug("StreamTLSMixIn._read(), socket: %r", self.socket) if self.tls: self._read_tls() else: StreamBase._read(self)
def _read(self): """Read data pending on the stream socket and pass it to the parser.""" self.__logger.debug("StreamTLSMixIn._read(), socket: %r",self.socket) if self.tls: self._read_tls() else: StreamBase._read(self)
def _got_features(self): """Process incoming <stream:features/> element. [initiating entity only] The received features node is available in `self.features`.""" self._handle_tls_features() self._handle_sasl_features() StreamBase._got_features(self) if not self.tls_requested and not self.authenticated: self.state_change("fully connected",self.peer) self._post_connect()
def _got_features(self): """Process incoming <stream:features/> element. [initiating entity only] The received features node is available in `self.features`.""" self._handle_tls_features() self._handle_sasl_features() StreamBase._got_features(self) if not self.tls_requested and not self.authenticated: self.state_change("fully connected", self.peer) self._post_connect()
def _process_node(self,xmlnode): """Process first level element of the stream. The element may be stream error or features, StartTLS request/response, SASL request/response or a stanza. :Parameters: - `xmlnode`: XML node describing the element """ if self._process_node_tls(xmlnode): return if self._process_node_sasl(xmlnode): return StreamBase._process_node(self,xmlnode)
def _process_node(self, xmlnode): """Process first level element of the stream. The element may be stream error or features, StartTLS request/response, SASL request/response or a stanza. :Parameters: - `xmlnode`: XML node describing the element """ if self._process_node_tls(xmlnode): return if self._process_node_sasl(xmlnode): return StreamBase._process_node(self, xmlnode)
def __init__(self, default_ns, extra_ns=(), sasl_mechanisms=(), tls_settings=None, keepalive=0, owner=None): """Initialize Stream object :Parameters: - `default_ns`: stream's default namespace ("jabber:client" for client, "jabber:server" for server, etc.) - `extra_ns`: sequence of extra namespace URIs to be defined for the stream. - `sasl_mechanisms`: sequence of SASL mechanisms allowed for authentication. Currently "PLAIN", "DIGEST-MD5" and "GSSAPI" are supported. - `tls_settings`: settings for StartTLS -- `TLSSettings` instance. - `keepalive`: keepalive output interval. 0 to disable. - `owner`: `Client`, `Component` or similar object "owning" this stream. """ StreamBase.__init__(self, default_ns, extra_ns, keepalive, owner) StreamTLSMixIn.__init__(self, tls_settings) StreamSASLMixIn.__init__(self, sasl_mechanisms) self.__logger = logging.getLogger("pyxmpp.Stream")
def _make_stream_features(self): """Create the <features/> element for the stream. [receving entity only] :returns: new <features/> element node.""" features=StreamBase._make_stream_features(self) self._make_stream_tls_features(features) self._make_stream_sasl_features(features) return features
def _make_stream_features(self): """Create the <features/> element for the stream. [receving entity only] :returns: new <features/> element node.""" features = StreamBase._make_stream_features(self) self._make_stream_tls_features(features) self._make_stream_sasl_features(features) return features
def __init__(self, default_ns, extra_ns = (), sasl_mechanisms = (), tls_settings = None, keepalive = 0, owner = None): """Initialize Stream object :Parameters: - `default_ns`: stream's default namespace ("jabber:client" for client, "jabber:server" for server, etc.) - `extra_ns`: sequence of extra namespace URIs to be defined for the stream. - `sasl_mechanisms`: sequence of SASL mechanisms allowed for authentication. Currently "PLAIN", "DIGEST-MD5" and "GSSAPI" are supported. - `tls_settings`: settings for StartTLS -- `TLSSettings` instance. - `keepalive`: keepalive output interval. 0 to disable. - `owner`: `Client`, `Component` or similar object "owning" this stream. """ StreamBase.__init__(self, default_ns, extra_ns, keepalive, owner) StreamTLSMixIn.__init__(self, tls_settings) StreamSASLMixIn.__init__(self, sasl_mechanisms) self.__logger = logging.getLogger("pyxmpp.Stream")
def _reset(self): """Reset `Stream` object state making it ready to handle new connections.""" StreamBase._reset(self) self._reset_tls() self._reset_sasl()