Package tlslite :: Package integration :: Module asyncstatemachine :: Class AsyncStateMachine
[hide private]
[frames] | no frames]

Class AsyncStateMachine

source code


This is an abstract class that's used to integrate TLS Lite with asyncore and Twisted.

This class signals wantsReadsEvent() and wantsWriteEvent(). When the underlying socket has become readable or writeable, the event should be passed to this class by calling inReadEvent() or inWriteEvent(). This class will then try to read or write through the socket, and will update its state appropriately.

This class will forward higher-level events to its subclass. For example, when a complete TLS record has been received, outReadEvent() will be called with the decrypted data.

Instance Methods [hide private]
 
__init__(self) source code
 
_checkAssert(self, maxActive=1) source code
 
_clear(self) source code
 
_doCloseOp(self) source code
 
_doHandshakeOp(self) source code
 
_doReadOp(self) source code
 
_doWriteOp(self) source code
 
inReadEvent(self)
Tell the state machine it can read from the socket.
source code
 
inWriteEvent(self)
Tell the state machine it can write to the socket.
source code
 
outCloseEvent(self)
Called when a close operation completes.
source code
 
outConnectEvent(self)
Called when a handshake operation completes.
source code
 
outReadEvent(self, readBuffer)
Called when a read operation completes.
source code
 
outWriteEvent(self)
Called when a write operation completes.
source code
 
setCloseOp(self)
Start a close operation.
source code
 
setHandshakeOp(self, handshaker)
Start a handshake operation.
source code
 
setServerHandshakeOp(self, **args)
Start a handshake operation.
source code
 
setWriteOp(self, writeBuffer)
Start a write operation.
source code
bool or None
wantsReadEvent(self)
If the state machine wants to read.
source code
bool or None
wantsWriteEvent(self)
If the state machine wants to write.
source code
Method Details [hide private]

outCloseEvent(self)

source code 

Called when a close operation completes.

May be overridden in subclass.

outConnectEvent(self)

source code 

Called when a handshake operation completes.

May be overridden in subclass.

outReadEvent(self, readBuffer)

source code 

Called when a read operation completes.

May be overridden in subclass.

outWriteEvent(self)

source code 

Called when a write operation completes.

May be overridden in subclass.

setHandshakeOp(self, handshaker)

source code 

Start a handshake operation.

Parameters:
  • handshaker (generator) - A generator created by using one of the asynchronous handshake functions (i.e. handshakeServerAsync, or handshakeClientxxx(..., async=True).

setServerHandshakeOp(self, **args)

source code 

Start a handshake operation.

The arguments passed to this function will be forwarded to tlslite.tlsconnection.TLSConnection.handshakeServerAsync.

setWriteOp(self, writeBuffer)

source code 

Start a write operation.

Parameters:
  • writeBuffer (str) - The string to transmit.

wantsReadEvent(self)

source code 

If the state machine wants to read.

If an operation is active, this returns whether or not the operation wants to read from the socket. If an operation is not active, this returns None.

Returns: bool or None
If the state machine wants to read.

wantsWriteEvent(self)

source code 

If the state machine wants to write.

If an operation is active, this returns whether or not the operation wants to write to the socket. If an operation is not active, this returns None.

Returns: bool or None
If the state machine wants to write.