t.p.t.TLSMemoryBIOProtocol(ProtocolWrapper) : class documentation

Part of twisted.protocols.tls View Source View In Hierarchy

Implements interfaces: twisted.internet.interfaces.ISSLTransport, twisted.internet.interfaces.ISystemHandle

TLSMemoryBIOProtocol is a protocol wrapper which uses OpenSSL via a memory BIO to encrypt bytes written to it before sending them on to the underlying transport and decrypts bytes received from the underlying transport before delivering them to the wrapped protocol.
Instance Variables_tlsConnectionThe OpenSSL.SSL.Connection instance which is encrypted and decrypting this connection.
_lostConnectionA flag indicating whether connection loss has already been dealt with (True) or not (False).
_writeBlockedOnReadA flag indicating whether further writing must wait for data to be received (True) or not (False).
_appSendBufferA list of str of application-level (cleartext) data which is waiting for _writeBlockedOnRead to be reset to False so it can be passed to and perhaps accepted by _tlsConnection.send.
_connectWrappedA flag indicating whether or not to call makeConnection on the wrapped protocol. This is for the reactor's ITLSTransport.startTLS implementation, since it has a protocol which it has already called makeConnection on, and which has no interest in a new transport. See #3821.
_handshakeDoneA flag indicating whether or not the handshake is known to have completed successfully (True) or not (False). This is used to control error reporting behavior. If the handshake has not completed, the underlying OpenSSL.SSL.Error will be passed to the application's connectionLost method. If it has completed, any unexpected OpenSSL.SSL.Error will be turned into a ConnectionLost. This is weird; however, it is simply an attempt at a faithful re-implementation of the behavior provided by twisted.internet.ssl.
_reasonIf an unexpected OpenSSL.SSL.Error occurs which causes the connection to be lost, it is saved here. If appropriate, this may be used as the reason passed to the application protocol's connectionLost method.
Method __init__ Undocumented
Method getHandle Return the OpenSSL.SSL.Connection object being used to encrypt and decrypt this connection.
Method makeConnection Connect this wrapper to the given transport and initialize the necessary OpenSSL.SSL.Connection with a memory BIO.
Method dataReceived Deliver any received bytes to the receive BIO and then read and deliver to the application any application-level data which becomes available as a result of this.
Method connectionLost Handle the possible repetition of calls to this method (due to either the underlying transport going away or due to an error at the TLS layer) and make sure the base implementation only gets invoked once.
Method loseConnection Send a TLS close alert and close the underlying connection.
Method write Process the given application bytes and send any resulting TLS traffic which arrives in the send BIO.
Method writeSequence Write a sequence of application bytes by joining them into one string and passing them to write.
Method getPeerCertificate Return an object with the peer's certificate info.
Method _flushSendBIO Read any bytes out of the send BIO and write them to the underlying transport.
Method _flushReceiveBIO No summary

Inherited from ProtocolWrapper:

Method getPeer Undocumented
Method getHost Undocumented
Method registerProducer Undocumented
Method unregisterProducer Undocumented
Method stopConsuming Undocumented
Method __getattr__ Undocumented

Inherited from BaseProtocol (via ProtocolWrapper, Protocol):

Method connectionMade Called when a connection is made.
def __init__(self, factory, wrappedProtocol, _connectWrapped=True): (source)
Undocumented
def getHandle(self): (source)

Return the OpenSSL.SSL.Connection object being used to encrypt and decrypt this connection.

This is done for the benefit of twisted.internet.ssl.Certificate's peerFromTransport and hostFromTransport methods only. A different system handle may be returned by future versions of this method.
def makeConnection(self, transport): (source)
Connect this wrapper to the given transport and initialize the necessary OpenSSL.SSL.Connection with a memory BIO.
def _flushSendBIO(self): (source)
Read any bytes out of the send BIO and write them to the underlying transport.
def _flushReceiveBIO(self): (source)
Try to receive any application-level bytes which are now available because of a previous write into the receive BIO. This will take care of delivering any application-level bytes which are received to the protocol, as well as handling of the various exceptions which can come from trying to get such bytes.
def dataReceived(self, bytes): (source)
Deliver any received bytes to the receive BIO and then read and deliver to the application any application-level data which becomes available as a result of this.
def connectionLost(self, reason): (source)
Handle the possible repetition of calls to this method (due to either the underlying transport going away or due to an error at the TLS layer) and make sure the base implementation only gets invoked once.
def loseConnection(self): (source)
Send a TLS close alert and close the underlying connection.
def write(self, bytes): (source)
Process the given application bytes and send any resulting TLS traffic which arrives in the send BIO.
def writeSequence(self, iovec): (source)
Write a sequence of application bytes by joining them into one string and passing them to write.
def getPeerCertificate(self): (source)
Return an object with the peer's certificate info.
API Documentation for Twisted, generated by pydoctor at 2011-10-27 16:27:37.